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

Commit 498e8c92 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Apply stack dim layer to entire screen for system windows.

System windows like alert dialogs are attached to the currently
focused stack even when the stack isn't full screen. This causes
the dim not to apply to other visible stacks when a system
window is up. Change applies the dim to the entire screen for
system windows since they extend outside a resized stack.

Bug: 19332229
Change-Id: I94affa6a652326bf2cf14b1b8bf54862c111c540
parent 80955e10
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -244,20 +244,19 @@ class DisplayContent {
        mTapDetector.setTouchExcludeRegion(mTouchExcludeRegion);
    }

    void switchUserStacks(int newUserId) {
    void switchUserStacks() {
        final WindowList windows = getWindowList();
        for (int i = 0; i < windows.size(); i++) {
            final WindowState win = windows.get(i);
            if (win.isHiddenFromUserLocked()) {
                if (DEBUG_VISIBILITY) Slog.w(TAG, "user changing " + newUserId + " hiding "
                        + win + ", attrs=" + win.mAttrs.type + ", belonging to "
                        + win.mOwnerUid);
                if (DEBUG_VISIBILITY) Slog.w(TAG, "user changing, hiding " + win
                        + ", attrs=" + win.mAttrs.type + ", belonging to " + win.mOwnerUid);
                win.hideLw(false);
            }
        }

        for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
            mStacks.get(stackNdx).switchUser(newUserId);
            mStacks.get(stackNdx).switchUser();
        }
    }

+12 −6
Original line number Diff line number Diff line
@@ -420,18 +420,24 @@ public class TaskStack {

    void startDimmingIfNeeded(WindowStateAnimator newWinAnimator) {
        // Only set dim params on the highest dimmed layer.
        final WindowStateAnimator existingDimWinAnimator = mDimWinAnimator;
        // Don't turn on for an unshown surface, or for any layer but the highest dimmed layer.
        if (newWinAnimator.mSurfaceShown && (existingDimWinAnimator == null
                || !existingDimWinAnimator.mSurfaceShown
                || existingDimWinAnimator.mAnimLayer < newWinAnimator.mAnimLayer)) {
        if (newWinAnimator.mSurfaceShown && (mDimWinAnimator == null
                || !mDimWinAnimator.mSurfaceShown
                || mDimWinAnimator.mAnimLayer < newWinAnimator.mAnimLayer)) {
            mDimWinAnimator = newWinAnimator;
            if (mDimWinAnimator.mWin.mAppToken == null
                    && !mFullscreen && mDisplayContent != null) {
                // Dim should cover the entire screen for system windows.
                mDisplayContent.getLogicalDisplayRect(mTmpRect);
                mDimLayer.setBounds(mTmpRect);
            }
        }
    }

    void stopDimmingIfNeeded() {
        if (!mDimmingTag && isDimming()) {
            mDimWinAnimator = null;
            mDimLayer.setBounds(mBounds);
        }
    }

@@ -446,7 +452,7 @@ public class TaskStack {
        }
    }

    void switchUser(int userId) {
    void switchUser() {
        int top = mTasks.size();
        for (int taskNdx = 0; taskNdx < top; ++taskNdx) {
            Task task = mTasks.get(taskNdx);
@@ -475,7 +481,7 @@ public class TaskStack {
        }
        if (mDimLayer.isDimming()) {
            pw.print(prefix); pw.println("mDimLayer:");
            mDimLayer.printTo(prefix, pw);
            mDimLayer.printTo(prefix + " ", pw);
            pw.print(prefix); pw.print("mDimWinAnimator="); pw.println(mDimWinAnimator);
        }
        if (!mExitingAppTokens.isEmpty()) {
+1 −1
Original line number Diff line number Diff line
@@ -5479,7 +5479,7 @@ public class WindowManagerService extends IWindowManager.Stub
            final int numDisplays = mDisplayContents.size();
            for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
                final DisplayContent displayContent = mDisplayContents.valueAt(displayNdx);
                displayContent.switchUserStacks(newUserId);
                displayContent.switchUserStacks();
                rebuildAppWindowListLocked(displayContent);
            }
            performLayoutAndPlaceSurfacesLocked();