diff options
author | Kevin <kevhan@google.com> | 2019-04-12 15:52:23 -0700 |
---|---|---|
committer | Kevin Han <kevhan@google.com> | 2019-04-23 19:24:43 +0000 |
commit | 532fb48331982f84790b91ae35ed684998d60a6e (patch) | |
tree | fe55e651bc48ff4adedba480a6bb3346c57d15a8 /go/quickstep | |
parent | a94154970a4088c64bde45ad35da166c7858244d (diff) | |
download | android_packages_apps_Trebuchet-532fb48331982f84790b91ae35ed684998d60a6e.tar.gz android_packages_apps_Trebuchet-532fb48331982f84790b91ae35ed684998d60a6e.tar.bz2 android_packages_apps_Trebuchet-532fb48331982f84790b91ae35ed684998d60a6e.zip |
Fix ViewTreeObserver crash on Recents Go
The view tree we originally attach the onGlobalLayout listener to may no
longer be alive when we get the callback as the view tree observer
merges when the view attaches to a view hierarchy, giving us an
exception. Instead, we should request the view tree observer again and
remove it from there.
Bug: 130740246
Fix: 130740246
Test: Manual test, no longer crashes
Change-Id: Idb982022e72db75b8e20fd5bea00655212dc0258
(cherry picked from commit 60f21a8d3ab501eb5a4b29ff3d7eb94e86f8f0d8)
Diffstat (limited to 'go/quickstep')
-rw-r--r-- | go/quickstep/src/com/android/quickstep/views/IconRecentsView.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java index 866140229..9688fdfda 100644 --- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java +++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java @@ -417,13 +417,12 @@ public final class IconRecentsView extends FrameLayout { * manage when the animation conflicts with another animation. */ private void scheduleFadeInLayoutAnimation() { - ViewTreeObserver viewTreeObserver = mTaskRecyclerView.getViewTreeObserver(); - viewTreeObserver.addOnGlobalLayoutListener( + mTaskRecyclerView.getViewTreeObserver().addOnGlobalLayoutListener( new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { animateFadeInLayoutAnimation(); - viewTreeObserver.removeOnGlobalLayoutListener(this); + mTaskRecyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this); } }); } |