Loading packages/SystemUI/src/com/android/systemui/SizeCompatModeActivityController.java +3 −0 Original line number Diff line number Diff line Loading @@ -229,6 +229,9 @@ public class SizeCompatModeActivityController extends SystemUI implements Comman } void remove() { if (mShowingHint != null) { mShowingHint.dismiss(); } getContext().getSystemService(WindowManager.class).removeViewImmediate(this); } Loading services/core/java/com/android/server/wm/ActivityRecord.java +203 −148 File changed.Preview size limit exceeded, changes collapsed. Show changes services/core/java/com/android/server/wm/DisplayContent.java +5 −0 Original line number Diff line number Diff line Loading @@ -1657,6 +1657,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo mIgnoreRotationForApps = isNonDecorDisplayCloseToSquare(Surface.ROTATION_0, width, height); } /** @return {@code true} if the orientation requested from application will be ignored. */ boolean ignoreRotationForApps() { return mIgnoreRotationForApps; } private boolean isNonDecorDisplayCloseToSquare(int rotation, int width, int height) { final DisplayCutout displayCutout = calculateDisplayCutoutForRotation(rotation).getDisplayCutout(); Loading services/core/java/com/android/server/wm/Task.java +1 −1 Original line number Diff line number Diff line Loading @@ -2195,7 +2195,7 @@ class Task extends WindowContainer<WindowContainer> { if (rotation != ROTATION_UNDEFINED && compatInsets != null) { mTmpNonDecorBounds.set(mTmpFullBounds); mTmpStableBounds.set(mTmpFullBounds); compatInsets.getDisplayBoundsByRotation(mTmpBounds, rotation); compatInsets.getBoundsByRotation(mTmpBounds, rotation); intersectWithInsetsIfFits(mTmpNonDecorBounds, mTmpBounds, compatInsets.mNonDecorInsets[rotation]); intersectWithInsetsIfFits(mTmpStableBounds, mTmpBounds, Loading services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java +0 −45 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM; import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_BEFORE_ANIM; Loading Loading @@ -208,50 +207,6 @@ public class AppWindowTokenTests extends WindowTestsBase { mWm.updateRotation(false, false); } @Test @FlakyTest(bugId = 149760957) public void testSizeCompatBounds() { // Disable the real configuration resolving because we only simulate partial flow. // TODO: Have test use full flow. doNothing().when(mTask).computeConfigResourceOverrides(any(), any()); final Rect fixedBounds = mActivity.getRequestedOverrideConfiguration().windowConfiguration .getBounds(); fixedBounds.set(0, 0, 1200, 1600); mActivity.getRequestedOverrideConfiguration().windowConfiguration.setAppBounds(fixedBounds); final Configuration newParentConfig = mTask.getConfiguration(); // Change the size of the container to two times smaller with insets. newParentConfig.windowConfiguration.setAppBounds(200, 0, 800, 800); final Rect containerAppBounds = newParentConfig.windowConfiguration.getAppBounds(); final Rect containerBounds = newParentConfig.windowConfiguration.getBounds(); containerBounds.set(0, 0, 600, 800); mActivity.onConfigurationChanged(newParentConfig); assertTrue(mActivity.hasSizeCompatBounds()); assertEquals(containerAppBounds, mActivity.getBounds()); assertEquals((float) containerAppBounds.width() / fixedBounds.width(), mActivity.getSizeCompatScale(), 0.0001f /* delta */); // Change the width of the container to two times bigger. containerAppBounds.set(0, 0, 2400, 1600); containerBounds.set(containerAppBounds); mActivity.onConfigurationChanged(newParentConfig); assertTrue(mActivity.hasSizeCompatBounds()); // Don't scale up, so the bounds keep the same as the fixed width. assertEquals(fixedBounds.width(), mActivity.getBounds().width()); // Assert the position is horizontal center. assertEquals((containerAppBounds.width() - fixedBounds.width()) / 2, mActivity.getBounds().left); assertEquals(1f, mActivity.getSizeCompatScale(), 0.0001f /* delta */); // Change the width of the container to fit the fixed bounds. containerBounds.set(0, 0, 1200, 2000); mActivity.onConfigurationChanged(newParentConfig); // Assert don't use fixed bounds because the region is enough. assertFalse(mActivity.hasSizeCompatBounds()); } @Test @Presubmit public void testGetOrientation() { Loading Loading
packages/SystemUI/src/com/android/systemui/SizeCompatModeActivityController.java +3 −0 Original line number Diff line number Diff line Loading @@ -229,6 +229,9 @@ public class SizeCompatModeActivityController extends SystemUI implements Comman } void remove() { if (mShowingHint != null) { mShowingHint.dismiss(); } getContext().getSystemService(WindowManager.class).removeViewImmediate(this); } Loading
services/core/java/com/android/server/wm/ActivityRecord.java +203 −148 File changed.Preview size limit exceeded, changes collapsed. Show changes
services/core/java/com/android/server/wm/DisplayContent.java +5 −0 Original line number Diff line number Diff line Loading @@ -1657,6 +1657,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo mIgnoreRotationForApps = isNonDecorDisplayCloseToSquare(Surface.ROTATION_0, width, height); } /** @return {@code true} if the orientation requested from application will be ignored. */ boolean ignoreRotationForApps() { return mIgnoreRotationForApps; } private boolean isNonDecorDisplayCloseToSquare(int rotation, int width, int height) { final DisplayCutout displayCutout = calculateDisplayCutoutForRotation(rotation).getDisplayCutout(); Loading
services/core/java/com/android/server/wm/Task.java +1 −1 Original line number Diff line number Diff line Loading @@ -2195,7 +2195,7 @@ class Task extends WindowContainer<WindowContainer> { if (rotation != ROTATION_UNDEFINED && compatInsets != null) { mTmpNonDecorBounds.set(mTmpFullBounds); mTmpStableBounds.set(mTmpFullBounds); compatInsets.getDisplayBoundsByRotation(mTmpBounds, rotation); compatInsets.getBoundsByRotation(mTmpBounds, rotation); intersectWithInsetsIfFits(mTmpNonDecorBounds, mTmpBounds, compatInsets.mNonDecorInsets[rotation]); intersectWithInsetsIfFits(mTmpStableBounds, mTmpBounds, Loading
services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java +0 −45 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing; import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn; import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM; import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_BEFORE_ANIM; Loading Loading @@ -208,50 +207,6 @@ public class AppWindowTokenTests extends WindowTestsBase { mWm.updateRotation(false, false); } @Test @FlakyTest(bugId = 149760957) public void testSizeCompatBounds() { // Disable the real configuration resolving because we only simulate partial flow. // TODO: Have test use full flow. doNothing().when(mTask).computeConfigResourceOverrides(any(), any()); final Rect fixedBounds = mActivity.getRequestedOverrideConfiguration().windowConfiguration .getBounds(); fixedBounds.set(0, 0, 1200, 1600); mActivity.getRequestedOverrideConfiguration().windowConfiguration.setAppBounds(fixedBounds); final Configuration newParentConfig = mTask.getConfiguration(); // Change the size of the container to two times smaller with insets. newParentConfig.windowConfiguration.setAppBounds(200, 0, 800, 800); final Rect containerAppBounds = newParentConfig.windowConfiguration.getAppBounds(); final Rect containerBounds = newParentConfig.windowConfiguration.getBounds(); containerBounds.set(0, 0, 600, 800); mActivity.onConfigurationChanged(newParentConfig); assertTrue(mActivity.hasSizeCompatBounds()); assertEquals(containerAppBounds, mActivity.getBounds()); assertEquals((float) containerAppBounds.width() / fixedBounds.width(), mActivity.getSizeCompatScale(), 0.0001f /* delta */); // Change the width of the container to two times bigger. containerAppBounds.set(0, 0, 2400, 1600); containerBounds.set(containerAppBounds); mActivity.onConfigurationChanged(newParentConfig); assertTrue(mActivity.hasSizeCompatBounds()); // Don't scale up, so the bounds keep the same as the fixed width. assertEquals(fixedBounds.width(), mActivity.getBounds().width()); // Assert the position is horizontal center. assertEquals((containerAppBounds.width() - fixedBounds.width()) / 2, mActivity.getBounds().left); assertEquals(1f, mActivity.getSizeCompatScale(), 0.0001f /* delta */); // Change the width of the container to fit the fixed bounds. containerBounds.set(0, 0, 1200, 2000); mActivity.onConfigurationChanged(newParentConfig); // Assert don't use fixed bounds because the region is enough. assertFalse(mActivity.hasSizeCompatBounds()); } @Test @Presubmit public void testGetOrientation() { Loading