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

Commit f9ca2d48 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Clean up isVisibleLw and isDimming of WindowManagerPolicy#WindowState

The isVisibleLw just redirects to call isVisible. These methods were
used for PhoneWindowManager to access wm package. Since all usages
are removed, the interface methods are no longer needed.

Bug: 163976519
Test: WmTests CtsWindowManagerDeviceTestCases presubmit
Change-Id: I29521e806fb42c0b54caa82e103291cc74130899
parent 635cd7b6
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -206,24 +206,12 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants {
         */
        public IApplicationToken getAppToken();

        /**
         * Is this window visible?  It is not visible if there is no
         * surface, or we are in the process of running an exit animation
         * that will remove the surface.
         */
        boolean isVisibleLw();

        /**
         * Return true if this window (or a window it is attached to, but not
         * considering its app token) is currently animating.
         */
        boolean isAnimatingLw();

        /**
         * Check whether the window is currently dimming.
         */
        public boolean isDimming();

        /**
         * Returns true if the window owner can add internal system windows.
         * That is, they have {@link Manifest.permission#INTERNAL_SYSTEM_WINDOW}.
+3 −3
Original line number Diff line number Diff line
@@ -857,7 +857,7 @@ final class AccessibilityController {
            private void populateWindowsOnScreenLocked(SparseArray<WindowState> outWindows) {
                mTempLayer = 0;
                mDisplayContent.forAllWindows((w) -> {
                    if (w.isOnScreen() && w.isVisibleLw()
                    if (w.isOnScreen() && w.isVisible()
                            && (w.mAttrs.alpha != 0)) {
                        mTempLayer++;
                        outWindows.put(mTempLayer, w);
@@ -1517,7 +1517,7 @@ final class AccessibilityController {
            }

            dc.forAllWindows(w -> {
                if (w.isVisibleLw()) {
                if (w.isVisible()) {
                    tempWindowStatesList.add(w);
                }
            }, false /* traverseTopToBottom */);
@@ -1529,7 +1529,7 @@ final class AccessibilityController {
                    return;
                }

                if (w.isVisibleLw() && tempWindowStatesList.contains(parentWindow)) {
                if (w.isVisible() && tempWindowStatesList.contains(parentWindow)) {
                    tempWindowStatesList.add(tempWindowStatesList.lastIndexOf(parentWindow), w);
                }
            }, false /* traverseTopToBottom */);
