From 416f80dc822c98acc52bb1413abc83c9105c593a Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Thu, 24 Apr 2025 09:36:08 -0700 Subject: [PATCH] Rename method to set bubble bar expanded state [1/N] Rename methods in BubbleBarViewController and BubbleBarView that set the expanded state. These will update the state using an animation. Update the name to highlight this. Enables us to create methods to set the state without animation. Bug: 357115534 Test: refactor, presubmit Flag: com.android.wm.shell.enable_bubble_bar Change-Id: I9d2c46ab1640ab0b19f54103ab8cdb37a5d19dbb --- .../taskbar/bubbles/BubbleBarView.java | 4 +-- .../bubbles/BubbleBarViewController.java | 28 +++++++++---------- .../animation/BubbleBarViewAnimator.kt | 2 +- .../PersistentBubbleStashController.kt | 2 +- .../TransientBubbleStashController.kt | 4 +-- .../bubbles/BubbleBarViewScreenshotTest.kt | 2 +- .../taskbar/TaskbarStashControllerTest.kt | 2 +- .../PersistentBubbleStashControllerTest.kt | 6 ++-- .../TransientBubbleStashControllerTest.kt | 6 ++-- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java index 5dbd4c1ce2..f104d93094 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java @@ -1309,9 +1309,9 @@ public class BubbleBarView extends FrameLayout { } /** - * Sets whether the bubble bar is expanded or collapsed. + * Update bubble bar expanded state with animation. */ - public void setExpanded(boolean isBarExpanded) { + public void animateExpanded(boolean isBarExpanded) { if (mIsBarExpanded != isBarExpanded) { mIsBarExpanded = isBarExpanded; updateArrowForSelected(/* shouldAnimate= */ false); diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index 03586c80c6..c74140a8fe 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -266,7 +266,7 @@ public class BubbleBarViewController { if (!mBubbleStashController.isTransientTaskBar()) { // TODO(b/380274085) for transient taskbar mode, the click is also handled by the input // consumer. This check can be removed once b/380274085 is fixed. - mBarView.setOnClickListener(v -> setExpanded(!mBarView.isExpanded())); + mBarView.setOnClickListener(v -> animateExpanded(!mBarView.isExpanded())); } mBarView.addOnLayoutChangeListener( (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { @@ -299,7 +299,7 @@ public class BubbleBarViewController { @Override public void expandBubbleBar() { - BubbleBarViewController.this.setExpanded( + BubbleBarViewController.this.animateExpanded( /* isExpanded= */ true, /* maybeShowEdu*/ true); } @@ -433,7 +433,7 @@ public class BubbleBarViewController { @Override public void flyoutClicked() { interruptAnimationForTouch(); - setExpanded(/* isExpanded= */ true, /* maybeShowEdu*/ true); + animateExpanded(/* isExpanded= */ true, /* maybeShowEdu*/ true); } }; } @@ -471,7 +471,7 @@ public class BubbleBarViewController { } private void collapseBubbleBar() { - setExpanded(false); + animateExpanded(false); mBubbleStashController.stashBubbleBar(); } @@ -816,7 +816,7 @@ public class BubbleBarViewController { if (hidden) { mBarView.dismiss(() -> { updateVisibilityForStateChange(); - mBarView.setExpanded(false); + mBarView.animateExpanded(false); adjustTaskbarAndHotseatToBubbleBarState(/* isBubbleBarExpanded= */ false); mActivity.bubbleBarVisibilityChanged(/* isVisible= */ false); }); @@ -1234,27 +1234,27 @@ public class BubbleBarViewController { mBarView.setSelectedBubble(newlySelected.getView()); } - /** @see #setExpanded(boolean, boolean) */ - public void setExpanded(boolean isExpanded) { - setExpanded(isExpanded, /* maybeShowEdu= */ false); + /** @see #animateExpanded(boolean, boolean) */ + public void animateExpanded(boolean isExpanded) { + animateExpanded(isExpanded, /* maybeShowEdu= */ false); } /** - * Sets whether the bubble bar should be expanded (not unstashed, but have the contents - * within it expanded). This method notifies SystemUI that the bubble bar is expanded and - * showing a selected bubble. This method should ONLY be called from UI events originating - * from Launcher. + * Sets whether the bubble bar should be animated to expanded state (not unstashed, but have + * the contents within it expanded). This method notifies SystemUI that the bubble bar is + * expanded and showing a selected bubble. This method should ONLY be called from UI events + * originating from Launcher. * * @param isExpanded whether the bar should be expanded * @param maybeShowEdu whether we should show the edu view before expanding */ - public void setExpanded(boolean isExpanded, boolean maybeShowEdu) { + public void animateExpanded(boolean isExpanded, boolean maybeShowEdu) { // if we're trying to expand try showing the edu view instead if (maybeShowEdu && isExpanded && !mBarView.isExpanded() && maybeShowEduView()) { return; } if (!mBubbleBarPinning.isAnimating() && isExpanded != mBarView.isExpanded()) { - mBarView.setExpanded(isExpanded); + mBarView.animateExpanded(isExpanded); adjustTaskbarAndHotseatToBubbleBarState(isExpanded); if (!isExpanded) { mSystemUiProxy.collapseBubbles(); diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt index 0da8c1fb81..76dacd21e5 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt @@ -728,7 +728,7 @@ constructor( } private fun expandBubbleBar() { - bubbleBarView.isExpanded = true + bubbleBarView.animateExpanded(true) onExpanded.run() } diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashController.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashController.kt index 9d8c0ed970..319bf1a5d2 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashController.kt @@ -238,7 +238,7 @@ class PersistentBubbleStashController( } if (bubbleBarViewController.isExpanded != expand) { val maybeShowEdu = expand && bubbleBarGesture - bubbleBarViewController.setExpanded(expand, maybeShowEdu) + bubbleBarViewController.animateExpanded(expand, maybeShowEdu) } } 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 fd6155c1c2..ad7a3813b0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt @@ -468,7 +468,7 @@ class TransientBubbleStashController( // reset stash translation translationYDuringStash.updateValue(0f) bubbleBarBubbleTranslationY.updateValue(0f) - bubbleBarViewController.isExpanded = false + bubbleBarViewController.animateExpanded(false) } taskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged() } @@ -578,7 +578,7 @@ class TransientBubbleStashController( } if (bubbleBarViewController.isExpanded != expand) { val maybeShowEdu = expand && bubbleBarGesture - bubbleBarViewController.setExpanded(expand, maybeShowEdu) + bubbleBarViewController.animateExpanded(expand, maybeShowEdu) } } diff --git a/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewScreenshotTest.kt b/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewScreenshotTest.kt index b6ceb5f6b2..a206d4e18b 100644 --- a/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewScreenshotTest.kt +++ b/quickstep/tests/multivalentScreenshotTests/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewScreenshotTest.kt @@ -113,7 +113,7 @@ class BubbleBarViewScreenshotTest(emulationSpec: DeviceEmulationSpec) { val lp = FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT) container.layoutParams = lp container.addView(bubbleBarView) - bubbleBarView.isExpanded = true + bubbleBarView.animateExpanded(true) container } } diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarStashControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarStashControllerTest.kt index 021e1e417c..96beafff49 100644 --- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarStashControllerTest.kt +++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/TaskbarStashControllerTest.kt @@ -468,7 +468,7 @@ class TaskbarStashControllerTest { fun testUpdateAndAnimateTransientTaskbar_bubbleBarExpandedBeforeTimeout_expandedAfterwards() { getInstrumentation().runOnMainSync { bubbleBarViewController.setHiddenForBubbles(false) - bubbleBarViewController.isExpanded = true + bubbleBarViewController.animateExpanded(true) stashController.updateAndAnimateTransientTaskbar(false) animatorTestRule.advanceTimeBy(stashController.stashDuration) } diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashControllerTest.kt index bfc9b9f5f4..4f88ec1544 100644 --- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashControllerTest.kt +++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/PersistentBubbleStashControllerTest.kt @@ -354,7 +354,7 @@ class PersistentBubbleStashControllerTest { bubbleBarGesture = true, ) - verify(bubbleBarViewController).setExpanded(true, true) + verify(bubbleBarViewController).animateExpanded(true, true) } @Test @@ -367,7 +367,7 @@ class PersistentBubbleStashControllerTest { bubbleBarGesture = false, ) - verify(bubbleBarViewController).setExpanded(true, false) + verify(bubbleBarViewController).animateExpanded(true, false) } @Test @@ -380,7 +380,7 @@ class PersistentBubbleStashControllerTest { bubbleBarGesture = true, ) - verify(bubbleBarViewController, never()).setExpanded(any(), any()) + verify(bubbleBarViewController, never()).animateExpanded(any(), any()) } private fun advanceTimeBy(advanceMs: Long) { diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashControllerTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashControllerTest.kt index 42a667b35b..c721af0a0f 100644 --- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashControllerTest.kt +++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashControllerTest.kt @@ -376,7 +376,7 @@ class TransientBubbleStashControllerTest { ) } - verify(bubbleBarViewController).setExpanded(true, true) + verify(bubbleBarViewController).animateExpanded(true, true) } @Test @@ -393,7 +393,7 @@ class TransientBubbleStashControllerTest { ) } - verify(bubbleBarViewController).setExpanded(true, false) + verify(bubbleBarViewController).animateExpanded(true, false) } @Test @@ -410,7 +410,7 @@ class TransientBubbleStashControllerTest { ) } - verify(bubbleBarViewController, never()).setExpanded(any(), any()) + verify(bubbleBarViewController, never()).animateExpanded(any(), any()) } @Test