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

Commit e3024512 authored by Robert Carr's avatar Robert Carr
Browse files

Respect Z-ordering when assigning fullscreen-dim layer.

As an optimization, we use a shared fullscreen dim layer for multiple
users. We need to be careful to look at the Z-order of various users
when choosing who to assign it to.

Bug: 36415615
Test: Ask assistant question, long press power, assistant should be dimmed.
Change-Id: Ifea94fe33d32236b79800c0e7c543aac52c8b69f
parent dd8a71f4
Loading
Loading
Loading
Loading
+12 −1
Original line number Original line Diff line number Diff line
@@ -188,6 +188,7 @@ class DimLayerController {
    boolean animateDimLayers() {
    boolean animateDimLayers() {
        int fullScreen = -1;
        int fullScreen = -1;
        int fullScreenAndDimming = -1;
        int fullScreenAndDimming = -1;
        int topFullScreenUserLayer = 0;
        boolean result = false;
        boolean result = false;


        for (int i = mState.size() - 1; i >= 0; i--) {
        for (int i = mState.size() - 1; i >= 0; i--) {
@@ -213,8 +214,18 @@ class DimLayerController {
            // and we have to make sure we always animate the layer.
            // and we have to make sure we always animate the layer.
            if (user.dimFullscreen() && state.dimLayer == mSharedFullScreenDimLayer) {
            if (user.dimFullscreen() && state.dimLayer == mSharedFullScreenDimLayer) {
                fullScreen = i;
                fullScreen = i;
                if (mState.valueAt(i).continueDimming) {
                if (!state.continueDimming) {
                    continue;
                }

                // When choosing which user to assign the shared fullscreen layer to
                // we need to look at Z-order.
                if (topFullScreenUserLayer == 0 ||
                        (state.animator != null && state.animator.mAnimLayer > topFullScreenUserLayer)) {
                    fullScreenAndDimming = i;
                    fullScreenAndDimming = i;
                    if (state.animator != null) {
                        topFullScreenUserLayer = state.animator.mAnimLayer;
                    }
                }
                }
            } else {
            } else {
                // We always want to animate the non fullscreen windows, they don't share their
                // We always want to animate the non fullscreen windows, they don't share their