diff options
9 files changed, 42 insertions, 46 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 82e1329d7dd7..1d12c561f118 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -1811,12 +1811,11 @@ final class ActivityRecord extends WindowToken { } } - mAppCompatController.getAppCompatLetterboxPolicy() - .onMovedToDisplay(mDisplayContent.getDisplayId()); + mAppCompatController.getLetterboxPolicy().onMovedToDisplay(mDisplayContent.getDisplayId()); } void layoutLetterboxIfNeeded(WindowState winHint) { - mAppCompatController.getAppCompatLetterboxPolicy().start(winHint); + mAppCompatController.getLetterboxPolicy().start(winHint); } boolean hasWallpaperBackgroundForLetterbox() { @@ -1824,22 +1823,22 @@ final class ActivityRecord extends WindowToken { } void updateLetterboxSurfaceIfNeeded(WindowState winHint, Transaction t) { - mAppCompatController.getAppCompatLetterboxPolicy() + mAppCompatController.getLetterboxPolicy() .updateLetterboxSurfaceIfNeeded(winHint, t, getPendingTransaction()); } void updateLetterboxSurfaceIfNeeded(WindowState winHint) { - mAppCompatController.getAppCompatLetterboxPolicy().updateLetterboxSurfaceIfNeeded(winHint); + mAppCompatController.getLetterboxPolicy().updateLetterboxSurfaceIfNeeded(winHint); } /** Gets the letterbox insets. The insets will be empty if there is no letterbox. */ Rect getLetterboxInsets() { - return mAppCompatController.getAppCompatLetterboxPolicy().getLetterboxInsets(); + return mAppCompatController.getLetterboxPolicy().getLetterboxInsets(); } /** Gets the inner bounds of letterbox. The bounds will be empty if there is no letterbox. */ void getLetterboxInnerBounds(Rect outBounds) { - mAppCompatController.getAppCompatLetterboxPolicy().getLetterboxInnerBounds(outBounds); + mAppCompatController.getLetterboxPolicy().getLetterboxInnerBounds(outBounds); } /** @@ -1847,8 +1846,7 @@ final class ActivityRecord extends WindowToken { * when the current activity is displayed. */ boolean isFullyTransparentBarAllowed(Rect rect) { - return mAppCompatController.getAppCompatLetterboxPolicy() - .isFullyTransparentBarAllowed(rect); + return mAppCompatController.getLetterboxPolicy().isFullyTransparentBarAllowed(rect); } private static class Token extends Binder { @@ -2820,8 +2818,7 @@ final class ActivityRecord extends WindowToken { } void removeStartingWindow() { - final AppCompatLetterboxPolicy letterboxPolicy = mAppCompatController - .getAppCompatLetterboxPolicy(); + final AppCompatLetterboxPolicy letterboxPolicy = mAppCompatController.getLetterboxPolicy(); boolean prevEligibleForLetterboxEducation = letterboxPolicy.isEligibleForLetterboxEducation(); @@ -4448,7 +4445,7 @@ final class ActivityRecord extends WindowToken { mTaskSupervisor.getActivityMetricsLogger().notifyActivityRemoved(this); mTaskSupervisor.mStoppingActivities.remove(this); - mAppCompatController.getAppCompatLetterboxPolicy().stop(); + mAppCompatController.getLetterboxPolicy().stop(); mAppCompatController.getTransparentPolicy().stop(); // Defer removal of this activity when either a child is animating, or app transition is on @@ -7710,7 +7707,7 @@ final class ActivityRecord extends WindowToken { t.setLayer(mAnimationBoundsLayer, getLastLayer()); if (mNeedsLetterboxedAnimation) { - final int cornerRadius = mAppCompatController.getAppCompatLetterboxPolicy() + final int cornerRadius = mAppCompatController.getLetterboxPolicy() .getRoundedCornersRadius(findMainWindow()); final Rect letterboxInnerBounds = new Rect(); @@ -8296,8 +8293,7 @@ final class ActivityRecord extends WindowToken { final AppCompatAspectRatioPolicy aspectRatioPolicy = mAppCompatController.getAspectRatioPolicy(); aspectRatioPolicy.reset(); - mAppCompatController.getAppCompatLetterboxPolicy() - .resetFixedOrientationLetterboxEligibility(); + mAppCompatController.getLetterboxPolicy().resetFixedOrientationLetterboxEligibility(); mResolveConfigHint.resolveTmpOverrides(mDisplayContent, newParentConfiguration, isFixedRotationTransforming()); @@ -8738,7 +8734,7 @@ final class ActivityRecord extends WindowToken { // make it fit the available bounds by scaling down its bounds. final int forcedOrientation = getRequestedConfigurationOrientation(); final boolean isEligibleForFixedOrientationLetterbox = mAppCompatController - .getAppCompatLetterboxPolicy() + .getLetterboxPolicy() .resolveFixedOrientationLetterboxEligibility(forcedOrientation, parentOrientation); if (!isEligibleForFixedOrientationLetterbox && (forcedOrientation == ORIENTATION_UNDEFINED diff --git a/services/core/java/com/android/server/wm/AppCompatController.java b/services/core/java/com/android/server/wm/AppCompatController.java index 350112d27041..bed95face1c9 100644 --- a/services/core/java/com/android/server/wm/AppCompatController.java +++ b/services/core/java/com/android/server/wm/AppCompatController.java @@ -41,7 +41,7 @@ class AppCompatController { @NonNull private final AppCompatDeviceStateQuery mDeviceStateQuery; @NonNull - private final AppCompatLetterboxPolicy mAppCompatLetterboxPolicy; + private final AppCompatLetterboxPolicy mLetterboxPolicy; @NonNull private final AppCompatSizeCompatModePolicy mSizeCompatModePolicy; @@ -60,7 +60,7 @@ class AppCompatController { mTransparentPolicy, mAppCompatOverrides); mReachabilityPolicy = new AppCompatReachabilityPolicy(activityRecord, wmService.mAppCompatConfiguration); - mAppCompatLetterboxPolicy = new AppCompatLetterboxPolicy(activityRecord, + mLetterboxPolicy = new AppCompatLetterboxPolicy(activityRecord, wmService.mAppCompatConfiguration); mDesktopAspectRatioPolicy = new DesktopAppCompatAspectRatioPolicy(activityRecord, mAppCompatOverrides, mTransparentPolicy, wmService.mAppCompatConfiguration); @@ -114,8 +114,8 @@ class AppCompatController { } @NonNull - AppCompatLetterboxPolicy getAppCompatLetterboxPolicy() { - return mAppCompatLetterboxPolicy; + AppCompatLetterboxPolicy getLetterboxPolicy() { + return mLetterboxPolicy; } @NonNull @@ -145,7 +145,7 @@ class AppCompatController { void dump(@NonNull PrintWriter pw, @NonNull String prefix) { getTransparentPolicy().dump(pw, prefix); - getAppCompatLetterboxPolicy().dump(pw, prefix); + getLetterboxPolicy().dump(pw, prefix); getSizeCompatModePolicy().dump(pw, prefix); } diff --git a/services/core/java/com/android/server/wm/AppCompatLetterboxUtils.java b/services/core/java/com/android/server/wm/AppCompatLetterboxUtils.java index 79b3a55d0463..83d7cb7bb960 100644 --- a/services/core/java/com/android/server/wm/AppCompatLetterboxUtils.java +++ b/services/core/java/com/android/server/wm/AppCompatLetterboxUtils.java @@ -32,7 +32,7 @@ class AppCompatLetterboxUtils { */ static void calculateLetterboxPosition(@NonNull ActivityRecord activity, @NonNull Point outLetterboxPosition) { - if (!activity.mAppCompatController.getAppCompatLetterboxPolicy().isRunning()) { + if (!activity.mAppCompatController.getLetterboxPolicy().isRunning()) { outLetterboxPosition.set(0, 0); return; } @@ -54,7 +54,7 @@ class AppCompatLetterboxUtils { */ static void calculateLetterboxOuterBounds(@NonNull ActivityRecord activity, @NonNull Rect outOuterBounds) { - if (!activity.mAppCompatController.getAppCompatLetterboxPolicy().isRunning()) { + if (!activity.mAppCompatController.getLetterboxPolicy().isRunning()) { outOuterBounds.setEmpty(); return; } @@ -82,7 +82,7 @@ class AppCompatLetterboxUtils { */ static void calculateLetterboxInnerBounds(@NonNull ActivityRecord activity, @NonNull WindowState window, @NonNull Rect outInnerBounds) { - if (!activity.mAppCompatController.getAppCompatLetterboxPolicy().isRunning()) { + if (!activity.mAppCompatController.getLetterboxPolicy().isRunning()) { outInnerBounds.setEmpty(); return; } diff --git a/services/core/java/com/android/server/wm/AppCompatUtils.java b/services/core/java/com/android/server/wm/AppCompatUtils.java index 6f242310b8f5..3e054fc40540 100644 --- a/services/core/java/com/android/server/wm/AppCompatUtils.java +++ b/services/core/java/com/android/server/wm/AppCompatUtils.java @@ -151,7 +151,7 @@ final class AppCompatUtils { } // Whether the direct top activity is eligible for letterbox education. appCompatTaskInfo.setEligibleForLetterboxEducation(isTopActivityResumed - && top.mAppCompatController.getAppCompatLetterboxPolicy() + && top.mAppCompatController.getLetterboxPolicy() .isEligibleForLetterboxEducation()); appCompatTaskInfo.setLetterboxEducationEnabled( top.mAppCompatController.getLetterboxOverrides() diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 999666e22985..319b48a89316 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -1580,7 +1580,7 @@ public class DisplayPolicy { final ActivityRecord currentActivity = win.getActivityRecord(); if (currentActivity != null) { final LetterboxDetails currentLetterboxDetails = currentActivity - .mAppCompatController.getAppCompatLetterboxPolicy().getLetterboxDetails(); + .mAppCompatController.getLetterboxPolicy().getLetterboxDetails(); if (currentLetterboxDetails != null) { mLetterboxDetails.add(currentLetterboxDetails); } diff --git a/services/core/java/com/android/server/wm/TaskOrganizerController.java b/services/core/java/com/android/server/wm/TaskOrganizerController.java index eefc54457a4d..acb0cd718fb8 100644 --- a/services/core/java/com/android/server/wm/TaskOrganizerController.java +++ b/services/core/java/com/android/server/wm/TaskOrganizerController.java @@ -684,7 +684,7 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub { removalInfo.playRevealAnimation = false; } else if (removalInfo.playRevealAnimation && playShiftUpAnimation) { removalInfo.roundedCornerRadius = - topActivity.mAppCompatController.getAppCompatLetterboxPolicy() + topActivity.mAppCompatController.getLetterboxPolicy() .getRoundedCornersRadius(mainWindow); removalInfo.windowAnimationLeash = applyStartingWindowAnimation(mainWindow); removalInfo.mainFrame = new Rect(mainWindow.getFrame()); diff --git a/services/tests/wmtests/src/com/android/server/wm/AppCompatLetterboxPolicyTest.java b/services/tests/wmtests/src/com/android/server/wm/AppCompatLetterboxPolicyTest.java index b5ba111e4e72..0c310324ce67 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppCompatLetterboxPolicyTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppCompatLetterboxPolicyTest.java @@ -374,7 +374,7 @@ public class AppCompatLetterboxPolicyTest extends WindowTestsBase { @NonNull private AppCompatLetterboxPolicy getAppCompatLetterboxPolicy() { - return activity().top().mAppCompatController.getAppCompatLetterboxPolicy(); + return activity().top().mAppCompatController.getLetterboxPolicy(); } } diff --git a/services/tests/wmtests/src/com/android/server/wm/AppCompatLetterboxUtilsTest.java b/services/tests/wmtests/src/com/android/server/wm/AppCompatLetterboxUtilsTest.java index 673d04166a7a..a4a63d266725 100644 --- a/services/tests/wmtests/src/com/android/server/wm/AppCompatLetterboxUtilsTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/AppCompatLetterboxUtilsTest.java @@ -185,13 +185,13 @@ public class AppCompatLetterboxUtilsTest extends WindowTestsBase { @Override void onPostActivityCreation(@NonNull ActivityRecord activity) { super.onPostActivityCreation(activity); - spyOn(activity.mAppCompatController.getAppCompatLetterboxPolicy()); + spyOn(activity.mAppCompatController.getLetterboxPolicy()); spyOn(activity.mAppCompatController.getTransparentPolicy()); } void setTopActivityLetterboxPolicyRunning(boolean running) { doReturn(running).when(activity().top().mAppCompatController - .getAppCompatLetterboxPolicy()).isRunning(); + .getLetterboxPolicy()).isRunning(); } void setTopActivityTransparentPolicyRunning(boolean running) { 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 e19c13a81b1c..5ac3e483231c 100644 --- a/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java @@ -311,9 +311,9 @@ public class SizeCompatTests extends WindowTestsBase { .build(); mTask.addChild(translucentActivity); - spyOn(translucentActivity.mAppCompatController.getAppCompatLetterboxPolicy()); + spyOn(translucentActivity.mAppCompatController.getLetterboxPolicy()); doReturn(true).when(translucentActivity.mAppCompatController - .getAppCompatLetterboxPolicy()).shouldShowLetterboxUi(any()); + .getLetterboxPolicy()).shouldShowLetterboxUi(any()); addWindowToActivity(translucentActivity); translucentActivity.mRootWindowContainer.performSurfacePlacement(); @@ -695,12 +695,12 @@ public class SizeCompatTests extends WindowTestsBase { doReturn(true).when(mActivity).isVisibleRequested(); - assertTrue(mActivity.mAppCompatController.getAppCompatLetterboxPolicy() + assertTrue(mActivity.mAppCompatController.getLetterboxPolicy() .shouldShowLetterboxUi(mActivity.findMainWindow())); window.mAttrs.flags |= FLAG_SHOW_WALLPAPER; - assertFalse(mActivity.mAppCompatController.getAppCompatLetterboxPolicy() + assertFalse(mActivity.mAppCompatController.getLetterboxPolicy() .shouldShowLetterboxUi(mActivity.findMainWindow())); } @@ -1788,7 +1788,7 @@ public class SizeCompatTests extends WindowTestsBase { mActivity.mRootWindowContainer.performSurfacePlacement(); LetterboxDetails letterboxDetails = mActivity.mAppCompatController - .getAppCompatLetterboxPolicy().getLetterboxDetails(); + .getLetterboxPolicy().getLetterboxDetails(); assertEquals(dh / scale, letterboxDetails.getLetterboxInnerBounds().width()); assertEquals(dw / scale, letterboxDetails.getLetterboxInnerBounds().height()); @@ -3827,7 +3827,7 @@ public class SizeCompatTests extends WindowTestsBase { mActivity.mRootWindowContainer.performSurfacePlacement(); LetterboxDetails letterboxDetails = mActivity.mAppCompatController - .getAppCompatLetterboxPolicy().getLetterboxDetails(); + .getLetterboxPolicy().getLetterboxDetails(); // Letterboxed activity at bottom assertEquals(new Rect(0, 2100, 1400, 2800), mActivity.getBounds()); @@ -4683,7 +4683,7 @@ public class SizeCompatTests extends WindowTestsBase { prepareUnresizable(mActivity, SCREEN_ORIENTATION_PORTRAIT); - assertFalse(mActivity.mAppCompatController.getAppCompatLetterboxPolicy() + assertFalse(mActivity.mAppCompatController.getLetterboxPolicy() .isEligibleForLetterboxEducation()); } @@ -4695,7 +4695,7 @@ public class SizeCompatTests extends WindowTestsBase { prepareUnresizable(mActivity, SCREEN_ORIENTATION_PORTRAIT); - assertFalse(mActivity.mAppCompatController.getAppCompatLetterboxPolicy() + assertFalse(mActivity.mAppCompatController.getLetterboxPolicy() .isEligibleForLetterboxEducation()); } @@ -4718,7 +4718,7 @@ public class SizeCompatTests extends WindowTestsBase { false /*moveParents*/, "test"); organizer.mPrimary.setBounds(0, 0, 1000, 600); - assertFalse(mActivity.mAppCompatController.getAppCompatLetterboxPolicy() + assertFalse(mActivity.mAppCompatController.getLetterboxPolicy() .isEligibleForLetterboxEducation()); assertEquals(WINDOWING_MODE_MULTI_WINDOW, mActivity.getWindowingMode()); } @@ -4731,7 +4731,7 @@ public class SizeCompatTests extends WindowTestsBase { prepareUnresizable(mActivity, SCREEN_ORIENTATION_LANDSCAPE); - assertFalse(mActivity.mAppCompatController.getAppCompatLetterboxPolicy() + assertFalse(mActivity.mAppCompatController.getLetterboxPolicy() .isEligibleForLetterboxEducation()); assertTrue(mActivity.mAppCompatController.getAspectRatioPolicy() .isLetterboxedForFixedOrientationAndAspectRatio()); @@ -4749,7 +4749,7 @@ public class SizeCompatTests extends WindowTestsBase { createWindowState(new WindowManager.LayoutParams(TYPE_APPLICATION_STARTING), mActivity)); - assertFalse(mActivity.mAppCompatController.getAppCompatLetterboxPolicy() + assertFalse(mActivity.mAppCompatController.getLetterboxPolicy() .isEligibleForLetterboxEducation()); // Verify that after removing the starting window isEligibleForLetterboxEducation returns @@ -4757,7 +4757,7 @@ public class SizeCompatTests extends WindowTestsBase { spyOn(mTask); mActivity.removeStartingWindow(); - assertTrue(mActivity.mAppCompatController.getAppCompatLetterboxPolicy() + assertTrue(mActivity.mAppCompatController.getLetterboxPolicy() .isEligibleForLetterboxEducation()); verify(mTask).dispatchTaskInfoChangedIfNeeded(true); } @@ -4774,7 +4774,7 @@ public class SizeCompatTests extends WindowTestsBase { createWindowState(new WindowManager.LayoutParams(TYPE_APPLICATION_STARTING), mActivity)); - assertFalse(mActivity.mAppCompatController.getAppCompatLetterboxPolicy() + assertFalse(mActivity.mAppCompatController.getLetterboxPolicy() .isEligibleForLetterboxEducation()); // Verify that after removing the starting window isEligibleForLetterboxEducation still @@ -4782,7 +4782,7 @@ public class SizeCompatTests extends WindowTestsBase { spyOn(mTask); mActivity.removeStartingWindow(); - assertFalse(mActivity.mAppCompatController.getAppCompatLetterboxPolicy() + assertFalse(mActivity.mAppCompatController.getLetterboxPolicy() .isEligibleForLetterboxEducation()); verify(mTask, never()).dispatchTaskInfoChangedIfNeeded(true); } @@ -4795,7 +4795,7 @@ public class SizeCompatTests extends WindowTestsBase { prepareUnresizable(mActivity, SCREEN_ORIENTATION_PORTRAIT); - assertTrue(mActivity.mAppCompatController.getAppCompatLetterboxPolicy() + assertTrue(mActivity.mAppCompatController.getLetterboxPolicy() .isEligibleForLetterboxEducation()); assertTrue(mActivity.mAppCompatController.getAspectRatioPolicy() .isLetterboxedForFixedOrientationAndAspectRatio()); @@ -4811,7 +4811,7 @@ public class SizeCompatTests extends WindowTestsBase { rotateDisplay(mActivity.mDisplayContent, ROTATION_90); - assertTrue(mActivity.mAppCompatController.getAppCompatLetterboxPolicy() + assertTrue(mActivity.mAppCompatController.getLetterboxPolicy() .isEligibleForLetterboxEducation()); assertFalse(mActivity.mAppCompatController.getAspectRatioPolicy() .isLetterboxedForFixedOrientationAndAspectRatio()); |