Loading quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +3 −23 Original line number Diff line number Diff line Loading @@ -124,8 +124,6 @@ public class BubbleBarView extends FrameLayout { private final BubbleBarBackground mBubbleBarBackground; private boolean mIsAnimatingNewBubble = false; /** * The current bounds of all the bubble bar. Note that these bounds may not account for * translation. The bounds should be retrieved using {@link #getBubbleBarBounds()} which Loading Loading @@ -714,16 +712,6 @@ public class BubbleBarView extends FrameLayout { return mRelativePivotY; } /** Notifies the bubble bar that a new bubble animation is starting. */ public void onAnimatingBubbleStarted() { mIsAnimatingNewBubble = true; } /** Notifies the bubble bar that a new bubble animation is complete. */ public void onAnimatingBubbleCompleted() { mIsAnimatingNewBubble = false; } /** Add a new bubble to the bubble bar. */ public void addBubble(BubbleView bubble) { FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams((int) mIconSize, (int) mIconSize, Loading Loading @@ -1353,9 +1341,7 @@ public class BubbleBarView extends FrameLayout { @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (mIsAnimatingNewBubble) { mController.onBubbleBarTouchedWhileAnimating(); } mController.onBubbleBarTouched(); if (!mIsBarExpanded) { // When the bar is collapsed, all taps on it should expand it. return true; Loading @@ -1363,11 +1349,6 @@ public class BubbleBarView extends FrameLayout { return super.onInterceptTouchEvent(ev); } /** Whether a new bubble is currently animating. */ public boolean isAnimatingNewBubble() { return mIsAnimatingNewBubble; } private boolean hasOverflow() { // Overflow is always the last bubble View lastChild = getChildAt(getChildCount() - 1); Loading Loading @@ -1500,7 +1481,6 @@ public class BubbleBarView extends FrameLayout { pw.println(" bubble key: " + key); } pw.println(" isExpanded: " + isExpanded()); pw.println(" mIsAnimatingNewBubble: " + mIsAnimatingNewBubble); if (mBubbleAnimator != null) { pw.println(" mBubbleAnimator.isRunning(): " + mBubbleAnimator.isRunning()); pw.println(" mBubbleAnimator is null"); Loading @@ -1525,8 +1505,8 @@ public class BubbleBarView extends FrameLayout { /** Returns the translation Y that the bubble bar should have. */ float getBubbleBarTranslationY(); /** Notifies the controller that the bubble bar was touched while it was animating. */ void onBubbleBarTouchedWhileAnimating(); /** Notifies the controller that the bubble bar was touched. */ void onBubbleBarTouched(); /** Requests the controller to expand bubble bar */ void expandBubbleBar(); Loading quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +14 −8 Original line number Diff line number Diff line Loading @@ -144,8 +144,8 @@ public class BubbleBarViewController { } @Override public void onBubbleBarTouchedWhileAnimating() { BubbleBarViewController.this.onBubbleBarTouchedWhileAnimating(); public void onBubbleBarTouched() { BubbleBarViewController.this.onBubbleBarTouched(); } @Override Loading Loading @@ -206,9 +206,12 @@ public class BubbleBarViewController { } } private void onBubbleBarTouchedWhileAnimating() { private void onBubbleBarTouched() { if (isAnimatingNewBubble()) { mBubbleBarViewAnimator.onBubbleBarTouchedWhileAnimating(); mBubbleStashController.onNewBubbleAnimationInterrupted(false, mBarView.getTranslationY()); mBubbleStashController.onNewBubbleAnimationInterrupted(false, mBarView.getTranslationY()); } } private void expandBubbleBar() { Loading Loading @@ -307,8 +310,11 @@ public class BubbleBarViewController { /** Whether a new bubble is animating. */ public boolean isAnimatingNewBubble() { return mBarView.isAnimatingNewBubble() || (mBubbleBarViewAnimator != null && mBubbleBarViewAnimator.hasAnimatingBubble()); return mBubbleBarViewAnimator != null && mBubbleBarViewAnimator.isAnimating(); } public boolean isNewBubbleAnimationRunningOrPending() { return mBubbleBarViewAnimator != null && mBubbleBarViewAnimator.hasAnimation(); } /** The horizontal margin of the bubble bar from the edge of the screen. */ Loading Loading @@ -652,7 +658,7 @@ public class BubbleBarViewController { * from SystemUI. */ public void setExpandedFromSysui(boolean isExpanded) { if (isAnimatingNewBubble() && isExpanded) { if (isNewBubbleAnimationRunningOrPending() && isExpanded) { mBubbleBarViewAnimator.expandedWhileAnimating(); return; } Loading quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt +7 −10 Original line number Diff line number Diff line Loading @@ -43,7 +43,13 @@ constructor( private val bubbleBarBounceDistanceInPx = bubbleBarView.resources.getDimensionPixelSize(R.dimen.bubblebar_bounce_distance) fun hasAnimatingBubble() = animatingBubble != null fun hasAnimation() = animatingBubble != null val isAnimating: Boolean get() { val animatingBubble = animatingBubble ?: return false return animatingBubble.state != AnimatingBubble.State.CREATED } private companion object { /** The time to show the flyout. */ Loading Loading @@ -157,7 +163,6 @@ constructor( private fun buildHandleToBubbleBarAnimation() = Runnable { moveToState(AnimatingBubble.State.ANIMATING_IN) // prepare the bubble bar for the animation bubbleBarView.onAnimatingBubbleStarted() bubbleBarView.visibility = VISIBLE bubbleBarView.alpha = 0f bubbleBarView.translationY = 0f Loading Loading @@ -304,7 +309,6 @@ constructor( animator.addEndListener { _, _, _, canceled, _, _, _ -> animatingBubble = null if (!canceled) bubbleStashController.stashBubbleBarImmediate() bubbleBarView.onAnimatingBubbleCompleted() bubbleBarView.relativePivotY = 1f bubbleStashController.updateTaskbarTouchRegion() } Loading @@ -330,7 +334,6 @@ constructor( Runnable { animatingBubble = null bubbleStashController.showBubbleBarImmediate() bubbleBarView.onAnimatingBubbleCompleted() bubbleStashController.updateTaskbarTouchRegion() } } Loading @@ -343,7 +346,6 @@ constructor( private fun buildBubbleBarSpringInAnimation() = Runnable { moveToState(AnimatingBubble.State.ANIMATING_IN) // prepare the bubble bar for the animation bubbleBarView.onAnimatingBubbleStarted() bubbleBarView.translationY = bubbleBarView.height.toFloat() bubbleBarView.visibility = VISIBLE bubbleBarView.alpha = 1f Loading Loading @@ -382,7 +384,6 @@ constructor( val hideAnimation = Runnable { animatingBubble = null bubbleStashController.showBubbleBarImmediate() bubbleBarView.onAnimatingBubbleCompleted() bubbleStashController.updateTaskbarTouchRegion() } animatingBubble = Loading @@ -398,7 +399,6 @@ constructor( */ private fun buildBubbleBarBounceAnimation() = Runnable { moveToState(AnimatingBubble.State.ANIMATING_IN) bubbleBarView.onAnimatingBubbleStarted() val ty = bubbleStashController.bubbleBarTranslationY val springBackAnimation = PhysicsAnimator.getInstance(bubbleBarView) Loading Loading @@ -429,7 +429,6 @@ constructor( bubbleStashController.getStashedHandlePhysicsAnimator().cancelIfRunning() val hideAnimation = animatingBubble?.hideAnimation ?: return scheduler.cancel(hideAnimation) bubbleBarView.onAnimatingBubbleCompleted() bubbleBarView.relativePivotY = 1f animatingBubble = null } Loading @@ -440,7 +439,6 @@ constructor( scheduler.cancel(hideAnimation) animatingBubble = null bubbleStashController.getStashedHandlePhysicsAnimator().cancelIfRunning() bubbleBarView.onAnimatingBubbleCompleted() bubbleBarView.relativePivotY = 1f bubbleStashController.onNewBubbleAnimationInterrupted( /* isStashed= */ bubbleBarView.alpha == 0f, Loading @@ -462,7 +460,6 @@ constructor( val hideAnimation = animatingBubble?.hideAnimation ?: return scheduler.cancel(hideAnimation) animatingBubble = null bubbleBarView.onAnimatingBubbleCompleted() bubbleBarView.relativePivotY = 1f bubbleStashController.showBubbleBarImmediate() } Loading quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt +33 −33 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ class BubbleBarViewAnimatorTest { assertThat(bubbleBarView.scaleX).isEqualTo(1) assertThat(bubbleBarView.scaleY).isEqualTo(1) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR) assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // execute the hide bubble animation assertThat(animatorScheduler.delayedBlock).isNotNull() Loading @@ -111,7 +111,7 @@ class BubbleBarViewAnimatorTest { assertThat(handle.alpha).isEqualTo(1) assertThat(handle.translationY).isEqualTo(0) assertThat(bubbleBarView.alpha).isEqualTo(0) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() verify(bubbleStashController).stashBubbleBarImmediate() } Loading Loading @@ -142,7 +142,7 @@ class BubbleBarViewAnimatorTest { assertThat(bubbleBarView.scaleX).isEqualTo(1) assertThat(bubbleBarView.scaleY).isEqualTo(1) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR) assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() verify(bubbleStashController, atLeastOnce()).updateTaskbarTouchRegion() Loading @@ -155,7 +155,7 @@ class BubbleBarViewAnimatorTest { assertThat(bubbleBarView.alpha).isEqualTo(1) assertThat(bubbleBarView.visibility).isEqualTo(VISIBLE) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() } @Test Loading @@ -179,7 +179,7 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilFirstAnimationFrameWhereTrue(handleAnimator) { true } handleAnimator.assertIsRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // verify the hide bubble animation is pending assertThat(animatorScheduler.delayedBlock).isNotNull() Loading @@ -189,7 +189,7 @@ class BubbleBarViewAnimatorTest { // verify that the hide animation was canceled assertThat(animatorScheduler.delayedBlock).isNull() assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() verify(bubbleStashController).onNewBubbleAnimationInterrupted(any(), any()) // PhysicsAnimatorTestUtils posts the cancellation to the main thread so we need to wait Loading Loading @@ -230,7 +230,7 @@ class BubbleBarViewAnimatorTest { animator.onStashStateChangingWhileAnimating() } assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() verify(bubbleStashController).onNewBubbleAnimationInterrupted(any(), any()) // PhysicsAnimatorTestUtils posts the cancellation to the main thread so we need to wait Loading Loading @@ -260,12 +260,12 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilFirstAnimationFrameWhereTrue(handleAnimator) { true } handleAnimator.assertIsRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() assertThat(animatorScheduler.delayedBlock).isNotNull() handleAnimator.cancel() handleAnimator.assertIsNotRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(animatorScheduler.delayedBlock).isNull() } Loading Loading @@ -296,7 +296,7 @@ class BubbleBarViewAnimatorTest { assertThat(bubbleBarView.scaleX).isEqualTo(1) assertThat(bubbleBarView.scaleY).isEqualTo(1) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.isExpanded).isTrue() // verify there is no hide animation Loading Loading @@ -326,7 +326,7 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilFirstAnimationFrameWhereTrue(handleAnimator) { true } handleAnimator.assertIsRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // verify the hide bubble animation is pending assertThat(animatorScheduler.delayedBlock).isNotNull() Loading @@ -344,7 +344,7 @@ class BubbleBarViewAnimatorTest { assertThat(handle.translationY) .isEqualTo(DIFF_BETWEEN_HANDLE_AND_BAR_CENTERS + BAR_TRANSLATION_Y_FOR_TASKBAR) verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_TASKBAR) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() } @Test Loading @@ -368,7 +368,7 @@ class BubbleBarViewAnimatorTest { // wait for the animation to end PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y) assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // verify the hide bubble animation is pending assertThat(animatorScheduler.delayedBlock).isNotNull() Loading @@ -383,7 +383,7 @@ class BubbleBarViewAnimatorTest { assertThat(handle.translationY) .isEqualTo(DIFF_BETWEEN_HANDLE_AND_BAR_CENTERS + BAR_TRANSLATION_Y_FOR_TASKBAR) verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_TASKBAR) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() } @Test Loading @@ -410,7 +410,7 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y) barAnimator.assertIsNotRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() assertThat(bubbleBarView.alpha).isEqualTo(1) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR) Loading @@ -421,7 +421,7 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y) InstrumentationRegistry.getInstrumentation().waitForIdleSync() assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.alpha).isEqualTo(0) assertThat(handle.translationY).isEqualTo(0) assertThat(handle.alpha).isEqualTo(1) Loading Loading @@ -453,7 +453,7 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y) barAnimator.assertIsNotRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.alpha).isEqualTo(1) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR) Loading Loading @@ -481,14 +481,14 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y) barAnimator.assertIsNotRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() assertThat(bubbleBarView.alpha).isEqualTo(1) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT) assertThat(animatorScheduler.delayedBlock).isNotNull() InstrumentationRegistry.getInstrumentation().runOnMainSync(animatorScheduler.delayedBlock!!) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.alpha).isEqualTo(1) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT) Loading Loading @@ -516,7 +516,7 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilFirstAnimationFrameWhereTrue(bubbleBarAnimator) { true } bubbleBarAnimator.assertIsRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // verify the hide bubble animation is pending assertThat(animatorScheduler.delayedBlock).isNotNull() Loading @@ -531,7 +531,7 @@ class BubbleBarViewAnimatorTest { assertThat(animatorScheduler.delayedBlock).isNull() verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_HOTSEAT) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() verify(bubbleStashController).showBubbleBarImmediate() } Loading @@ -553,7 +553,7 @@ class BubbleBarViewAnimatorTest { InstrumentationRegistry.getInstrumentation().runOnMainSync {} PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y) assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // verify the hide bubble animation is pending assertThat(animatorScheduler.delayedBlock).isNotNull() Loading @@ -565,7 +565,7 @@ class BubbleBarViewAnimatorTest { assertThat(animatorScheduler.delayedBlock).isNull() verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_HOTSEAT) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() } @Test Loading @@ -586,7 +586,7 @@ class BubbleBarViewAnimatorTest { InstrumentationRegistry.getInstrumentation().runOnMainSync {} // verify we started animating assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // advance the animation handler by the duration of the initial lift InstrumentationRegistry.getInstrumentation().runOnMainSync { Loading @@ -601,7 +601,7 @@ class BubbleBarViewAnimatorTest { assertThat(animatorScheduler.delayedBlock).isNotNull() InstrumentationRegistry.getInstrumentation().runOnMainSync(animatorScheduler.delayedBlock!!) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() // the bubble bar translation y should be back to its initial value assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT) Loading @@ -626,7 +626,7 @@ class BubbleBarViewAnimatorTest { InstrumentationRegistry.getInstrumentation().runOnMainSync {} // verify we started animating assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // advance the animation handler by the duration of the initial lift InstrumentationRegistry.getInstrumentation().runOnMainSync { Loading @@ -641,7 +641,7 @@ class BubbleBarViewAnimatorTest { // verify there is no hide animation assertThat(animatorScheduler.delayedBlock).isNull() assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT) assertThat(bubbleBarView.isExpanded).isTrue() verify(bubbleStashController).showBubbleBarImmediate() Loading @@ -665,7 +665,7 @@ class BubbleBarViewAnimatorTest { InstrumentationRegistry.getInstrumentation().runOnMainSync {} // verify we started animating assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // advance the animation handler by the duration of the initial lift InstrumentationRegistry.getInstrumentation().runOnMainSync { Loading @@ -679,7 +679,7 @@ class BubbleBarViewAnimatorTest { // verify there is a pending hide animation assertThat(animatorScheduler.delayedBlock).isNotNull() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() InstrumentationRegistry.getInstrumentation().runOnMainSync { animator.expandedWhileAnimating() Loading @@ -691,7 +691,7 @@ class BubbleBarViewAnimatorTest { // verify that the hide animation was canceled assertThat(animatorScheduler.delayedBlock).isNull() assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT) assertThat(bubbleBarView.isExpanded).isTrue() verify(bubbleStashController).showBubbleBarImmediate() Loading @@ -715,7 +715,7 @@ class BubbleBarViewAnimatorTest { InstrumentationRegistry.getInstrumentation().runOnMainSync {} // verify we started animating assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // advance the animation handler by the duration of the initial lift InstrumentationRegistry.getInstrumentation().runOnMainSync { Loading @@ -729,7 +729,7 @@ class BubbleBarViewAnimatorTest { // verify there is a pending hide animation assertThat(animatorScheduler.delayedBlock).isNotNull() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() InstrumentationRegistry.getInstrumentation().runOnMainSync { animator.expandedWhileAnimating() Loading @@ -738,7 +738,7 @@ class BubbleBarViewAnimatorTest { // verify that the hide animation was canceled assertThat(animatorScheduler.delayedBlock).isNull() assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT) assertThat(bubbleBarView.isExpanded).isTrue() verify(bubbleStashController).showBubbleBarImmediate() Loading Loading
quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +3 −23 Original line number Diff line number Diff line Loading @@ -124,8 +124,6 @@ public class BubbleBarView extends FrameLayout { private final BubbleBarBackground mBubbleBarBackground; private boolean mIsAnimatingNewBubble = false; /** * The current bounds of all the bubble bar. Note that these bounds may not account for * translation. The bounds should be retrieved using {@link #getBubbleBarBounds()} which Loading Loading @@ -714,16 +712,6 @@ public class BubbleBarView extends FrameLayout { return mRelativePivotY; } /** Notifies the bubble bar that a new bubble animation is starting. */ public void onAnimatingBubbleStarted() { mIsAnimatingNewBubble = true; } /** Notifies the bubble bar that a new bubble animation is complete. */ public void onAnimatingBubbleCompleted() { mIsAnimatingNewBubble = false; } /** Add a new bubble to the bubble bar. */ public void addBubble(BubbleView bubble) { FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams((int) mIconSize, (int) mIconSize, Loading Loading @@ -1353,9 +1341,7 @@ public class BubbleBarView extends FrameLayout { @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (mIsAnimatingNewBubble) { mController.onBubbleBarTouchedWhileAnimating(); } mController.onBubbleBarTouched(); if (!mIsBarExpanded) { // When the bar is collapsed, all taps on it should expand it. return true; Loading @@ -1363,11 +1349,6 @@ public class BubbleBarView extends FrameLayout { return super.onInterceptTouchEvent(ev); } /** Whether a new bubble is currently animating. */ public boolean isAnimatingNewBubble() { return mIsAnimatingNewBubble; } private boolean hasOverflow() { // Overflow is always the last bubble View lastChild = getChildAt(getChildCount() - 1); Loading Loading @@ -1500,7 +1481,6 @@ public class BubbleBarView extends FrameLayout { pw.println(" bubble key: " + key); } pw.println(" isExpanded: " + isExpanded()); pw.println(" mIsAnimatingNewBubble: " + mIsAnimatingNewBubble); if (mBubbleAnimator != null) { pw.println(" mBubbleAnimator.isRunning(): " + mBubbleAnimator.isRunning()); pw.println(" mBubbleAnimator is null"); Loading @@ -1525,8 +1505,8 @@ public class BubbleBarView extends FrameLayout { /** Returns the translation Y that the bubble bar should have. */ float getBubbleBarTranslationY(); /** Notifies the controller that the bubble bar was touched while it was animating. */ void onBubbleBarTouchedWhileAnimating(); /** Notifies the controller that the bubble bar was touched. */ void onBubbleBarTouched(); /** Requests the controller to expand bubble bar */ void expandBubbleBar(); Loading
quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +14 −8 Original line number Diff line number Diff line Loading @@ -144,8 +144,8 @@ public class BubbleBarViewController { } @Override public void onBubbleBarTouchedWhileAnimating() { BubbleBarViewController.this.onBubbleBarTouchedWhileAnimating(); public void onBubbleBarTouched() { BubbleBarViewController.this.onBubbleBarTouched(); } @Override Loading Loading @@ -206,9 +206,12 @@ public class BubbleBarViewController { } } private void onBubbleBarTouchedWhileAnimating() { private void onBubbleBarTouched() { if (isAnimatingNewBubble()) { mBubbleBarViewAnimator.onBubbleBarTouchedWhileAnimating(); mBubbleStashController.onNewBubbleAnimationInterrupted(false, mBarView.getTranslationY()); mBubbleStashController.onNewBubbleAnimationInterrupted(false, mBarView.getTranslationY()); } } private void expandBubbleBar() { Loading Loading @@ -307,8 +310,11 @@ public class BubbleBarViewController { /** Whether a new bubble is animating. */ public boolean isAnimatingNewBubble() { return mBarView.isAnimatingNewBubble() || (mBubbleBarViewAnimator != null && mBubbleBarViewAnimator.hasAnimatingBubble()); return mBubbleBarViewAnimator != null && mBubbleBarViewAnimator.isAnimating(); } public boolean isNewBubbleAnimationRunningOrPending() { return mBubbleBarViewAnimator != null && mBubbleBarViewAnimator.hasAnimation(); } /** The horizontal margin of the bubble bar from the edge of the screen. */ Loading Loading @@ -652,7 +658,7 @@ public class BubbleBarViewController { * from SystemUI. */ public void setExpandedFromSysui(boolean isExpanded) { if (isAnimatingNewBubble() && isExpanded) { if (isNewBubbleAnimationRunningOrPending() && isExpanded) { mBubbleBarViewAnimator.expandedWhileAnimating(); return; } Loading
quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt +7 −10 Original line number Diff line number Diff line Loading @@ -43,7 +43,13 @@ constructor( private val bubbleBarBounceDistanceInPx = bubbleBarView.resources.getDimensionPixelSize(R.dimen.bubblebar_bounce_distance) fun hasAnimatingBubble() = animatingBubble != null fun hasAnimation() = animatingBubble != null val isAnimating: Boolean get() { val animatingBubble = animatingBubble ?: return false return animatingBubble.state != AnimatingBubble.State.CREATED } private companion object { /** The time to show the flyout. */ Loading Loading @@ -157,7 +163,6 @@ constructor( private fun buildHandleToBubbleBarAnimation() = Runnable { moveToState(AnimatingBubble.State.ANIMATING_IN) // prepare the bubble bar for the animation bubbleBarView.onAnimatingBubbleStarted() bubbleBarView.visibility = VISIBLE bubbleBarView.alpha = 0f bubbleBarView.translationY = 0f Loading Loading @@ -304,7 +309,6 @@ constructor( animator.addEndListener { _, _, _, canceled, _, _, _ -> animatingBubble = null if (!canceled) bubbleStashController.stashBubbleBarImmediate() bubbleBarView.onAnimatingBubbleCompleted() bubbleBarView.relativePivotY = 1f bubbleStashController.updateTaskbarTouchRegion() } Loading @@ -330,7 +334,6 @@ constructor( Runnable { animatingBubble = null bubbleStashController.showBubbleBarImmediate() bubbleBarView.onAnimatingBubbleCompleted() bubbleStashController.updateTaskbarTouchRegion() } } Loading @@ -343,7 +346,6 @@ constructor( private fun buildBubbleBarSpringInAnimation() = Runnable { moveToState(AnimatingBubble.State.ANIMATING_IN) // prepare the bubble bar for the animation bubbleBarView.onAnimatingBubbleStarted() bubbleBarView.translationY = bubbleBarView.height.toFloat() bubbleBarView.visibility = VISIBLE bubbleBarView.alpha = 1f Loading Loading @@ -382,7 +384,6 @@ constructor( val hideAnimation = Runnable { animatingBubble = null bubbleStashController.showBubbleBarImmediate() bubbleBarView.onAnimatingBubbleCompleted() bubbleStashController.updateTaskbarTouchRegion() } animatingBubble = Loading @@ -398,7 +399,6 @@ constructor( */ private fun buildBubbleBarBounceAnimation() = Runnable { moveToState(AnimatingBubble.State.ANIMATING_IN) bubbleBarView.onAnimatingBubbleStarted() val ty = bubbleStashController.bubbleBarTranslationY val springBackAnimation = PhysicsAnimator.getInstance(bubbleBarView) Loading Loading @@ -429,7 +429,6 @@ constructor( bubbleStashController.getStashedHandlePhysicsAnimator().cancelIfRunning() val hideAnimation = animatingBubble?.hideAnimation ?: return scheduler.cancel(hideAnimation) bubbleBarView.onAnimatingBubbleCompleted() bubbleBarView.relativePivotY = 1f animatingBubble = null } Loading @@ -440,7 +439,6 @@ constructor( scheduler.cancel(hideAnimation) animatingBubble = null bubbleStashController.getStashedHandlePhysicsAnimator().cancelIfRunning() bubbleBarView.onAnimatingBubbleCompleted() bubbleBarView.relativePivotY = 1f bubbleStashController.onNewBubbleAnimationInterrupted( /* isStashed= */ bubbleBarView.alpha == 0f, Loading @@ -462,7 +460,6 @@ constructor( val hideAnimation = animatingBubble?.hideAnimation ?: return scheduler.cancel(hideAnimation) animatingBubble = null bubbleBarView.onAnimatingBubbleCompleted() bubbleBarView.relativePivotY = 1f bubbleStashController.showBubbleBarImmediate() } Loading
quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt +33 −33 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ class BubbleBarViewAnimatorTest { assertThat(bubbleBarView.scaleX).isEqualTo(1) assertThat(bubbleBarView.scaleY).isEqualTo(1) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR) assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // execute the hide bubble animation assertThat(animatorScheduler.delayedBlock).isNotNull() Loading @@ -111,7 +111,7 @@ class BubbleBarViewAnimatorTest { assertThat(handle.alpha).isEqualTo(1) assertThat(handle.translationY).isEqualTo(0) assertThat(bubbleBarView.alpha).isEqualTo(0) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() verify(bubbleStashController).stashBubbleBarImmediate() } Loading Loading @@ -142,7 +142,7 @@ class BubbleBarViewAnimatorTest { assertThat(bubbleBarView.scaleX).isEqualTo(1) assertThat(bubbleBarView.scaleY).isEqualTo(1) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR) assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() verify(bubbleStashController, atLeastOnce()).updateTaskbarTouchRegion() Loading @@ -155,7 +155,7 @@ class BubbleBarViewAnimatorTest { assertThat(bubbleBarView.alpha).isEqualTo(1) assertThat(bubbleBarView.visibility).isEqualTo(VISIBLE) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() } @Test Loading @@ -179,7 +179,7 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilFirstAnimationFrameWhereTrue(handleAnimator) { true } handleAnimator.assertIsRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // verify the hide bubble animation is pending assertThat(animatorScheduler.delayedBlock).isNotNull() Loading @@ -189,7 +189,7 @@ class BubbleBarViewAnimatorTest { // verify that the hide animation was canceled assertThat(animatorScheduler.delayedBlock).isNull() assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() verify(bubbleStashController).onNewBubbleAnimationInterrupted(any(), any()) // PhysicsAnimatorTestUtils posts the cancellation to the main thread so we need to wait Loading Loading @@ -230,7 +230,7 @@ class BubbleBarViewAnimatorTest { animator.onStashStateChangingWhileAnimating() } assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() verify(bubbleStashController).onNewBubbleAnimationInterrupted(any(), any()) // PhysicsAnimatorTestUtils posts the cancellation to the main thread so we need to wait Loading Loading @@ -260,12 +260,12 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilFirstAnimationFrameWhereTrue(handleAnimator) { true } handleAnimator.assertIsRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() assertThat(animatorScheduler.delayedBlock).isNotNull() handleAnimator.cancel() handleAnimator.assertIsNotRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(animatorScheduler.delayedBlock).isNull() } Loading Loading @@ -296,7 +296,7 @@ class BubbleBarViewAnimatorTest { assertThat(bubbleBarView.scaleX).isEqualTo(1) assertThat(bubbleBarView.scaleY).isEqualTo(1) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.isExpanded).isTrue() // verify there is no hide animation Loading Loading @@ -326,7 +326,7 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilFirstAnimationFrameWhereTrue(handleAnimator) { true } handleAnimator.assertIsRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // verify the hide bubble animation is pending assertThat(animatorScheduler.delayedBlock).isNotNull() Loading @@ -344,7 +344,7 @@ class BubbleBarViewAnimatorTest { assertThat(handle.translationY) .isEqualTo(DIFF_BETWEEN_HANDLE_AND_BAR_CENTERS + BAR_TRANSLATION_Y_FOR_TASKBAR) verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_TASKBAR) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() } @Test Loading @@ -368,7 +368,7 @@ class BubbleBarViewAnimatorTest { // wait for the animation to end PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y) assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // verify the hide bubble animation is pending assertThat(animatorScheduler.delayedBlock).isNotNull() Loading @@ -383,7 +383,7 @@ class BubbleBarViewAnimatorTest { assertThat(handle.translationY) .isEqualTo(DIFF_BETWEEN_HANDLE_AND_BAR_CENTERS + BAR_TRANSLATION_Y_FOR_TASKBAR) verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_TASKBAR) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() } @Test Loading @@ -410,7 +410,7 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y) barAnimator.assertIsNotRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() assertThat(bubbleBarView.alpha).isEqualTo(1) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR) Loading @@ -421,7 +421,7 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y) InstrumentationRegistry.getInstrumentation().waitForIdleSync() assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.alpha).isEqualTo(0) assertThat(handle.translationY).isEqualTo(0) assertThat(handle.alpha).isEqualTo(1) Loading Loading @@ -453,7 +453,7 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y) barAnimator.assertIsNotRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.alpha).isEqualTo(1) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_TASKBAR) Loading Loading @@ -481,14 +481,14 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y) barAnimator.assertIsNotRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() assertThat(bubbleBarView.alpha).isEqualTo(1) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT) assertThat(animatorScheduler.delayedBlock).isNotNull() InstrumentationRegistry.getInstrumentation().runOnMainSync(animatorScheduler.delayedBlock!!) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.alpha).isEqualTo(1) assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT) Loading Loading @@ -516,7 +516,7 @@ class BubbleBarViewAnimatorTest { PhysicsAnimatorTestUtils.blockUntilFirstAnimationFrameWhereTrue(bubbleBarAnimator) { true } bubbleBarAnimator.assertIsRunning() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // verify the hide bubble animation is pending assertThat(animatorScheduler.delayedBlock).isNotNull() Loading @@ -531,7 +531,7 @@ class BubbleBarViewAnimatorTest { assertThat(animatorScheduler.delayedBlock).isNull() verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_HOTSEAT) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() verify(bubbleStashController).showBubbleBarImmediate() } Loading @@ -553,7 +553,7 @@ class BubbleBarViewAnimatorTest { InstrumentationRegistry.getInstrumentation().runOnMainSync {} PhysicsAnimatorTestUtils.blockUntilAnimationsEnd(DynamicAnimation.TRANSLATION_Y) assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // verify the hide bubble animation is pending assertThat(animatorScheduler.delayedBlock).isNotNull() Loading @@ -565,7 +565,7 @@ class BubbleBarViewAnimatorTest { assertThat(animatorScheduler.delayedBlock).isNull() verifyBubbleBarIsExpandedWithTranslation(BAR_TRANSLATION_Y_FOR_HOTSEAT) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() } @Test Loading @@ -586,7 +586,7 @@ class BubbleBarViewAnimatorTest { InstrumentationRegistry.getInstrumentation().runOnMainSync {} // verify we started animating assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // advance the animation handler by the duration of the initial lift InstrumentationRegistry.getInstrumentation().runOnMainSync { Loading @@ -601,7 +601,7 @@ class BubbleBarViewAnimatorTest { assertThat(animatorScheduler.delayedBlock).isNotNull() InstrumentationRegistry.getInstrumentation().runOnMainSync(animatorScheduler.delayedBlock!!) assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() // the bubble bar translation y should be back to its initial value assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT) Loading @@ -626,7 +626,7 @@ class BubbleBarViewAnimatorTest { InstrumentationRegistry.getInstrumentation().runOnMainSync {} // verify we started animating assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // advance the animation handler by the duration of the initial lift InstrumentationRegistry.getInstrumentation().runOnMainSync { Loading @@ -641,7 +641,7 @@ class BubbleBarViewAnimatorTest { // verify there is no hide animation assertThat(animatorScheduler.delayedBlock).isNull() assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT) assertThat(bubbleBarView.isExpanded).isTrue() verify(bubbleStashController).showBubbleBarImmediate() Loading @@ -665,7 +665,7 @@ class BubbleBarViewAnimatorTest { InstrumentationRegistry.getInstrumentation().runOnMainSync {} // verify we started animating assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // advance the animation handler by the duration of the initial lift InstrumentationRegistry.getInstrumentation().runOnMainSync { Loading @@ -679,7 +679,7 @@ class BubbleBarViewAnimatorTest { // verify there is a pending hide animation assertThat(animatorScheduler.delayedBlock).isNotNull() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() InstrumentationRegistry.getInstrumentation().runOnMainSync { animator.expandedWhileAnimating() Loading @@ -691,7 +691,7 @@ class BubbleBarViewAnimatorTest { // verify that the hide animation was canceled assertThat(animatorScheduler.delayedBlock).isNull() assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT) assertThat(bubbleBarView.isExpanded).isTrue() verify(bubbleStashController).showBubbleBarImmediate() Loading @@ -715,7 +715,7 @@ class BubbleBarViewAnimatorTest { InstrumentationRegistry.getInstrumentation().runOnMainSync {} // verify we started animating assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() // advance the animation handler by the duration of the initial lift InstrumentationRegistry.getInstrumentation().runOnMainSync { Loading @@ -729,7 +729,7 @@ class BubbleBarViewAnimatorTest { // verify there is a pending hide animation assertThat(animatorScheduler.delayedBlock).isNotNull() assertThat(bubbleBarView.isAnimatingNewBubble).isTrue() assertThat(animator.isAnimating).isTrue() InstrumentationRegistry.getInstrumentation().runOnMainSync { animator.expandedWhileAnimating() Loading @@ -738,7 +738,7 @@ class BubbleBarViewAnimatorTest { // verify that the hide animation was canceled assertThat(animatorScheduler.delayedBlock).isNull() assertThat(bubbleBarView.isAnimatingNewBubble).isFalse() assertThat(animator.isAnimating).isFalse() assertThat(bubbleBarView.translationY).isEqualTo(BAR_TRANSLATION_Y_FOR_HOTSEAT) assertThat(bubbleBarView.isExpanded).isTrue() verify(bubbleStashController).showBubbleBarImmediate() Loading