diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-09-29 23:10:25 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-09-29 23:10:25 +0000 |
commit | f5a8542bd307d3acddfd38dad5b7a2883d4f94da (patch) | |
tree | 83dd549ba5b2bf409736755818f541c004c2708d | |
parent | e6e9ce7ba9491cc1591dc15721d1a1f5e217bb8b (diff) | |
parent | 2ca98d205756ab6d944558c20ee4d950717ac472 (diff) | |
download | base-f5a8542bd307d3acddfd38dad5b7a2883d4f94da.tar.gz |
Snap for 6872792 from 2ca98d205756ab6d944558c20ee4d950717ac472 to rvc-qpr1-release
Change-Id: I25644071a8361d042aa159f8208369b2fcb1d062
11 files changed, 46 insertions, 66 deletions
diff --git a/core/java/android/app/ActivityView.java b/core/java/android/app/ActivityView.java index 3cb6293f0706..98a23f2b0075 100644 --- a/core/java/android/app/ActivityView.java +++ b/core/java/android/app/ActivityView.java @@ -105,8 +105,7 @@ public class ActivityView extends ViewGroup implements android.window.TaskEmbedd public ActivityView( @NonNull Context context, @NonNull AttributeSet attrs, int defStyle, boolean singleTaskInstance, boolean usePublicVirtualDisplay) { - this(context, attrs, defStyle, singleTaskInstance, usePublicVirtualDisplay, - false /* disableSurfaceViewBackgroundLayer */); + this(context, attrs, defStyle, singleTaskInstance, usePublicVirtualDisplay, false); } /** @hide */ @@ -114,22 +113,12 @@ public class ActivityView extends ViewGroup implements android.window.TaskEmbedd @NonNull Context context, @NonNull AttributeSet attrs, int defStyle, boolean singleTaskInstance, boolean usePublicVirtualDisplay, boolean disableSurfaceViewBackgroundLayer) { - this(context, attrs, defStyle, singleTaskInstance, usePublicVirtualDisplay, - disableSurfaceViewBackgroundLayer, false /* useTrustedDisplay */); - } - - // TODO(b/162901735): Refactor ActivityView with Builder - /** @hide */ - public ActivityView( - @NonNull Context context, @NonNull AttributeSet attrs, int defStyle, - boolean singleTaskInstance, boolean usePublicVirtualDisplay, - boolean disableSurfaceViewBackgroundLayer, boolean useTrustedDisplay) { super(context, attrs, defStyle); if (useTaskOrganizer()) { mTaskEmbedder = new TaskOrganizerTaskEmbedder(context, this); } else { mTaskEmbedder = new VirtualDisplayTaskEmbedder(context, this, singleTaskInstance, - usePublicVirtualDisplay, useTrustedDisplay); + usePublicVirtualDisplay); } mSurfaceView = new SurfaceView(context, null, 0, 0, disableSurfaceViewBackgroundLayer); // Since ActivityView#getAlpha has been overridden, we should use parent class's alpha diff --git a/core/java/android/hardware/camera2/CaptureRequest.java b/core/java/android/hardware/camera2/CaptureRequest.java index 1b1ccb590e16..4bc9151fed83 100644 --- a/core/java/android/hardware/camera2/CaptureRequest.java +++ b/core/java/android/hardware/camera2/CaptureRequest.java @@ -2175,10 +2175,8 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> /** * <p>The desired zoom ratio</p> - * <p>Instead of using {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} with dual purposes of crop and zoom, the - * application can now choose to use this tag to specify the desired zoom level. The - * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} can still be used to specify the horizontal or vertical - * crop to achieve aspect ratios different than the native camera sensor.</p> + * <p>Instead of using {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} for zoom, the application can now choose to + * use this tag to specify the desired zoom level.</p> * <p>By using this control, the application gains a simpler way to control zoom, which can * be a combination of optical and digital zoom. For example, a multi-camera system may * contain more than one lens with different focal lengths, and the user can use optical @@ -2860,11 +2858,18 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> * respectively.</p> * <p>The camera device may adjust the crop region to account for rounding and other hardware * requirements; the final crop region used will be included in the output capture result.</p> + * <p>The camera sensor output aspect ratio depends on factors such as output stream + * combination and {@link CaptureRequest#CONTROL_AE_TARGET_FPS_RANGE android.control.aeTargetFpsRange}, and shouldn't be adjusted by using + * this control. And the camera device will treat different camera sensor output sizes + * (potentially with in-sensor crop) as the same crop of + * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}. As a result, the application shouldn't assume the + * maximum crop region always maps to the same aspect ratio or field of view for the + * sensor output.</p> * <p>Starting from API level 30, it's strongly recommended to use {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} * to take advantage of better support for zoom with logical multi-camera. The benefits * include better precision with optical-digital zoom combination, and ability to do * zoom-out from 1.0x. When using {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for zoom, the crop region in - * the capture request must be either letterboxing or pillarboxing (but not both). The + * the capture request should be left as the default activeArray size. The * coordinate system is post-zoom, meaning that the activeArraySize or * preCorrectionActiveArraySize covers the camera device's field of view "after" zoom. See * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details.</p> @@ -2874,6 +2879,7 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>> * capability and mode</p> * <p>This key is available on all devices.</p> * + * @see CaptureRequest#CONTROL_AE_TARGET_FPS_RANGE * @see CaptureRequest#CONTROL_ZOOM_RATIO * @see CaptureRequest#DISTORTION_CORRECTION_MODE * @see CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM diff --git a/core/java/android/hardware/camera2/CaptureResult.java b/core/java/android/hardware/camera2/CaptureResult.java index b54696741e2f..5c10e96fd2ce 100644 --- a/core/java/android/hardware/camera2/CaptureResult.java +++ b/core/java/android/hardware/camera2/CaptureResult.java @@ -2405,10 +2405,8 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { /** * <p>The desired zoom ratio</p> - * <p>Instead of using {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} with dual purposes of crop and zoom, the - * application can now choose to use this tag to specify the desired zoom level. The - * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} can still be used to specify the horizontal or vertical - * crop to achieve aspect ratios different than the native camera sensor.</p> + * <p>Instead of using {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion} for zoom, the application can now choose to + * use this tag to specify the desired zoom level.</p> * <p>By using this control, the application gains a simpler way to control zoom, which can * be a combination of optical and digital zoom. For example, a multi-camera system may * contain more than one lens with different focal lengths, and the user can use optical @@ -3506,11 +3504,18 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { * respectively.</p> * <p>The camera device may adjust the crop region to account for rounding and other hardware * requirements; the final crop region used will be included in the output capture result.</p> + * <p>The camera sensor output aspect ratio depends on factors such as output stream + * combination and {@link CaptureRequest#CONTROL_AE_TARGET_FPS_RANGE android.control.aeTargetFpsRange}, and shouldn't be adjusted by using + * this control. And the camera device will treat different camera sensor output sizes + * (potentially with in-sensor crop) as the same crop of + * {@link CameraCharacteristics#SENSOR_INFO_ACTIVE_ARRAY_SIZE android.sensor.info.activeArraySize}. As a result, the application shouldn't assume the + * maximum crop region always maps to the same aspect ratio or field of view for the + * sensor output.</p> * <p>Starting from API level 30, it's strongly recommended to use {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} * to take advantage of better support for zoom with logical multi-camera. The benefits * include better precision with optical-digital zoom combination, and ability to do * zoom-out from 1.0x. When using {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for zoom, the crop region in - * the capture request must be either letterboxing or pillarboxing (but not both). The + * the capture request should be left as the default activeArray size. The * coordinate system is post-zoom, meaning that the activeArraySize or * preCorrectionActiveArraySize covers the camera device's field of view "after" zoom. See * {@link CaptureRequest#CONTROL_ZOOM_RATIO android.control.zoomRatio} for details.</p> @@ -3520,6 +3525,7 @@ public class CaptureResult extends CameraMetadata<CaptureResult.Key<?>> { * capability and mode</p> * <p>This key is available on all devices.</p> * + * @see CaptureRequest#CONTROL_AE_TARGET_FPS_RANGE * @see CaptureRequest#CONTROL_ZOOM_RATIO * @see CaptureRequest#DISTORTION_CORRECTION_MODE * @see CameraCharacteristics#SCALER_AVAILABLE_MAX_DIGITAL_ZOOM diff --git a/core/java/android/window/VirtualDisplayTaskEmbedder.java b/core/java/android/window/VirtualDisplayTaskEmbedder.java index 9013da36007e..9ccb4c172158 100644 --- a/core/java/android/window/VirtualDisplayTaskEmbedder.java +++ b/core/java/android/window/VirtualDisplayTaskEmbedder.java @@ -19,7 +19,6 @@ package android.window; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_DESTROY_CONTENT_ON_REMOVAL; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY; import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC; -import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_TRUSTED; import static android.view.Display.INVALID_DISPLAY; import android.app.ActivityManager; @@ -64,7 +63,6 @@ public class VirtualDisplayTaskEmbedder extends TaskEmbedder { private int mDisplayDensityDpi; private final boolean mSingleTaskInstance; private final boolean mUsePublicVirtualDisplay; - private final boolean mUseTrustedDisplay; private VirtualDisplay mVirtualDisplay; private Insets mForwardedInsets; private DisplayMetrics mTmpDisplayMetrics; @@ -79,12 +77,10 @@ public class VirtualDisplayTaskEmbedder extends TaskEmbedder { * only applicable if virtual displays are used */ public VirtualDisplayTaskEmbedder(Context context, VirtualDisplayTaskEmbedder.Host host, - boolean singleTaskInstance, boolean usePublicVirtualDisplay, - boolean useTrustedDisplay) { + boolean singleTaskInstance, boolean usePublicVirtualDisplay) { super(context, host); mSingleTaskInstance = singleTaskInstance; mUsePublicVirtualDisplay = usePublicVirtualDisplay; - mUseTrustedDisplay = useTrustedDisplay; } /** @@ -107,9 +103,6 @@ public class VirtualDisplayTaskEmbedder extends TaskEmbedder { if (mUsePublicVirtualDisplay) { virtualDisplayFlags |= VIRTUAL_DISPLAY_FLAG_PUBLIC; } - if (mUseTrustedDisplay) { - virtualDisplayFlags |= VIRTUAL_DISPLAY_FLAG_TRUSTED; - } mVirtualDisplay = displayManager.createVirtualDisplay( DISPLAY_NAME + "@" + System.identityHashCode(this), mHost.getWidth(), diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml index 7597e8732153..5c2841aff1d8 100644 --- a/core/tests/coretests/AndroidManifest.xml +++ b/core/tests/coretests/AndroidManifest.xml @@ -129,7 +129,6 @@ <!-- virtual display test permissions --> <uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" /> <uses-permission android:name="android.permission.CAPTURE_SECURE_VIDEO_OUTPUT" /> - <uses-permission android:name="android.permission.ADD_TRUSTED_DISPLAY" /> <!-- color extraction test permissions --> <uses-permission android:name="android.permission.READ_FRAME_BUFFER" /> diff --git a/core/tests/coretests/src/android/hardware/display/VirtualDisplayTest.java b/core/tests/coretests/src/android/hardware/display/VirtualDisplayTest.java index 0f6284d22d10..daf613976358 100644 --- a/core/tests/coretests/src/android/hardware/display/VirtualDisplayTest.java +++ b/core/tests/coretests/src/android/hardware/display/VirtualDisplayTest.java @@ -247,25 +247,6 @@ public class VirtualDisplayTest extends AndroidTestCase { assertDisplayUnregistered(display); } - /** - * Ensures that an application can create a trusted virtual display with the permission - * {@code ADD_TRUSTED_DISPLAY}. - */ - public void testTrustedVirtualDisplay() throws Exception { - VirtualDisplay virtualDisplay = mDisplayManager.createVirtualDisplay(NAME, - WIDTH, HEIGHT, DENSITY, mSurface, - DisplayManager.VIRTUAL_DISPLAY_FLAG_TRUSTED); - assertNotNull("virtual display must not be null", virtualDisplay); - - Display display = virtualDisplay.getDisplay(); - try { - assertDisplayRegistered(display, Display.FLAG_PRIVATE | Display.FLAG_TRUSTED); - } finally { - virtualDisplay.release(); - } - assertDisplayUnregistered(display); - } - private void assertDisplayRegistered(Display display, int flags) { assertNotNull("display object must not be null", display); assertTrue("display must be valid", display.isValid()); diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java index 58d5776543a9..1e556a3ed402 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java @@ -301,7 +301,7 @@ public class BubbleExpandedView extends LinearLayout { mActivityView = new ActivityView(mContext, null /* attrs */, 0 /* defStyle */, true /* singleTaskInstance */, false /* usePublicVirtualDisplay*/, - true /* disableSurfaceViewBackgroundLayer */, true /* useTrustedDisplay */); + true /* disableSurfaceViewBackgroundLayer */); // Set ActivityView's alpha value as zero, since there is no view content to be shown. setContentVisibility(false); diff --git a/services/core/java/com/android/server/display/DisplayManagerService.java b/services/core/java/com/android/server/display/DisplayManagerService.java index 852868616afd..24661d69a78e 100644 --- a/services/core/java/com/android/server/display/DisplayManagerService.java +++ b/services/core/java/com/android/server/display/DisplayManagerService.java @@ -86,7 +86,6 @@ import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.text.TextUtils; -import android.util.EventLog; import android.util.IntArray; import android.util.Pair; import android.util.Slog; @@ -2192,16 +2191,10 @@ public final class DisplayManagerService extends SystemService { } } - if (callingUid != Process.SYSTEM_UID && (flags & VIRTUAL_DISPLAY_FLAG_TRUSTED) != 0) { - if (!checkCallingPermission(ADD_TRUSTED_DISPLAY, "createVirtualDisplay()")) { - EventLog.writeEvent(0x534e4554, "162627132", callingUid, - "Attempt to create a trusted display without holding permission!"); - throw new SecurityException("Requires ADD_TRUSTED_DISPLAY permission to " - + "create a trusted virtual display."); - } - } - - if ((flags & VIRTUAL_DISPLAY_FLAG_TRUSTED) == 0) { + if (callingUid == Process.SYSTEM_UID + || checkCallingPermission(ADD_TRUSTED_DISPLAY, "createVirtualDisplay()")) { + flags |= VIRTUAL_DISPLAY_FLAG_TRUSTED; + } else { flags &= ~VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS; } diff --git a/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java b/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java index e7fbc334306e..5ab48e158c4d 100644 --- a/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java +++ b/services/core/java/com/android/server/wm/ImeInsetsSourceProvider.java @@ -138,8 +138,9 @@ class ImeInsetsSourceProvider extends InsetsSourceProvider { && dcTarget.getParentWindow() == mImeTargetFromIme && dcTarget.mSubLayer > mImeTargetFromIme.getWindow().mSubLayer) || mImeTargetFromIme == mDisplayContent.getImeFallback() + || mImeTargetFromIme == mDisplayContent.mInputMethodInputTarget || controlTarget == mImeTargetFromIme - && (mImeTargetFromIme.getWindow() == null + && (mImeTargetFromIme.getWindow() == null || !mImeTargetFromIme.getWindow().isClosing()); } diff --git a/services/tests/wmtests/src/com/android/server/wm/ImeInsetsSourceProviderTest.java b/services/tests/wmtests/src/com/android/server/wm/ImeInsetsSourceProviderTest.java index ca739c0dd389..91cfd4e6a89d 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ImeInsetsSourceProviderTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/ImeInsetsSourceProviderTest.java @@ -56,4 +56,12 @@ public class ImeInsetsSourceProviderTest extends WindowTestsBase { mImeProvider.scheduleShowImePostLayout(appWin); assertTrue(mImeProvider.isImeTargetFromDisplayContentAndImeSame()); } + + @Test + public void testInputMethodInputTargetCanShowIme() { + WindowState target = createWindow(null, TYPE_APPLICATION, "app"); + mDisplayContent.mInputMethodTarget = target; + mImeProvider.scheduleShowImePostLayout(target); + assertTrue(mImeProvider.isImeTargetFromDisplayContentAndImeSame()); + } } diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index fb6af5b550b0..4a61db894b89 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -1054,8 +1054,8 @@ public class WifiManager { /** * Broadcast intent action indicating that the link configuration changed on wifi. * <br />Included Extras: - * <br />{@link #EXTRA_LINK_PROPERTIES}: {@link android.net.LinkProperties} object associated - * with the Wi-Fi network. + * <br />{@link #EXTRA_LINK_PROPERTIES}: may not be set starting in Android 11. Check for + * <br /> null before reading its value. * <br /> No permissions are required to listen to this broadcast. * @hide */ @@ -1071,6 +1071,10 @@ public class WifiManager { * Included in the {@link #ACTION_LINK_CONFIGURATION_CHANGED} broadcast. * * Retrieve with {@link android.content.Intent#getParcelableExtra(String)}. + * + * Note: this extra may not be set starting in Android 11. Check for null before reading its + * value. + * * @hide */ @SystemApi |