Only create surface when showing window if it destroys it when hiding.

The visibility of a window might be toggled to true even when it doesn't
have a surface, which is a case for windows under the lock screen. We
can't blindly create surfaces in that case, but only do it for the
windows that destroy their surfaces when they are hidden.

Bug: 25879215
Change-Id: I6cf2c6810ce02fba0d2207a56de9924c0270dfeb
This commit is contained in:
Filip Gruszczynski
2015-11-25 10:51:25 -08:00
parent e38bdf6bf7
commit 55149303d1
2 changed files with 4 additions and 2 deletions

View File

@@ -106,6 +106,7 @@ public final class InputWindowHandle {
.append(", frame=[").append(frameLeft).append(",").append(frameTop).append(",")
.append(frameRight).append(",").append(frameBottom).append("]")
.append(", touchableRegion=").append(touchableRegion)
.append(", visible=").append(visible)
.toString();
}

View File

@@ -1605,8 +1605,9 @@ final class WindowState implements WindowManagerPolicy.WindowState {
// Already showing.
return false;
}
if (!mHasSurface) {
mDestroying = false;
if (!mHasSurface && mDestroySurfaceWhenHidden) {
// This is a window that doesn't retain the surface when it's hidden, so immediately
// when we want to show it again, we need to create the surface for it.
mWinAnimator.createSurfaceLocked();
}
if (DEBUG_VISIBILITY) Slog.v(TAG, "Policy visibility true: " + this);