+1 −1
Original line number Diff line number Diff line
@@ -760,7 +760,7 @@ public class AppTransitionController {
                ProtoLog.v(WM_DEBUG_APP_TRANSITIONS,
                        "New transit away from wallpaper: %s",
                                AppTransition.appTransitionOldToString(transit));
            } else if (wallpaperTarget != null && wallpaperTarget.isVisibleLw()
            } else if (wallpaperTarget != null && wallpaperTarget.isVisible()
                    && openingApps.contains(wallpaperTarget.mActivityRecord)
                    && topOpeningApp == wallpaperTarget.mActivityRecord
                    && transit != TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE) {
+6 −6
Original line number Diff line number Diff line
@@ -862,7 +862,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
            }
        }

        if (obscuredChanged && w.isVisibleLw() && mWallpaperController.isWallpaperTarget(w)) {
        if (obscuredChanged && w.isVisible() && mWallpaperController.isWallpaperTarget(w)) {
            // This is the wallpaper target and its obscured state changed... make sure the
            // current wallpaper's visibility has been updated accordingly.
            mWallpaperController.updateWallpaperVisibility();
@@ -2584,7 +2584,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
                return;
            }

            if (w.isOnScreen() && w.isVisibleLw() && w.getFrame().contains(x, y)) {
            if (w.isOnScreen() && w.isVisible() && w.getFrame().contains(x, y)) {
                targetWindowType[0] = w.mAttrs.type;
                return;
            }
@@ -2629,7 +2629,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
                mTouchExcludeRegion.op(mTmpRect2, Region.Op.UNION);
            }
        }
        if (mInputMethodWindow != null && mInputMethodWindow.isVisibleLw()) {
        if (mInputMethodWindow != null && mInputMethodWindow.isVisible()) {
            // If the input method is visible and the user is typing, we don't want these touch
            // events to be intercepted and used to change focus. This would likely cause a
            // disappearance of the input method.
@@ -2638,7 +2638,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        }
        for (int i = mTapExcludedWindows.size() - 1; i >= 0; i--) {
            final WindowState win = mTapExcludedWindows.get(i);
            if (!win.isVisibleLw()) {
            if (!win.isVisible()) {
                continue;
            }
            win.getTouchableRegion(mTmpRegion);
@@ -2781,7 +2781,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp

    void adjustForImeIfNeeded() {
        final WindowState imeWin = mInputMethodWindow;
        final boolean imeVisible = imeWin != null && imeWin.isVisibleLw()
        final boolean imeVisible = imeWin != null && imeWin.isVisible()
                && imeWin.isDisplayed();
        final int imeHeight = mDisplayFrames.getInputMethodWindowVisibleHeight();
        mPinnedStackControllerLocked.setAdjustedForIme(imeVisible, imeHeight);
@@ -3068,7 +3068,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        final int y = (int) yf;
        final WindowState touchedWin = getWindow(w -> {
            final int flags = w.mAttrs.flags;
            if (!w.isVisibleLw()) {
            if (!w.isVisible()) {
                return false;
            }
            if ((flags & FLAG_NOT_TOUCHABLE) != 0) {
+11 −11
Original line number Diff line number Diff line
@@ -1718,7 +1718,7 @@ public class DisplayPolicy {

        for (int i = mScreenDecorWindows.size() - 1; i >= 0; --i) {
            final WindowState w = mScreenDecorWindows.valueAt(i);
            if (w.getDisplayId() != displayId || !w.isVisibleLw()) {
            if (w.getDisplayId() != displayId || !w.isVisible()) {
                // Skip if not on the same display or not visible.
                continue;
            }
@@ -1824,7 +1824,7 @@ public class DisplayPolicy {
        boolean statusBarTranslucent = (appearance & APPEARANCE_OPAQUE_STATUS_BARS) == 0;

        // If the status bar is hidden, we don't want to cause windows behind it to scroll.
        if (mStatusBar.isVisibleLw() && !statusBarTransient) {
        if (mStatusBar.isVisible() && !statusBarTransient) {
            // Status bar may go away, so the screen area it occupies is available to apps but just
            // covering them when the status bar is visible.
            final Rect dockFrame = displayFrames.mDock;
@@ -2143,10 +2143,10 @@ public class DisplayPolicy {
        win.computeFrame(displayFrames);
        // Dock windows carve out the bottom of the screen, so normal windows
        // can't appear underneath them.
        if (type == TYPE_INPUT_METHOD && win.isVisibleLw() && !win.mGivenInsetsPending) {
        if (type == TYPE_INPUT_METHOD && win.isVisible() && !win.mGivenInsetsPending) {
            offsetInputMethodWindowLw(win, displayFrames);
        }
        if (type == TYPE_VOICE_INTERACTION && win.isVisibleLw() && !win.mGivenInsetsPending) {
        if (type == TYPE_VOICE_INTERACTION && win.isVisible() && !win.mGivenInsetsPending) {
            offsetVoiceInputWindowLw(win, displayFrames);
        }
    }
@@ -2240,7 +2240,7 @@ public class DisplayPolicy {
            if (win.isDreamWindow()) {
                // If the lockscreen was showing when the dream started then wait
                // for the dream to draw before hiding the lockscreen.
                if (!mDreamingLockscreen || (win.isVisibleLw() && win.hasDrawn())) {
                if (!mDreamingLockscreen || (win.isVisible() && win.hasDrawn())) {
                    mShowingDream = true;
                    appWindow = true;
                }
@@ -2420,7 +2420,7 @@ public class DisplayPolicy {
        }

        // Show IME over the keyguard if the target allows it.
        final boolean showImeOverKeyguard = imeTarget != null && imeTarget.isVisibleLw()
        final boolean showImeOverKeyguard = imeTarget != null && imeTarget.isVisible()
                && win.mIsImWindow && (imeTarget.canShowWhenLocked()
                        || !mService.mPolicy.canBeHiddenByKeyguardLw(imeTarget));
        if (showImeOverKeyguard) {
@@ -3074,7 +3074,7 @@ public class DisplayPolicy {
        // If the IME window is visible and FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS is set, then IME
        // window can be navigation color window.
        final boolean imeWindowCanNavColorWindow = imeWindow != null
                && imeWindow.isVisibleLw()
                && imeWindow.isVisible()
                && navBarPosition == NAV_BAR_BOTTOM
                && (imeWindow.mAttrs.flags
                        & WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0;
@@ -3343,8 +3343,8 @@ public class DisplayPolicy {
    public void takeScreenshot(int screenshotType, int source) {
        if (mScreenshotHelper != null) {
            mScreenshotHelper.takeScreenshot(screenshotType,
                    getStatusBar() != null && getStatusBar().isVisibleLw(),
                    getNavigationBar() != null && getNavigationBar().isVisibleLw(),
                    getStatusBar() != null && getStatusBar().isVisible(),
                    getNavigationBar() != null && getNavigationBar().isVisible(),
                    source, mHandler, null /* completionConsumer */);
        }
    }
@@ -3513,8 +3513,8 @@ public class DisplayPolicy {

    @VisibleForTesting
    static boolean isOverlappingWithNavBar(WindowState targetWindow, WindowState navBarWindow) {
        if (navBarWindow == null || !navBarWindow.isVisibleLw()
                || targetWindow.mActivityRecord == null || !targetWindow.isVisibleLw()) {
        if (navBarWindow == null || !navBarWindow.isVisible()
                || targetWindow.mActivityRecord == null || !targetWindow.isVisible()) {
            return false;
        }

Loading