diff options
| author | 2022-01-22 03:16:15 +0000 | |
|---|---|---|
| committer | 2022-01-22 03:16:15 +0000 | |
| commit | 7d242203fb0e41752c255b41ea155e5314c92b5c (patch) | |
| tree | 2190838c00e9c26276421d3a3f3292d2213df595 | |
| parent | 0fd819f75fd8116ef1fa27e2ae252fc69cde21ea (diff) | |
| parent | 3303217286f40b13dd08311581848f067f486f18 (diff) | |
Merge "Reset override config when clearSizeCompat" into sc-v2-dev am: 3303217286
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16668784
Change-Id: I871ee9179d55226abb7ffbb6558fbcecf0223394
| -rw-r--r-- | services/core/java/com/android/server/wm/ActivityRecord.java | 3 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java | 24 |
2 files changed, 26 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 75d4142ca155..9e072d6549ed 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -7376,7 +7376,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A mSizeCompatBounds = null; mCompatDisplayInsets = null; - onRequestedOverrideConfigurationChanged(getRequestedOverrideConfiguration()); + // Clear config override in #updateCompatDisplayInsets(). + onRequestedOverrideConfigurationChanged(EMPTY); } @Override 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 9639aa78fd5b..dc378dc8cab2 100644 --- a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java @@ -76,6 +76,7 @@ import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo.ScreenOrientation; import android.content.res.Configuration; import android.graphics.Rect; +import android.os.UserHandle; import android.platform.test.annotations.Presubmit; import android.provider.DeviceConfig; import android.provider.DeviceConfig.Properties; @@ -2181,6 +2182,29 @@ public class SizeCompatTests extends WindowTestsBase { .computeAspectRatio(sizeCompatAppBounds), delta); } + @Test + public void testClearSizeCompat_resetOverrideConfig() { + final int origDensity = 480; + final int newDensity = 520; + final DisplayContent display = new TestDisplayContent.Builder(mAtm, 600, 800) + .setDensityDpi(origDensity) + .build(); + setUpApp(display); + prepareUnresizable(mActivity, -1.f /* maxAspect */, SCREEN_ORIENTATION_PORTRAIT); + + // Activity should enter size compat with old density after display density change. + display.setForcedDensity(newDensity, UserHandle.USER_CURRENT); + + assertScaled(); + assertEquals(origDensity, mActivity.getConfiguration().densityDpi); + + // Activity should exit size compat with new density. + mActivity.clearSizeCompatMode(); + + assertFitted(); + assertEquals(newDensity, mActivity.getConfiguration().densityDpi); + } + private void assertHorizontalPositionForDifferentDisplayConfigsForLandscapeActivity( float letterboxHorizontalPositionMultiplier) { // Set up a display in landscape and ignoring orientation request. |