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

Commit 18c6a0b5 authored by Massimo Carli's avatar Massimo Carli Committed by Android (Google) Code Review
Browse files

Merge "[31/n] Reduce ActivityRecord-LetterboxUiController dependency" into main

parents 2962f79d ca4f0787
Loading
Loading
Loading
Loading
+16 −11
Original line number Diff line number Diff line
@@ -1834,33 +1834,36 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            }
        }

        mLetterboxUiController.onMovedToDisplay(mDisplayContent.getDisplayId());
        mAppCompatController.getAppCompatLetterboxPolicy()
                .onMovedToDisplay(mDisplayContent.getDisplayId());
    }

    void layoutLetterboxIfNeeded(WindowState winHint) {
        mLetterboxUiController.layoutLetterboxIfNeeded(winHint);
        mAppCompatController.getAppCompatLetterboxPolicy().start(winHint);
    }

    boolean hasWallpaperBackgroundForLetterbox() {
        return mLetterboxUiController.hasWallpaperBackgroundForLetterbox();
        return mAppCompatController.getAppCompatLetterboxOverrides()
                .hasWallpaperBackgroundForLetterbox();
    }

    void updateLetterboxSurfaceIfNeeded(WindowState winHint, Transaction t) {
        mLetterboxUiController.updateLetterboxSurfaceIfNeeded(winHint, t, getPendingTransaction());
        mAppCompatController.getAppCompatLetterboxPolicy()
                .updateLetterboxSurfaceIfNeeded(winHint, t, getPendingTransaction());
    }

    void updateLetterboxSurfaceIfNeeded(WindowState winHint) {
        mLetterboxUiController.updateLetterboxSurfaceIfNeeded(winHint);
        mAppCompatController.getAppCompatLetterboxPolicy().updateLetterboxSurfaceIfNeeded(winHint);
    }

    /** Gets the letterbox insets. The insets will be empty if there is no letterbox. */
    Rect getLetterboxInsets() {
        return mLetterboxUiController.getLetterboxInsets();
        return mAppCompatController.getAppCompatLetterboxPolicy().getLetterboxInsets();
    }

    /** Gets the inner bounds of letterbox. The bounds will be empty if there is no letterbox. */
    void getLetterboxInnerBounds(Rect outBounds) {
        mLetterboxUiController.getLetterboxInnerBounds(outBounds);
        mAppCompatController.getAppCompatLetterboxPolicy().getLetterboxInnerBounds(outBounds);
    }

    /**
@@ -1868,7 +1871,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     *     when the current activity is displayed.
     */
    boolean isFullyTransparentBarAllowed(Rect rect) {
        return mLetterboxUiController.isFullyTransparentBarAllowed(rect);
        return mAppCompatController.getAppCompatLetterboxPolicy()
                .isFullyTransparentBarAllowed(rect);
    }

    private static class Token extends Binder {
@@ -4368,7 +4372,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

        mTaskSupervisor.getActivityMetricsLogger().notifyActivityRemoved(this);
        mTaskSupervisor.mStoppingActivities.remove(this);
        mLetterboxUiController.destroy();

        mAppCompatController.getAppCompatLetterboxPolicy().stop();
        mAppCompatController.getTransparentPolicy().stop();

        // Defer removal of this activity when either a child is animating, or app transition is on
@@ -7688,7 +7693,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            t.setLayer(mAnimationBoundsLayer, getLastLayer());

            if (mNeedsLetterboxedAnimation) {
                final int cornerRadius = mLetterboxUiController
                final int cornerRadius = mAppCompatController.getAppCompatLetterboxPolicy()
                        .getRoundedCornersRadius(findMainWindow());

                final Rect letterboxInnerBounds = new Rect();
@@ -8574,7 +8579,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     * Returns whether activity bounds are letterboxed.
     *
     * <p>Note that letterbox UI may not be shown even when this returns {@code true}. See {@link
     * LetterboxUiController#shouldShowLetterboxUi} for more context.
     * AppCompatLetterboxOverrides#shouldShowLetterboxUi} for more context.
     */
    boolean areBoundsLetterboxed() {
        return getAppCompatState(/* ignoreVisibility= */ true)
+3 −3
Original line number Diff line number Diff line
@@ -55,8 +55,8 @@ class AppCompatLetterboxPolicy {
    }

    /** Cleans up {@link Letterbox} if it exists.*/
    void destroy() {
        mLetterboxPolicyState.destroy();
    void stop() {
        mLetterboxPolicyState.stop();
    }

    /** @return {@value true} if the letterbox policy is running and the activity letterboxed. */
@@ -271,7 +271,7 @@ class AppCompatLetterboxPolicy {
        }

        /** Cleans up {@link Letterbox} if it exists.*/
        void destroy() {
        void stop() {
            if (isRunning()) {
                mLetterbox.destroy();
                mLetterbox = null;
+2 −2
Original line number Diff line number Diff line
@@ -138,8 +138,8 @@ final class AppCompatUtils {
        // Whether the direct top activity is eligible for letterbox education.
        appCompatTaskInfo.setEligibleForLetterboxEducation(
                isTopActivityResumed && top.isEligibleForLetterboxEducation());
        appCompatTaskInfo.setLetterboxEducationEnabled(top.mLetterboxUiController
                .isLetterboxEducationEnabled());
        appCompatTaskInfo.setLetterboxEducationEnabled(top.mAppCompatController
                .getAppCompatLetterboxOverrides().isLetterboxEducationEnabled());

        final AppCompatAspectRatioOverrides aspectRatioOverrides =
                top.mAppCompatController.getAppCompatAspectRatioOverrides();
+3 −2
Original line number Diff line number Diff line
@@ -273,7 +273,8 @@ class BackNavigationController {
                                    customAppTransition.mBackgroundColor);
                        }
                    }
                    infoBuilder.setLetterboxColor(currentActivity.mLetterboxUiController
                    infoBuilder.setLetterboxColor(currentActivity.mAppCompatController
                            .getAppCompatLetterboxOverrides()
                                .getLetterboxBackgroundColor().toArgb());
                    removedWindowContainer = currentActivity;
                    prevTask = prevActivities.get(0).getTask();
+1 −1
Original line number Diff line number Diff line
@@ -1596,7 +1596,7 @@ public class DisplayPolicy {
            final ActivityRecord currentActivity = win.getActivityRecord();
            if (currentActivity != null) {
                final LetterboxDetails currentLetterboxDetails = currentActivity
                        .mLetterboxUiController.getLetterboxDetails();
                        .mAppCompatController.getAppCompatLetterboxPolicy().getLetterboxDetails();
                if (currentLetterboxDetails != null) {
                    mLetterboxDetails.add(currentLetterboxDetails);
                }
Loading