From c3b4263218ba52ab40e3fc116d7b84b2ace692fd Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Tue, 19 Nov 2024 11:50:45 -0500 Subject: [PATCH] Fix wrong bar state after swiping home Interrupt the animation when the user swipes home. When there are no bubbles the stashed state now keeps getting updated so that when a bubble is created we can correctly detect stash change events. Flag: com.android.wm.shell.enable_bubble_bar Fixes: 378967270 Test: manual - dismiss bubble bar - launch app - send bubble - swipe home during the animation - observe the bar does not stash at the end Change-Id: I2f054b7110af68f9637a4011a378ba35776b3771 --- .../bubbles/stashing/TransientBubbleStashController.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt index e62c0d4750..22d504f864 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt @@ -90,7 +90,10 @@ class TransientBubbleStashController( val hasBubbles = bubbleBarViewController.hasBubbles() bubbleBarViewController.onBubbleBarConfigurationChanged(hasBubbles) if (!hasBubbles) { - // if there are no bubbles, there's nothing to show, so just return. + // if there are no bubbles, there's no need to update the bubble bar, just keep the + // isStashed state up to date so that we can process state changes when bubbles are + // created. + isStashed = launcherState == BubbleLauncherState.IN_APP return } if (field == BubbleLauncherState.HOME) { @@ -486,10 +489,9 @@ class TransientBubbleStashController( val isStashed = stash && !isBubblesShowingOnHome && !isBubblesShowingOnOverview if (this.isStashed != isStashed) { this.isStashed = isStashed + // notify the view controller that the stash state is about to change so that it can // cancel an ongoing animation if there is one. - // note that this has to be called before updating mIsStashed with the new value, - // otherwise interrupting an ongoing animation may update it again with the wrong state bubbleBarViewController.onStashStateChanging() animator?.cancel() animator =