mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
If we're going to overview we might need to unstash
Flag: com.android.wm.shell.enable_bubble_bar
Test: atest NexusLauncherTests:PersistentBubbleStashControllerTest
Test: atest NexusLauncherTests:TransientBubbleStashControllerTest
Test: manual - swipe up to overview from home & from in an app, ensure
bubble bar is unstashed
- switch between home / overview / in app in transient
and persistent taskbar to make sure things work
Bug: 368364143
Change-Id: I34c22b000d1fcc75489ea6da497f14def9649a20
This commit is contained in:
@@ -27,6 +27,7 @@ import com.android.launcher3.anim.AnimatedFloat
|
||||
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.stashing.BubbleStashController.BubbleLauncherState
|
||||
import com.android.launcher3.util.MultiValueAlpha
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.Before
|
||||
@@ -85,12 +86,12 @@ class PersistentBubbleStashControllerTest {
|
||||
fun setBubblesShowingOnHomeUpdatedToFalse_barPositionYUpdated_controllersNotified() {
|
||||
// Given bubble bar is on home and has bubbles
|
||||
whenever(bubbleBarViewController.hasBubbles()).thenReturn(false)
|
||||
persistentTaskBarStashController.isBubblesShowingOnHome = true
|
||||
persistentTaskBarStashController.launcherState = BubbleLauncherState.HOME
|
||||
whenever(bubbleBarViewController.hasBubbles()).thenReturn(true)
|
||||
|
||||
// When switch out of the home screen
|
||||
getInstrumentation().runOnMainSync {
|
||||
persistentTaskBarStashController.isBubblesShowingOnHome = false
|
||||
persistentTaskBarStashController.launcherState = BubbleLauncherState.IN_APP
|
||||
}
|
||||
|
||||
// Then translation Y is animating and the bubble bar controller is notified
|
||||
@@ -110,7 +111,7 @@ class PersistentBubbleStashControllerTest {
|
||||
|
||||
// When switch to home screen
|
||||
getInstrumentation().runOnMainSync {
|
||||
persistentTaskBarStashController.isBubblesShowingOnHome = true
|
||||
persistentTaskBarStashController.launcherState = BubbleLauncherState.HOME
|
||||
}
|
||||
|
||||
// Then translation Y is animating and the bubble bar controller is notified
|
||||
@@ -127,11 +128,11 @@ class PersistentBubbleStashControllerTest {
|
||||
@Test
|
||||
fun setBubblesShowingOnOverviewUpdatedToFalse_controllersNotified() {
|
||||
// Given bubble bar is on overview
|
||||
persistentTaskBarStashController.isBubblesShowingOnOverview = true
|
||||
persistentTaskBarStashController.launcherState = BubbleLauncherState.OVERVIEW
|
||||
clearInvocations(bubbleBarViewController)
|
||||
|
||||
// When switch out of the overview screen
|
||||
persistentTaskBarStashController.isBubblesShowingOnOverview = false
|
||||
persistentTaskBarStashController.launcherState = BubbleLauncherState.IN_APP
|
||||
|
||||
// Then bubble bar controller is notified
|
||||
verify(bubbleBarViewController).onBubbleBarConfigurationChanged(/* animate= */ true)
|
||||
@@ -140,7 +141,7 @@ class PersistentBubbleStashControllerTest {
|
||||
@Test
|
||||
fun setBubblesShowingOnOverviewUpdatedToTrue_controllersNotified() {
|
||||
// When switch to the overview screen
|
||||
persistentTaskBarStashController.isBubblesShowingOnOverview = true
|
||||
persistentTaskBarStashController.launcherState = BubbleLauncherState.OVERVIEW
|
||||
|
||||
// Then bubble bar controller is notified
|
||||
verify(bubbleBarViewController).onBubbleBarConfigurationChanged(/* animate= */ true)
|
||||
@@ -150,7 +151,7 @@ class PersistentBubbleStashControllerTest {
|
||||
fun isSysuiLockedSwitchedToFalseForOverview_unlockAnimationIsShown() {
|
||||
// Given screen is locked and bubble bar has bubbles
|
||||
persistentTaskBarStashController.isSysuiLocked = true
|
||||
persistentTaskBarStashController.isBubblesShowingOnOverview = true
|
||||
persistentTaskBarStashController.launcherState = BubbleLauncherState.OVERVIEW
|
||||
whenever(bubbleBarViewController.hasBubbles()).thenReturn(true)
|
||||
|
||||
// When switch to the overview screen
|
||||
@@ -211,14 +212,14 @@ class PersistentBubbleStashControllerTest {
|
||||
fun bubbleBarTranslationYForTaskbar() {
|
||||
// Give bubble bar is on home
|
||||
whenever(bubbleBarViewController.hasBubbles()).thenReturn(false)
|
||||
persistentTaskBarStashController.isBubblesShowingOnHome = true
|
||||
persistentTaskBarStashController.launcherState = BubbleLauncherState.HOME
|
||||
|
||||
// Then bubbleBarTranslationY would be HOTSEAT_TRANSLATION_Y
|
||||
assertThat(persistentTaskBarStashController.bubbleBarTranslationY)
|
||||
.isEqualTo(HOTSEAT_TRANSLATION_Y)
|
||||
|
||||
// Give bubble bar is not on home
|
||||
persistentTaskBarStashController.isBubblesShowingOnHome = false
|
||||
persistentTaskBarStashController.launcherState = BubbleLauncherState.IN_APP
|
||||
|
||||
// Then bubbleBarTranslationY would be TASK_BAR_TRANSLATION_Y
|
||||
assertThat(persistentTaskBarStashController.bubbleBarTranslationY)
|
||||
|
||||
@@ -33,6 +33,7 @@ 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.taskbar.bubbles.BubbleView
|
||||
import com.android.launcher3.taskbar.bubbles.stashing.BubbleStashController.BubbleLauncherState
|
||||
import com.android.launcher3.util.MultiValueAlpha
|
||||
import com.android.wm.shell.shared.animation.PhysicsAnimator
|
||||
import com.android.wm.shell.shared.animation.PhysicsAnimatorTestUtils
|
||||
@@ -119,7 +120,7 @@ class TransientBubbleStashControllerTest {
|
||||
|
||||
// When switch out of the home screen
|
||||
getInstrumentation().runOnMainSync {
|
||||
mTransientBubbleStashController.isBubblesShowingOnHome = true
|
||||
mTransientBubbleStashController.launcherState = BubbleLauncherState.HOME
|
||||
}
|
||||
|
||||
// Then BubbleBarView is animating, BubbleBarViewController controller is notified
|
||||
@@ -137,12 +138,12 @@ class TransientBubbleStashControllerTest {
|
||||
|
||||
@Test
|
||||
fun setBubblesShowingOnOverviewUpdatedToTrue_barPositionYUpdated_controllersNotified() {
|
||||
// Given bubble bar is on home and has bubbles
|
||||
// Given bubble bar is on overview and has bubbles
|
||||
whenever(bubbleBarViewController.hasBubbles()).thenReturn(true)
|
||||
|
||||
// When switch out of the home screen
|
||||
getInstrumentation().runOnMainSync {
|
||||
mTransientBubbleStashController.isBubblesShowingOnOverview = true
|
||||
mTransientBubbleStashController.launcherState = BubbleLauncherState.OVERVIEW
|
||||
}
|
||||
|
||||
// Then BubbleBarView is animating, BubbleBarViewController controller is notified
|
||||
@@ -158,6 +159,27 @@ class TransientBubbleStashControllerTest {
|
||||
assertThat(bubbleBarView.translationY).isEqualTo(TASK_BAR_TRANSLATION_Y)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setBubblesShowingOnOverviewUpdatedToTrue_unstashes() {
|
||||
// Given bubble bar is stashed with bubbles
|
||||
whenever(bubbleBarViewController.hasBubbles()).thenReturn(true)
|
||||
|
||||
getInstrumentation().runOnMainSync {
|
||||
mTransientBubbleStashController.updateStashedAndExpandedState(
|
||||
stash = true,
|
||||
expand = false,
|
||||
)
|
||||
}
|
||||
assertThat(mTransientBubbleStashController.isStashed).isTrue()
|
||||
|
||||
// Move to overview
|
||||
getInstrumentation().runOnMainSync {
|
||||
mTransientBubbleStashController.launcherState = BubbleLauncherState.OVERVIEW
|
||||
}
|
||||
// No longer stashed in overview
|
||||
assertThat(mTransientBubbleStashController.isStashed).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun updateStashedAndExpandedState_stashAndCollapse_bubbleBarHidden_stashedHandleShown() {
|
||||
// Given bubble bar has bubbles and not stashed
|
||||
@@ -200,7 +222,7 @@ class TransientBubbleStashControllerTest {
|
||||
// Given screen is locked and bubble bar has bubbles
|
||||
getInstrumentation().runOnMainSync {
|
||||
mTransientBubbleStashController.isSysuiLocked = true
|
||||
mTransientBubbleStashController.isBubblesShowingOnOverview = true
|
||||
mTransientBubbleStashController.launcherState = BubbleLauncherState.OVERVIEW
|
||||
whenever(bubbleBarViewController.hasBubbles()).thenReturn(true)
|
||||
}
|
||||
advanceTimeBy(BubbleStashController.BAR_TRANSLATION_DURATION)
|
||||
|
||||
Reference in New Issue
Block a user