Merge "SurfaceView: Don't destroy Surface while Stopped." into oc-dev

am: 42c6529c1d

Change-Id: I5f883c2760e8056d2130d232fb7ca43576339a17
This commit is contained in:
Robert Carr
2017-05-23 02:36:21 +00:00
committed by android-build-merger

View File

@@ -678,9 +678,16 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
} finally {
mIsCreating = false;
if (mSurfaceControl != null && !mSurfaceCreated) {
mSurfaceControl.destroy();
mSurface.release();
mSurfaceControl = null;
// If we are not in the stopped state, then the destruction of the Surface
// represents a visual change we need to display, and we should go ahead
// and destroy the SurfaceControl. However if we are in the stopped state,
// we can just leave the Surface around so it can be a part of animations,
// and we let the life-time be tied to the parent surface.
if (!mWindowStopped) {
mSurfaceControl.destroy();
mSurfaceControl = null;
}
}
}
} catch (Exception ex) {