Loading services/core/java/com/android/server/wm/TaskFragment.java +4 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static android.app.WindowConfiguration.isFloating; import static android.content.pm.ActivityInfo.FLAG_ALLOW_UNTRUSTED_ACTIVITY_EMBEDDING; import static android.content.pm.ActivityInfo.FLAG_RESUME_WHILE_PAUSING; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; Loading Loading @@ -2248,8 +2249,10 @@ class TaskFragment extends WindowContainer<WindowContainer> { void resolveTmpOverrides(DisplayContent dc, Configuration parentConfig, boolean isFixedRotationTransforming) { mParentAppBoundsOverride = new Rect(parentConfig.windowConfiguration.getAppBounds()); mTmpOverrideConfigOrientation = parentConfig.orientation; final Insets insets; if (mUseOverrideInsetsForConfig && dc != null) { if (mUseOverrideInsetsForConfig && dc != null && !isFloating(parentConfig.windowConfiguration.getWindowingMode())) { // Insets are decoupled from configuration by default from V+, use legacy // compatibility behaviour for apps targeting SDK earlier than 35 // (see applySizeOverrideIfNeeded). Loading services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +21 −0 Original line number Diff line number Diff line Loading @@ -4271,6 +4271,27 @@ public class SizeCompatTests extends WindowTestsBase { } @Test public void testInsetOverrideNotAppliedInFreeform() { final int notchHeight = 100; final DisplayContent display = new TestDisplayContent.Builder(mAtm, 1000, 2800) .setNotch(notchHeight) .build(); setUpApp(display); // Simulate inset override for legacy app bound behaviour mActivity.mResolveConfigHint.mUseOverrideInsetsForConfig = true; // Set task as freeform mTask.setWindowingMode(WindowConfiguration.WINDOWING_MODE_FREEFORM); prepareUnresizable(mActivity, SCREEN_ORIENTATION_PORTRAIT); Rect bounds = new Rect(mActivity.getWindowConfiguration().getBounds()); Rect appBounds = new Rect(mActivity.getWindowConfiguration().getAppBounds()); // App bounds should not include insets and should match bounds when in freeform. assertEquals(new Rect(0, 0, 1000, 2800), appBounds); assertEquals(new Rect(0, 0, 1000, 2800), bounds); } private void assertVerticalPositionForDifferentDisplayConfigsForLandscapeActivity( float letterboxVerticalPositionMultiplier, Rect fixedOrientationLetterbox, Rect sizeCompatUnscaled, Rect sizeCompatScaled) { Loading Loading
services/core/java/com/android/server/wm/TaskFragment.java +4 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static android.app.WindowConfiguration.isFloating; import static android.content.pm.ActivityInfo.FLAG_ALLOW_UNTRUSTED_ACTIVITY_EMBEDDING; import static android.content.pm.ActivityInfo.FLAG_RESUME_WHILE_PAUSING; import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET; Loading Loading @@ -2248,8 +2249,10 @@ class TaskFragment extends WindowContainer<WindowContainer> { void resolveTmpOverrides(DisplayContent dc, Configuration parentConfig, boolean isFixedRotationTransforming) { mParentAppBoundsOverride = new Rect(parentConfig.windowConfiguration.getAppBounds()); mTmpOverrideConfigOrientation = parentConfig.orientation; final Insets insets; if (mUseOverrideInsetsForConfig && dc != null) { if (mUseOverrideInsetsForConfig && dc != null && !isFloating(parentConfig.windowConfiguration.getWindowingMode())) { // Insets are decoupled from configuration by default from V+, use legacy // compatibility behaviour for apps targeting SDK earlier than 35 // (see applySizeOverrideIfNeeded). Loading
services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +21 −0 Original line number Diff line number Diff line Loading @@ -4271,6 +4271,27 @@ public class SizeCompatTests extends WindowTestsBase { } @Test public void testInsetOverrideNotAppliedInFreeform() { final int notchHeight = 100; final DisplayContent display = new TestDisplayContent.Builder(mAtm, 1000, 2800) .setNotch(notchHeight) .build(); setUpApp(display); // Simulate inset override for legacy app bound behaviour mActivity.mResolveConfigHint.mUseOverrideInsetsForConfig = true; // Set task as freeform mTask.setWindowingMode(WindowConfiguration.WINDOWING_MODE_FREEFORM); prepareUnresizable(mActivity, SCREEN_ORIENTATION_PORTRAIT); Rect bounds = new Rect(mActivity.getWindowConfiguration().getBounds()); Rect appBounds = new Rect(mActivity.getWindowConfiguration().getAppBounds()); // App bounds should not include insets and should match bounds when in freeform. assertEquals(new Rect(0, 0, 1000, 2800), appBounds); assertEquals(new Rect(0, 0, 1000, 2800), bounds); } private void assertVerticalPositionForDifferentDisplayConfigsForLandscapeActivity( float letterboxVerticalPositionMultiplier, Rect fixedOrientationLetterbox, Rect sizeCompatUnscaled, Rect sizeCompatScaled) { Loading