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

Commit 68a97794 authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Automerger Merge Worker
Browse files

Merge "Call preserveSurfaces when detaching children." into rvc-dev am:...

Merge "Call preserveSurfaces when detaching children." into rvc-dev am: 5b72ddd8 am: 747665d4 am: 27583ad0 am: f98d3cac

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11712621

Change-Id: Iab13d36514693212652f75b19f8a36027dde7e63
parents d394c255 f98d3cac
Loading
Loading
Loading
Loading
+26 −16
Original line number Diff line number Diff line
@@ -418,25 +418,25 @@ class WindowStateAnimator {
        if (!mDestroyPreservedSurfaceUponRedraw) {
            return;
        }
        if (mSurfaceController != null) {
            if (mPendingDestroySurface != null) {

        // If we are preserving a surface but we aren't relaunching that means
        // we are just doing an in-place switch. In that case any SurfaceFlinger side
        // child layers need to be reparented to the new surface to make this
        // transparent to the app.
                if (mWin.mActivityRecord == null || mWin.mActivityRecord.isRelaunching() == false) {
        // If the children are detached, we don't want to reparent them to the new surface.
        // Instead let the children get removed when the old surface is deleted.
        if (mSurfaceController != null && mPendingDestroySurface != null && !mChildrenDetached
                && (mWin.mActivityRecord == null || !mWin.mActivityRecord.isRelaunching())) {
            mPostDrawTransaction.reparentChildren(
                    mPendingDestroySurface.getClientViewRootSurface(),
                    mSurfaceController.mSurfaceControl).apply();
        }
            }
        }

        destroyDeferredSurfaceLocked();
        mDestroyPreservedSurfaceUponRedraw = false;
    }

    void markPreservedSurfaceForDestroy() {
    private void markPreservedSurfaceForDestroy() {
        if (mDestroyPreservedSurfaceUponRedraw
                && !mService.mDestroyPreservedSurface.contains(mWin)) {
            mService.mDestroyPreservedSurface.add(mWin);
@@ -1363,10 +1363,14 @@ class WindowStateAnimator {
        if (mPendingDestroySurface != null && mDestroyPreservedSurfaceUponRedraw) {
            final SurfaceControl pendingSurfaceControl = mPendingDestroySurface.mSurfaceControl;
            mPostDrawTransaction.reparent(pendingSurfaceControl, null);
            // If the children are detached, we don't want to reparent them to the new surface.
            // Instead let the children get removed when the old surface is deleted.
            if (!mChildrenDetached) {
                mPostDrawTransaction.reparentChildren(
                        mPendingDestroySurface.getClientViewRootSurface(),
                        mSurfaceController.mSurfaceControl);
            }
        }

        SurfaceControl.mergeToGlobalTransaction(mPostDrawTransaction);
        return true;
@@ -1593,6 +1597,12 @@ class WindowStateAnimator {
            mSurfaceController.detachChildren();
        }
        mChildrenDetached = true;
        // If the children are detached, it means the app is exiting. We don't want to tear the
        // content down too early, otherwise we could end up with a flicker. By preserving the
        // current surface, we ensure the content remains on screen until the window is completely
        // removed. It also ensures that the old surface is cleaned up when started again since it
        // forces mSurfaceController to be set to null.
        preserveSurfaceLocked();
    }

    void setOffsetPositionForStackResize(boolean offsetPositionForStackResize) {