Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40fc7aa1 authored by Massimo Carli's avatar Massimo Carli
Browse files

[53/n] Simplify LetterboxPolicy naming

Flag: EXEMPT Refactoring
Bug: 360865550
Test: atest WmTests:SizeCompatTests
Test: atest WmTests:AppCompatLetterboxUtilsTest
Test: atest WmTests:AppCompatLetterboxPolicyTest

Change-Id: If122bb2ee66ea4e9de44a046173a765972e796a0
parent fe3c1c44
Loading
Loading
Loading
Loading
+12 −16
Original line number Diff line number Diff line
@@ -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
+5 −5
Original line number Diff line number Diff line
@@ -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);
    }

+3 −3
Original line number Diff line number Diff line
@@ -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;
        }
+1 −1
Original line number Diff line number Diff line
@@ -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()
+1 −1
Original line number Diff line number Diff line
@@ -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);
                }
Loading