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

Commit e6ff03f5 authored by Massimo Carli's avatar Massimo Carli
Browse files

Rename layoutLetterbox() following existing conventions

The layoutLetterbox() method can be a no-op on some conditions
so the right name should be layoutLetterboxIfNeeded()

Same for updateLetterboxSurface() renamed as
updateLetterboxSurfaceIfNeeded()

Bug: 324417794
Test: atest WmTests:LetterboxUiControllerTest

Change-Id: I1ad7f11e4b16a9b2b8b0e2d46c5ddcf1ead6de84
parent aed78ff2
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
@@ -1843,20 +1843,20 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        mLetterboxUiController.onMovedToDisplay(mDisplayContent.getDisplayId());
        mLetterboxUiController.onMovedToDisplay(mDisplayContent.getDisplayId());
    }
    }


    void layoutLetterbox(WindowState winHint) {
    void layoutLetterboxIfNeeded(WindowState winHint) {
        mLetterboxUiController.layoutLetterbox(winHint);
        mLetterboxUiController.layoutLetterboxIfNeeded(winHint);
    }
    }


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


    void updateLetterboxSurface(WindowState winHint, Transaction t) {
    void updateLetterboxSurfaceIfNeeded(WindowState winHint, Transaction t) {
        mLetterboxUiController.updateLetterboxSurface(winHint, t);
        mLetterboxUiController.updateLetterboxSurfaceIfNeeded(winHint, t);
    }
    }


    void updateLetterboxSurface(WindowState winHint) {
    void updateLetterboxSurfaceIfNeeded(WindowState winHint) {
        mLetterboxUiController.updateLetterboxSurface(winHint);
        mLetterboxUiController.updateLetterboxSurfaceIfNeeded(winHint);
    }
    }


    /** Gets the letterbox insets. The insets will be empty if there is no letterbox. */
    /** Gets the letterbox insets. The insets will be empty if there is no letterbox. */
@@ -4496,7 +4496,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }
        }
        super.removeChild(child);
        super.removeChild(child);
        checkKeyguardFlagsChanged();
        checkKeyguardFlagsChanged();
        updateLetterboxSurface(child);
        updateLetterboxSurfaceIfNeeded(child);
    }
    }


    void setAppLayoutChanges(int changes, String reason) {
    void setAppLayoutChanges(int changes, String reason) {
@@ -5966,7 +5966,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        if (destroyedSomething) {
        if (destroyedSomething) {
            final DisplayContent dc = getDisplayContent();
            final DisplayContent dc = getDisplayContent();
            dc.assignWindowLayers(true /*setLayoutNeeded*/);
            dc.assignWindowLayers(true /*setLayoutNeeded*/);
            updateLetterboxSurface(null);
            updateLetterboxSurfaceIfNeeded(null);
        }
        }
    }
    }


@@ -7618,7 +7618,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }
        }


        if (mNeedsLetterboxedAnimation) {
        if (mNeedsLetterboxedAnimation) {
            updateLetterboxSurface(findMainWindow(), t);
            updateLetterboxSurfaceIfNeeded(findMainWindow(), t);
            mNeedsAnimationBoundsLayer = true;
            mNeedsAnimationBoundsLayer = true;
        }
        }


@@ -7786,7 +7786,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        mNeedsAnimationBoundsLayer = false;
        mNeedsAnimationBoundsLayer = false;
        if (mNeedsLetterboxedAnimation) {
        if (mNeedsLetterboxedAnimation) {
            mNeedsLetterboxedAnimation = false;
            mNeedsLetterboxedAnimation = false;
            updateLetterboxSurface(findMainWindow(), t);
            updateLetterboxSurfaceIfNeeded(findMainWindow(), t);
        }
        }


        if (mAnimatingActivityRegistry != null) {
        if (mAnimatingActivityRegistry != null) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -1127,7 +1127,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp


        final ActivityRecord activity = w.mActivityRecord;
        final ActivityRecord activity = w.mActivityRecord;
        if (activity != null && activity.isVisibleRequested()) {
        if (activity != null && activity.isVisibleRequested()) {
            activity.updateLetterboxSurface(w);
            activity.updateLetterboxSurfaceIfNeeded(w);
            final boolean updateAllDrawn = activity.updateDrawnWindowStates(w);
            final boolean updateAllDrawn = activity.updateDrawnWindowStates(w);
            if (updateAllDrawn && !mTmpUpdateAllDrawn.contains(activity)) {
            if (updateAllDrawn && !mTmpUpdateAllDrawn.contains(activity)) {
                mTmpUpdateAllDrawn.add(activity);
                mTmpUpdateAllDrawn.add(activity);
+5 −5
Original line number Original line Diff line number Diff line
@@ -924,21 +924,21 @@ final class LetterboxUiController {
        return mLetterbox == null || mLetterbox.notIntersectsOrFullyContains(rect);
        return mLetterbox == null || mLetterbox.notIntersectsOrFullyContains(rect);
    }
    }


    void updateLetterboxSurface(WindowState winHint) {
    void updateLetterboxSurfaceIfNeeded(WindowState winHint) {
        updateLetterboxSurface(winHint, mActivityRecord.getSyncTransaction());
        updateLetterboxSurfaceIfNeeded(winHint, mActivityRecord.getSyncTransaction());
    }
    }


    void updateLetterboxSurface(WindowState winHint, Transaction t) {
    void updateLetterboxSurfaceIfNeeded(WindowState winHint, Transaction t) {
        if (shouldNotLayoutLetterbox(winHint)) {
        if (shouldNotLayoutLetterbox(winHint)) {
            return;
            return;
        }
        }
        layoutLetterbox(winHint);
        layoutLetterboxIfNeeded(winHint);
        if (mLetterbox != null && mLetterbox.needsApplySurfaceChanges()) {
        if (mLetterbox != null && mLetterbox.needsApplySurfaceChanges()) {
            mLetterbox.applySurfaceChanges(t);
            mLetterbox.applySurfaceChanges(t);
        }
        }
    }
    }


    void layoutLetterbox(WindowState w) {
    void layoutLetterboxIfNeeded(WindowState w) {
        if (shouldNotLayoutLetterbox(w)) {
        if (shouldNotLayoutLetterbox(w)) {
            return;
            return;
        }
        }
+1 −1
Original line number Original line Diff line number Diff line
@@ -1332,7 +1332,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        updateSourceFrame(windowFrames.mFrame);
        updateSourceFrame(windowFrames.mFrame);


        if (mActivityRecord != null && !mIsChildWindow) {
        if (mActivityRecord != null && !mIsChildWindow) {
            mActivityRecord.layoutLetterbox(this);
            mActivityRecord.layoutLetterboxIfNeeded(this);
        }
        }
        mSurfacePlacementNeeded = true;
        mSurfacePlacementNeeded = true;
        mHaveFrame = true;
        mHaveFrame = true;