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

Commit 14076150 authored by chaviw's avatar chaviw
Browse files

Check if WindowToken is visible before adding dim.

If a window token is set to hidden, we don't want to add dim layers to any
window states for that window token.

For example, if an AWT is set to exit, but one of its windows has a dim,
we don't want the dim to stay while the app is exiting.

Fixes: 72821785
Test: Press home from app with dialog open. Dim should hide immediately
and not wait until exit animation is complete.
Test: atest WindowManagerSmokeTest

Change-Id: I0f87dd3900fc4535f572cf2b876e29d9b27f0b35
parent e800fd8e
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -4505,8 +4505,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        if (!mAnimatingExit && mAppDied) {
            mIsDimming = true;
            dimmer.dimAbove(getPendingTransaction(), this, DEFAULT_DIM_AMOUNT_DEAD_WINDOW);
        } else if ((mAttrs.flags & FLAG_DIM_BEHIND) != 0
                && !mAnimatingExit && isVisible() && !mWinAnimator.mLastHidden) {
        } else if ((mAttrs.flags & FLAG_DIM_BEHIND) != 0 && isVisibleNow()
                && !mWinAnimator.mLastHidden) {
            // Only show a dim behind when the following is satisfied:
            // 1. The window has the flag FLAG_DIM_BEHIND
            // 2. The WindowToken is not hidden so dims aren't shown when the window is exiting.
            // 3. The WS is considered visible according to the isVisible() method
            // 4. The WSA is not hidden.
            mIsDimming = true;
            dimmer.dimBelow(getPendingTransaction(), this, mAttrs.dimAmount);
        }