summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chong Zhang <chz@google.com> 2016-04-04 17:31:05 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-04-04 17:31:06 +0000
commitebdb34d67aead66e5388c8cb501eb34668d7cec3 (patch)
treeb6df991476b2adbbb496f75a74ced400832957de
parent133b07a0a7bed8493203d80778fb8716f1784085 (diff)
parent6c71c0b86b67080bd79d695d0e3a1c9d00e38d98 (diff)
Merge "Never "save" if the surface control is null." into nyc-dev
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 57ead8b3a617..0f515db38ed1 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1878,6 +1878,11 @@ final class WindowState implements WindowManagerPolicy.WindowState {
}
private boolean shouldSaveSurface() {
+ if (mWinAnimator.mSurfaceController == null) {
+ // Don't bother if the surface controller is gone for any reason.
+ return false;
+ }
+
if ((mAttrs.flags & FLAG_SECURE) != 0) {
// We don't save secure surfaces since their content shouldn't be shown while the app
// isn't on screen and content might leak through during the transition animation with
@@ -1951,10 +1956,18 @@ final class WindowState implements WindowManagerPolicy.WindowState {
return;
}
mSurfaceSaved = false;
- setHasSurface(true);
- mWinAnimator.mDrawState = WindowStateAnimator.READY_TO_SHOW;
- if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) {
- Slog.v(TAG, "Restoring saved surface: " + this);
+ if (mWinAnimator.mSurfaceController != null) {
+ setHasSurface(true);
+ mWinAnimator.mDrawState = WindowStateAnimator.READY_TO_SHOW;
+
+ if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) {
+ Slog.v(TAG, "Restoring saved surface: " + this);
+ }
+ } else {
+ // mSurfaceController shouldn't be null if mSurfaceSaved was still true at
+ // this point. Even if we destroyed the saved surface because of rotation
+ // or resize, mSurfaceSaved flag should have been cleared. So this is a wtf.
+ Slog.wtf(TAG, "Failed to restore saved surface: surface gone! " + this);
}
}