diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index ee9c6a1e05..4966bf7964 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -140,6 +140,7 @@ import com.android.launcher3.util.ApplicationInfoWrapper; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.Executors; +import com.android.launcher3.util.MultiPropertyFactory; import com.android.launcher3.util.NavigationMode; import com.android.launcher3.util.RunnableList; import com.android.launcher3.util.SettingsCache; @@ -194,6 +195,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext { private WindowManager.LayoutParams mWindowLayoutParams; private WindowManager.LayoutParams mLastUpdatedLayoutParams; private boolean mIsFullscreen; + private boolean mIsNotificationShadeExpanded = false; // The size we should return to when we call setTaskbarWindowFullscreen(false) private int mLastRequestedNonFullscreenSize; /** @@ -1005,6 +1007,8 @@ public class TaskbarActivityContext extends BaseTaskbarContext { * Hides the taskbar icons and background when the notification shade is expanded. */ private void onNotificationShadeExpandChanged(boolean isExpanded, boolean skipAnim) { + boolean isExpandedUpdated = isExpanded != mIsNotificationShadeExpanded; + mIsNotificationShadeExpanded = isExpanded; // Close all floating views within the Taskbar window to make sure nothing is shown over // the notification shade. if (isExpanded) { @@ -1018,11 +1022,18 @@ public class TaskbarActivityContext extends BaseTaskbarContext { anim.play(mControllers.taskbarDragLayerController.getNotificationShadeBgTaskbar() .animateToValue(alpha)); - mControllers.bubbleControllers.ifPresent(controllers -> { - BubbleBarViewController bubbleBarViewController = controllers.bubbleBarViewController; - anim.play(bubbleBarViewController.getBubbleBarAlpha().get(0).animateToValue(alpha)); - }); - + if (isExpandedUpdated) { + mControllers.bubbleControllers.ifPresent(controllers -> { + BubbleBarViewController bubbleBarViewController = + controllers.bubbleBarViewController; + anim.play(bubbleBarViewController.getBubbleBarAlpha().get(0).animateToValue(alpha)); + MultiPropertyFactory.MultiProperty handleAlpha = + controllers.bubbleStashController.getHandleViewAlpha(); + if (handleAlpha != null) { + anim.play(handleAlpha.animateToValue(alpha)); + } + }); + } anim.start(); if (skipAnim) { anim.end(); diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/BubbleStashController.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/BubbleStashController.kt index 595dac3f32..fec1eaf55c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/BubbleStashController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/BubbleStashController.kt @@ -24,6 +24,7 @@ import com.android.launcher3.taskbar.TaskbarInsetsController import com.android.launcher3.taskbar.bubbles.BubbleBarView import com.android.launcher3.taskbar.bubbles.BubbleBarViewController import com.android.launcher3.taskbar.bubbles.BubbleStashedHandleViewController +import com.android.launcher3.util.MultiPropertyFactory import com.android.wm.shell.shared.animation.PhysicsAnimator import com.android.wm.shell.shared.bubbles.BubbleBarLocation import java.io.PrintWriter @@ -172,6 +173,9 @@ interface BubbleStashController { /** Returns bounds of the handle */ fun getHandleBounds(bounds: Rect) + /** Returns MultiValueAlpha of the handle view when the handle view is shown. */ + fun getHandleViewAlpha(): MultiPropertyFactory.MultiProperty? = null + /** * Returns bubble bar Y position according to [isBubblesShowingOnHome] and * [isBubblesShowingOnOverview] values. Default implementation only analyse 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 3e3f5692c9..9c148e2191 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt @@ -512,6 +512,14 @@ class TransientBubbleStashController( } } + override fun getHandleViewAlpha(): MultiPropertyFactory.MultiProperty? = + // only return handle alpha if the bubble bar is stashed and has bubbles + if (isStashed && bubbleBarViewController.hasBubbles()) { + stashHandleViewAlpha + } else { + null + } + private fun Animator.updateTouchRegionOnAnimationEnd(): Animator { doOnEnd { onIsStashedChanged() } return this 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 f642345b15..b24926beca 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 @@ -507,6 +507,45 @@ class TransientBubbleStashControllerTest { assertThat(height).isEqualTo(BUBBLE_BAR_HEIGHT) } + @Test + fun getHandleViewAlpha_stashedHasBubbles_alphaPropertyReturned() { + // Given BubbleBar is stashed and has bubbles + whenever(bubbleBarViewController.hasBubbles()).thenReturn(true) + mTransientBubbleStashController.isStashed = true + + // When handle view alpha property + val alphaProperty = mTransientBubbleStashController.getHandleViewAlpha() + + // Then the stash handle alpha property should not be null + assertThat(alphaProperty).isNotNull() + } + + @Test + fun getHandleViewAlpha_stashedHasNoBubblesBar_alphaPropertyIsNull() { + // Given BubbleBar is stashed and has no bubbles + whenever(bubbleBarViewController.hasBubbles()).thenReturn(false) + mTransientBubbleStashController.isStashed = true + + // When handle view alpha property + val alphaProperty = mTransientBubbleStashController.getHandleViewAlpha() + + // Then the stash handle alpha property should be null + assertThat(alphaProperty).isNull() + } + + @Test + fun getHandleViewAlpha_unstashedHasBubbles_alphaPropertyIsNull() { + // Given BubbleBar is not stashed and has bubbles + whenever(bubbleBarViewController.hasBubbles()).thenReturn(true) + mTransientBubbleStashController.isStashed = false + + // When handle view alpha property + val alphaProperty = mTransientBubbleStashController.getHandleViewAlpha() + + // Then the stash handle alpha property should be null + assertThat(alphaProperty).isNull() + } + private fun advanceTimeBy(advanceMs: Long) { // Advance animator for on-device tests getInstrumentation().runOnMainSync { animatorTestRule.advanceTimeBy(advanceMs) }