From 3f5d510b381c91fe83df72e543a6dcd95201bd24 Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Thu, 12 Jan 2023 13:33:27 +0800 Subject: [PATCH] Fix launcher crash by set divider hidden We will hide divider when isLikelyToStartNewTask become true, but this call sometime earlier than onRecentsAnimationStart then cause crash because mRecentsAnimationTargets is still null. Fix this by checking mRecentsAnimationTargets before set divider visibility. And also add new condition to hide divider to ensure it hidden if such case happened. Fix: 265238266 Test: manaul Test: pass existing tests Change-Id: I80b1294e69a52e7ac5255cd8e55e7c5e6a3dcbcb --- .../src/com/android/quickstep/AbsSwipeUpHandler.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 45f6742bb8..14b01fe7d1 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -324,6 +324,7 @@ public abstract class AbsSwipeUpHandler, // May be set to false when mIsTransientTaskbar is true. private boolean mCanSlowSwipeGoHome = true; private boolean mHasReachedOverviewThreshold = false; + private boolean mDividerHiddenBeforeAnimation = false; @Nullable private RemoteAnimationTargets.ReleaseCheck mSwipePipToHomeReleaseCheck = null; @@ -1677,7 +1678,8 @@ public abstract class AbsSwipeUpHandler, mRecentsAnimationController.enableInputConsumer(); // Start hiding the divider - if (!mIsTransientTaskbar || mTaskbarAlreadyOpen || mIsTaskbarAllAppsOpen) { + if (!mIsTransientTaskbar || mTaskbarAlreadyOpen || mIsTaskbarAllAppsOpen + || mDividerHiddenBeforeAnimation) { setDividerShown(false /* shown */, true /* immediate */); } } @@ -2327,6 +2329,12 @@ public abstract class AbsSwipeUpHandler, } private void setDividerShown(boolean shown, boolean immediate) { + if (mRecentsAnimationTargets == null) { + if (!shown) { + mDividerHiddenBeforeAnimation = true; + } + return; + } if (mDividerAnimator != null) { mDividerAnimator.cancel(); }