Loading services/core/java/com/android/server/wm/ActivityRecord.java +8 −0 Original line number Diff line number Diff line Loading @@ -6363,6 +6363,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * aspect ratio. */ boolean shouldUseSizeCompatMode() { if (inMultiWindowMode() || getWindowConfiguration().hasWindowDecorCaption()) { final ActivityRecord root = task != null ? task.getRootActivity() : null; if (root != null && root != this && !root.shouldUseSizeCompatMode()) { // If the root activity doesn't use size compatibility mode, the activities above // are forced to be the same for consistent visual appearance. return false; } } return !isResizeable() && (info.isFixedOrientation() || info.hasFixedAspectRatio()) // The configuration of non-standard type should be enforced by system. && isActivityTypeStandard() Loading services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +27 −0 Original line number Diff line number Diff line Loading @@ -391,6 +391,33 @@ public class SizeCompatTests extends ActivityTestsBase { assertEquals(null, compatTokens.get(0)); } @Test public void testShouldUseSizeCompatModeOnResizableTask() { setUpApp(new TestDisplayContent.Builder(mService, 1000, 2500).build()); // Make the task root resizable. mActivity.info.resizeMode = ActivityInfo.RESIZE_MODE_RESIZEABLE; // Create a size compat activity on the same task. final ActivityRecord activity = new ActivityBuilder(mService) .setTask(mTask) .setResizeMode(ActivityInfo.RESIZE_MODE_UNRESIZEABLE) .setScreenOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) .build(); assertTrue(activity.shouldUseSizeCompatMode()); // The non-resizable activity should not be size compat because it is on a resizable task // in multi-window mode. mStack.setWindowingMode(WindowConfiguration.WINDOWING_MODE_FREEFORM); assertFalse(activity.shouldUseSizeCompatMode()); // The non-resizable activity should not be size compat because the display support // changing windowing mode from fullscreen to freeform. mStack.mDisplayContent.setDisplayWindowingMode(WindowConfiguration.WINDOWING_MODE_FREEFORM); mStack.setWindowingMode(WindowConfiguration.WINDOWING_MODE_FULLSCREEN); assertFalse(activity.shouldUseSizeCompatMode()); } /** * Setup {@link #mActivity} as a size-compat-mode-able activity with fixed aspect and/or * orientation. Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +8 −0 Original line number Diff line number Diff line Loading @@ -6363,6 +6363,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * aspect ratio. */ boolean shouldUseSizeCompatMode() { if (inMultiWindowMode() || getWindowConfiguration().hasWindowDecorCaption()) { final ActivityRecord root = task != null ? task.getRootActivity() : null; if (root != null && root != this && !root.shouldUseSizeCompatMode()) { // If the root activity doesn't use size compatibility mode, the activities above // are forced to be the same for consistent visual appearance. return false; } } return !isResizeable() && (info.isFixedOrientation() || info.hasFixedAspectRatio()) // The configuration of non-standard type should be enforced by system. && isActivityTypeStandard() Loading
services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +27 −0 Original line number Diff line number Diff line Loading @@ -391,6 +391,33 @@ public class SizeCompatTests extends ActivityTestsBase { assertEquals(null, compatTokens.get(0)); } @Test public void testShouldUseSizeCompatModeOnResizableTask() { setUpApp(new TestDisplayContent.Builder(mService, 1000, 2500).build()); // Make the task root resizable. mActivity.info.resizeMode = ActivityInfo.RESIZE_MODE_RESIZEABLE; // Create a size compat activity on the same task. final ActivityRecord activity = new ActivityBuilder(mService) .setTask(mTask) .setResizeMode(ActivityInfo.RESIZE_MODE_UNRESIZEABLE) .setScreenOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) .build(); assertTrue(activity.shouldUseSizeCompatMode()); // The non-resizable activity should not be size compat because it is on a resizable task // in multi-window mode. mStack.setWindowingMode(WindowConfiguration.WINDOWING_MODE_FREEFORM); assertFalse(activity.shouldUseSizeCompatMode()); // The non-resizable activity should not be size compat because the display support // changing windowing mode from fullscreen to freeform. mStack.mDisplayContent.setDisplayWindowingMode(WindowConfiguration.WINDOWING_MODE_FREEFORM); mStack.setWindowingMode(WindowConfiguration.WINDOWING_MODE_FULLSCREEN); assertFalse(activity.shouldUseSizeCompatMode()); } /** * Setup {@link #mActivity} as a size-compat-mode-able activity with fixed aspect and/or * orientation. Loading