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

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

Only adjust window layers from WindowLayerController

Various animation adjustment logic will directly set mAnimLayer
outside of WindowLayerController. If we end up setting this layer
very high, we can end up moving it above the special windows
collected in WindowLayersController.

Bug: 33702491
Bug: 35396882
Test: bit FrameworksServicesTests:com.android.server.wm.WindowTokenTests
Change-Id: I9850529ecd6f0067bc24421515b39b645885a3ec
parent b70ef8d7
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -248,8 +248,9 @@ public class AppWindowAnimator {
        }
    }

    void updateLayers() {
        thumbnailLayer = mAppToken.adjustAnimLayer(animLayerAdjustment);
    private void updateLayers() {
        mAppToken.getDisplayContent().assignWindowLayers(false /* relayoutNeeded */);
        thumbnailLayer = mAppToken.getHighestAnimLayer();
    }

    private void stepThumbnailAnimation(long currentTime) {
+5 −0
Original line number Diff line number Diff line
@@ -1408,6 +1408,11 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree
        return candidate;
    }

    @Override
    int getAnimLayerAdjustment() {
        return mAppAnimator.animLayerAdjustment;
    }

    @Override
    void dump(PrintWriter pw, String prefix) {
        super.dump(pw, prefix);
+2 −6
Original line number Diff line number Diff line
@@ -341,9 +341,6 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
        }
    };

    private final Consumer<WindowState> mSetInputMethodAnimLayerAdjustment =
            w -> w.adjustAnimLayer(mInputMethodAnimLayerAdjustment);

    private final Consumer<WindowState> mScheduleToastTimeout = w -> {
        final int lostFocusUid = mTmpWindow.mOwnerUid;
        final Handler handler = mService.mH;
@@ -1281,8 +1278,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
    void setInputMethodAnimLayerAdjustment(int adj) {
        if (DEBUG_LAYERS) Slog.v(TAG_WM, "Setting im layer adj to " + adj);
        mInputMethodAnimLayerAdjustment = adj;
        mImeWindowsContainers.forAllWindows(mSetInputMethodAnimLayerAdjustment,
                true /* traverseTopToBottom */);
        assignWindowLayers(false /* relayoutNeeded */);
    }

    /**
@@ -1688,7 +1684,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            if (DEBUG_INPUT_METHOD) Slog.w(TAG_WM, "Moving IM target from " + curTarget + " to "
                    + target + (SHOW_STACK_CRAWLS ? " Callers=" + Debug.getCallers(4) : ""));
            setInputMethodTarget(target, false, target.mAppToken != null
                    ? target.mAppToken.mAppAnimator.animLayerAdjustment : 0);
                    ? target.mAppToken.getAnimLayerAdjustment() : 0);
        }

        return target;
+2 −1
Original line number Diff line number Diff line
@@ -547,6 +547,7 @@ class WallpaperController {
        for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) {
            final WallpaperWindowToken token = mWallpaperTokens.get(curTokenNdx);
            token.updateWallpaperWindows(visible, mWallpaperAnimLayerAdjustment);
            token.getDisplayContent().assignWindowLayers(false);
        }
    }

@@ -568,7 +569,7 @@ class WallpaperController {
            // Only do this if we are not transferring between two wallpaper targets.
            mWallpaperAnimLayerAdjustment =
                    (mPrevWallpaperTarget == null && mWallpaperTarget.mAppToken != null)
                            ? mWallpaperTarget.mAppToken.mAppAnimator.animLayerAdjustment : 0;
                            ? mWallpaperTarget.mAppToken.getAnimLayerAdjustment() : 0;

            if (mWallpaperTarget.mWallpaperX >= 0) {
                mLastWallpaperX = mWallpaperTarget.mWallpaperX;
+0 −1
Original line number Diff line number Diff line
@@ -142,7 +142,6 @@ class WallpaperWindowToken extends WindowToken {

            // First, make sure the client has the current visibility state.
            wallpaper.dispatchWallpaperVisibility(visible);
            wallpaper.adjustAnimLayer(animLayerAdj);

            if (DEBUG_LAYERS || DEBUG_WALLPAPER_LIGHT) Slog.v(TAG, "adjustWallpaper win "
                    + wallpaper + " anim layer: " + wallpaper.mWinAnimator.mAnimLayer);
Loading