From 7f169c7c6da144f9912d7b121518c09dc4d608b2 Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Thu, 16 Mar 2023 13:27:51 -0700 Subject: [PATCH] Fix animation canceling crash bug (short swipe during split select) This patch fixes a bug where the user could cause a crash by making a gesture during the Overview > OverviewSplitSelect animation. Within Overview, the user is able to make an upward gesture from the bottom of screen to return to Home. However, if the gesture is very short, the user doesn't go back to Home and instead stays in Overview. Under normal situations this doesn't cause any problems. But if we are in the middle of an animation, the short gesture actually triggers an animation cancel followed by an immediate goToState() to the same state that it was already in. This causes problems with the OverviewSplitSelect transition because reset() is called in the middle, clearing important split select data and causing a crash. Fixed by changing a conditional to detect if we are this type of situation, and allowing the animation to play out in these cases. Fixes: 272793237 Test: Manual Change-Id: I4426204b9c8fc55853cf7df31a336ccaee2f5885 --- src/com/android/launcher3/statemanager/StateManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/com/android/launcher3/statemanager/StateManager.java b/src/com/android/launcher3/statemanager/StateManager.java index 89d89d6eca..198dad3c89 100644 --- a/src/com/android/launcher3/statemanager/StateManager.java +++ b/src/com/android/launcher3/statemanager/StateManager.java @@ -229,8 +229,10 @@ public class StateManager> { listener.onAnimationEnd(null); } return; - } else if (!mConfig.userControlled && animated && mConfig.targetState == state) { - // We are running the same animation as requested + } else if ((!mConfig.userControlled && animated && mConfig.targetState == state) + || mState.shouldPreserveDataStateOnReapply()) { + // We are running the same animation as requested, and/or target state should not be + // reset -- allow the current animation to complete instead of canceling it. if (listener != null) { mConfig.currentAnimation.addListener(listener); }