Make sure surface control is really valid before giving it to client

am: 7581cddf25

Change-Id: Ibc06a598f98c14f9a986ab91fdb1d4b04152b65c
This commit is contained in:
Chong Zhang
2016-08-23 14:30:19 +00:00
committed by android-build-merger

View File

@@ -2908,12 +2908,11 @@ public class WindowManagerService extends IWindowManager.Stub
} }
result |= RELAYOUT_RES_SURFACE_CHANGED; result |= RELAYOUT_RES_SURFACE_CHANGED;
} }
final WindowSurfaceController surfaceController = winAnimator.mSurfaceController; if (viewVisibility == View.VISIBLE && winAnimator.hasSurface()) {
if (viewVisibility == View.VISIBLE && surfaceController != null) {
// We already told the client to go invisible, but the message may not be // We already told the client to go invisible, but the message may not be
// handled yet, or it might want to draw a last frame. If we already have a // handled yet, or it might want to draw a last frame. If we already have a
// surface, let the client use that, but don't create new surface at this point. // surface, let the client use that, but don't create new surface at this point.
surfaceController.getSurface(outSurface); winAnimator.mSurfaceController.getSurface(outSurface);
} else { } else {
if (DEBUG_VISIBILITY) Slog.i(TAG_WM, "Releasing surface in: " + win); if (DEBUG_VISIBILITY) Slog.i(TAG_WM, "Releasing surface in: " + win);