summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorvadimt <vadimt@google.com>2019-10-18 11:34:21 -0700
committerVadim Tryshev <vadimt@google.com>2019-10-18 19:36:26 +0000
commit7fcbd2379be6267f5c0d9522b0ce7a2ec5859427 (patch)
tree318fa0a2e908188dff3c252912754c2c2edd5a67 /src/com/android
parentc3a688a97339bbe5d01fea9d1895499a23ecf259 (diff)
downloadandroid_packages_apps_Trebuchet-7fcbd2379be6267f5c0d9522b0ce7a2ec5859427.tar.gz
android_packages_apps_Trebuchet-7fcbd2379be6267f5c0d9522b0ce7a2ec5859427.tar.bz2
android_packages_apps_Trebuchet-7fcbd2379be6267f5c0d9522b0ce7a2ec5859427.zip
Fixing activity leak on config change
If attachTo happens before the view is attached to window, ViewOnDrawExecutor hooks to the tree observer twice (second time from onViewAttachedToWindow). It only unhooks once. Since tree observer is global, this leads to leaking the activity, and besides, all old activities getting the events from the tree observer. Bug: 139137636 Change-Id: Ie2641b8f3614545052fe34ad6588b070c3b82a33 (cherry picked from commit ebb5c75344168397403edd74f8fc5e9603e41b13)
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/launcher3/util/ViewOnDrawExecutor.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/com/android/launcher3/util/ViewOnDrawExecutor.java b/src/com/android/launcher3/util/ViewOnDrawExecutor.java
index 61ba4e566..5a131c83f 100644
--- a/src/com/android/launcher3/util/ViewOnDrawExecutor.java
+++ b/src/com/android/launcher3/util/ViewOnDrawExecutor.java
@@ -55,7 +55,9 @@ public class ViewOnDrawExecutor implements Executor, OnDrawListener, Runnable,
mLoadAnimationCompleted = true;
}
- attachObserver();
+ if (mAttachedView.isAttachedToWindow()) {
+ attachObserver();
+ }
}
private void attachObserver() {