summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jorim Jaggi <jjaggi@google.com> 2018-04-12 11:14:55 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2018-04-12 11:14:55 +0000
commit682ca4122d24d56a55cc821cbe12e99886ae8ff9 (patch)
treea05ff88c86c165a266475395b8ae12aa172bf552
parentb30a1b0668fa7c35c48a140fe08c8aa0ae68a1c1 (diff)
parent5057590fe969316ebfef5f5cae40a4b524a06a55 (diff)
Merge "Fix issue with leaked preserved surface" into pi-dev
-rw-r--r--services/core/java/com/android/server/wm/WindowState.java9
-rw-r--r--services/core/java/com/android/server/wm/WindowStateAnimator.java6
2 files changed, 10 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 9d3a49d8c675..aaf59b9f8e40 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -4106,11 +4106,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mDestroying = true;
final boolean hasSurface = mWinAnimator.hasSurface();
- if (hasSurface) {
- // Use pendingTransaction here so hide is done the same transaction as the other
- // animations when exiting
- mWinAnimator.hide(getPendingTransaction(), "onExitAnimationDone");
- }
+
+ // Use pendingTransaction here so hide is done the same transaction as the other
+ // animations when exiting
+ mWinAnimator.hide(getPendingTransaction(), "onExitAnimationDone");
// If we have an app token, we ask it to destroy the surface for us, so that it can take
// care to ensure the activity has actually stopped and the surface is not still in use.
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index ab5e24ac5999..195274ae27aa 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -308,6 +308,12 @@ class WindowStateAnimator {
if (!mLastHidden) {
//dump();
mLastHidden = true;
+
+ // We may have a preserved surface which we no longer need. If there was a quick
+ // VISIBLE, GONE, VISIBLE, GONE sequence, the surface may never draw, so we don't mark
+ // it to be destroyed in prepareSurfaceLocked.
+ markPreservedSurfaceForDestroy();
+
if (mSurfaceController != null) {
mSurfaceController.hide(transaction, reason);
}