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

Commit ccfc9c14 authored by Vishnu Nair's avatar Vishnu Nair Committed by android-build-merger
Browse files

Merge "[DO NOT MERGE] ViewRoot: Notify app when surface is released from...

Merge "[DO NOT MERGE] ViewRoot: Notify app when surface is released from setWindowStopped" into pi-dev
am: e5324699

Change-Id: Id420ae52be01629921f2a190a0c5b10d7e074316
parents 2b996ad0 e5324699
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -1375,6 +1375,9 @@ public final class ViewRootImpl implements ViewParent,
            }

            if (mStopped) {
                if (mSurfaceHolder != null) {
                    notifySurfaceDestroyed();
                }
                mSurface.release();
            }
        }
@@ -2249,13 +2252,7 @@ public final class ViewRootImpl implements ViewParent,
                    }
                    mIsCreating = false;
                } else if (hadSurface) {
                    mSurfaceHolder.ungetCallbacks();
                    SurfaceHolder.Callback callbacks[] = mSurfaceHolder.getCallbacks();
                    if (callbacks != null) {
                        for (SurfaceHolder.Callback c : callbacks) {
                            c.surfaceDestroyed(mSurfaceHolder);
                        }
                    }
                    notifySurfaceDestroyed();
                    mSurfaceHolder.mSurfaceLock.lock();
                    try {
                        mSurfaceHolder.mSurface = new Surface();
@@ -2519,6 +2516,16 @@ public final class ViewRootImpl implements ViewParent,
        mIsInTraversal = false;
    }

    private void notifySurfaceDestroyed() {
        mSurfaceHolder.ungetCallbacks();
        SurfaceHolder.Callback[] callbacks = mSurfaceHolder.getCallbacks();
        if (callbacks != null) {
            for (SurfaceHolder.Callback c : callbacks) {
                c.surfaceDestroyed(mSurfaceHolder);
            }
        }
    }

    private void maybeHandleWindowMove(Rect frame) {

        // TODO: Well, we are checking whether the frame has changed similarly