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

This commit is contained in:
TreeHugger Robot
2019-01-29 05:11:47 +00:00
committed by Android (Google) Code Review

View File

@@ -1354,6 +1354,9 @@ public final class ViewRootImpl implements ViewParent,
}
if (mStopped) {
if (mSurfaceHolder != null) {
notifySurfaceDestroyed();
}
mSurface.release();
}
}
@@ -2227,13 +2230,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();
@@ -2497,6 +2494,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