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

am: e532469994

Change-Id: Id420ae52be01629921f2a190a0c5b10d7e074316
This commit is contained in:
Vishnu Nair
2019-01-28 21:40:57 -08:00
committed by android-build-merger

View File

@@ -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