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

Commit 1648f042 authored by Craig Mautner's avatar Craig Mautner Committed by Android Git Automerger
Browse files

am fd8a8ccb: Merge "Set the new SurfaceControl opaque flag." into klp-modular-dev

* commit 'fd8a8ccb':
  Set the new SurfaceControl opaque flag.
parents 3519530f fd8a8ccb
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -1233,8 +1233,9 @@ final class ActivityStack {
            mUndrawnActivitiesBelowTopTranslucent.clear();
            mHandler.removeMessages(TRANSLUCENT_TIMEOUT_MSG);

            if (waitingActivity != null && waitingActivity.app != null &&
                    waitingActivity.app.thread != null) {
            if (waitingActivity != null) {
                mWindowManager.setWindowOpaque(waitingActivity.appToken, false);
                if (waitingActivity.app != null && waitingActivity.app.thread != null) {
                    try {
                        waitingActivity.app.thread.scheduleTranslucentConversionComplete(
                                waitingActivity.appToken, r != null);
@@ -1243,6 +1244,7 @@ final class ActivityStack {
                }
            }
        }
    }

    /**
     * Ensure that the top activity in the stack is resumed.
+15 −0
Original line number Diff line number Diff line
@@ -4200,10 +4200,25 @@ public class WindowManagerService extends IWindowManager.Stub
        AppWindowToken atoken = findAppWindowToken(token);
        if (atoken != null) {
            atoken.appFullscreen = toOpaque;
            // When making translucent, wait until windows below have been drawn.
            if (toOpaque) {
                // Making opaque so do it now.
                setWindowOpaque(token, true);
            }
            requestTraversal();
        }
    }

    public void setWindowOpaque(IBinder token, boolean isOpaque) {
        AppWindowToken wtoken = findAppWindowToken(token);
        if (wtoken != null) {
            WindowState win = wtoken.findMainWindow();
            if (win != null) {
                win.mWinAnimator.setOpaque(isOpaque);
            }
        }
    }

    boolean setTokenVisibilityLocked(AppWindowToken wtoken, WindowManager.LayoutParams lp,
            boolean visible, int transit, boolean performLayout) {
        boolean delayed = false;
+31 −5
Original line number Diff line number Diff line
@@ -490,6 +490,7 @@ class WindowStateAnimator {
        private final Rect mWindowCrop = new Rect();
        private boolean mShown = false;
        private int mLayerStack;
        private boolean mIsOpaque;
        private final String mName;

        public SurfaceTrace(SurfaceSession s,
@@ -574,6 +575,16 @@ class WindowStateAnimator {
            super.setLayerStack(layerStack);
        }

        @Override
        public void setOpaque(boolean isOpaque) {
            if (isOpaque != mIsOpaque) {
                Slog.v(SURFACE_TAG, "setOpaque(" + isOpaque + "): OLD:" + this
                        + ". Called by " + Debug.getCallers(3));
                mIsOpaque = isOpaque;
            }
            super.setOpaque(isOpaque);
        }

        @Override
        public void hide() {
            if (mShown) {
@@ -620,7 +631,8 @@ class WindowStateAnimator {
                    + mName + " (" + mLayerStack + "): shown=" + mShown + " layer=" + mLayer
                    + " alpha=" + mSurfaceTraceAlpha + " " + mPosition.x + "," + mPosition.y
                    + " " + mSize.x + "x" + mSize.y
                    + " crop=" + mWindowCrop.toShortString();
                    + " crop=" + mWindowCrop.toShortString()
                    + " opaque=" + mIsOpaque;
        }
    }

@@ -1337,8 +1349,7 @@ class WindowStateAnimator {
            Slog.w(TAG, "setTransparentRegionHint: null mSurface after mHasSurface true");
            return;
        }
        if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
            ">>> OPEN TRANSACTION setTransparentRegion");
        if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION setTransparentRegion");
        SurfaceControl.openTransaction();
        try {
            if (SHOW_TRANSACTIONS) WindowManagerService.logSurface(mWin,
@@ -1364,8 +1375,7 @@ class WindowStateAnimator {
                // transformation is being applied by the animation.
                return;
            }
            if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
                    ">>> OPEN TRANSACTION setWallpaperOffset");
            if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION setWallpaperOffset");
            SurfaceControl.openTransaction();
            try {
                if (WindowManagerService.SHOW_TRANSACTIONS) WindowManagerService.logSurface(mWin,
@@ -1383,6 +1393,22 @@ class WindowStateAnimator {
        }
    }

    void setOpaque(boolean isOpaque) {
        if (mSurfaceControl == null) {
            return;
        }
        if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION setOpaque");
        SurfaceControl.openTransaction();
        try {
            if (SHOW_TRANSACTIONS) WindowManagerService.logSurface(mWin, "isOpaque=" + isOpaque,
                    null);
            mSurfaceControl.setOpaque(isOpaque);
        } finally {
            SurfaceControl.closeTransaction();
            if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, "<<< CLOSE TRANSACTION setOpaque");
        }
    }

    // This must be called while inside a transaction.
    boolean performShowLocked() {
        if (mWin.isHiddenFromUserLocked()) {