diff options
author | vadimt <vadimt@google.com> | 2019-10-18 11:34:21 -0700 |
---|---|---|
committer | Vadim Tryshev <vadimt@google.com> | 2019-10-18 19:36:26 +0000 |
commit | 7fcbd2379be6267f5c0d9522b0ce7a2ec5859427 (patch) | |
tree | 318fa0a2e908188dff3c252912754c2c2edd5a67 /src/com | |
parent | c3a688a97339bbe5d01fea9d1895499a23ecf259 (diff) | |
download | android_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')
-rw-r--r-- | src/com/android/launcher3/util/ViewOnDrawExecutor.java | 4 |
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() { |