diff options
| author | 2023-03-23 14:46:59 +0000 | |
|---|---|---|
| committer | 2023-03-23 14:46:59 +0000 | |
| commit | 3f867c81ec4bea3404e6899e2467b6845d1f6af1 (patch) | |
| tree | 4d537665a979404e1c82efa65b189a4c3e7d36e4 | |
| parent | 1d480ca06e53c3c01354e51139c365718b77acc6 (diff) | |
| parent | 451856db69364a38880ba9567eff556e92adbd08 (diff) | |
Merge "Clear mInheritedCompatDisplayInsets when clearing size compat mode" into tm-qpr-dev am: 451856db69
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22185523
Change-Id: I6454e4d3ddf89bfe89a7327f6fb7cdfcf8d1e0d3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
3 files changed, 34 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 607b7e78c4ad..74de471c9d66 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -8073,6 +8073,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mSizeCompatScale = 1f; mSizeCompatBounds = null; mCompatDisplayInsets = null; + mLetterboxUiController.clearInheritedCompatDisplayInsets(); } @VisibleForTesting diff --git a/services/core/java/com/android/server/wm/LetterboxUiController.java b/services/core/java/com/android/server/wm/LetterboxUiController.java index 93c9a1171354..f96c4dc52c25 100644 --- a/services/core/java/com/android/server/wm/LetterboxUiController.java +++ b/services/core/java/com/android/server/wm/LetterboxUiController.java @@ -1494,6 +1494,10 @@ final class LetterboxUiController { return mInheritedCompatDisplayInsets; } + void clearInheritedCompatDisplayInsets() { + mInheritedCompatDisplayInsets = null; + } + /** * In case of translucent activities, it consumes the {@link ActivityRecord} of the first opaque * activity beneath using the given consumer and returns {@code true}. diff --git a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java index 5e0f6109bd75..0b8763a4747b 100644 --- a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java @@ -64,6 +64,8 @@ import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; @@ -486,6 +488,33 @@ public class SizeCompatTests extends WindowTestsBase { } @Test + public void testTranslucentActivity_clearSizeCompatMode_inheritedCompatDisplayInsetsCleared() { + mWm.mLetterboxConfiguration.setTranslucentLetterboxingOverrideEnabled(true); + setUpDisplaySizeWithApp(2800, 1400); + mActivity.mDisplayContent.setIgnoreOrientationRequest(true /* ignoreOrientationRequest */); + prepareUnresizable(mActivity, -1f /* maxAspect */, SCREEN_ORIENTATION_PORTRAIT); + // Rotate to put activity in size compat mode. + rotateDisplay(mActivity.mDisplayContent, ROTATION_90); + assertTrue(mActivity.inSizeCompatMode()); + + // We launch a transparent activity + final ActivityRecord translucentActivity = new ActivityBuilder(mAtm) + .setLaunchedFromUid(mActivity.getUid()) + .setScreenOrientation(SCREEN_ORIENTATION_PORTRAIT) + .build(); + doReturn(false).when(translucentActivity).fillsParent(); + mTask.addChild(translucentActivity); + + // The transparent activity inherits the compat display insets of the opaque activity + // beneath it + assertNotNull(translucentActivity.getCompatDisplayInsets()); + + // Clearing SCM should also clear the inherited compat display insets + translucentActivity.clearSizeCompatMode(); + assertNull(translucentActivity.getCompatDisplayInsets()); + } + + @Test public void testRestartProcessIfVisible() { setUpDisplaySizeWithApp(1000, 2500); doNothing().when(mSupervisor).scheduleRestartTimeout(mActivity); |