Loading packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/CommunalTransitionAnimatorControllerTest.kt +2 −1 Original line number Diff line number Diff line Loading @@ -14,13 +14,14 @@ * limitations under the License. */ package com.android.systemui.communal.widgets import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.animation.ActivityTransitionAnimator import com.android.systemui.communal.domain.interactor.communalSceneInteractor import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.communal.widgets.CommunalTransitionAnimatorController import com.android.systemui.coroutines.collectLastValue import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt +42 −2 Original line number Diff line number Diff line Loading @@ -146,6 +146,48 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { `when`(communalSceneInteractor.isLaunchingWidget).thenReturn(MutableStateFlow(false)) } @Test fun startActivityDismissingKeyguard_dismissShadeWhenOccluded_runAfterKeyguardGone() { val intent = mock(Intent::class.java) `when`(keyguardStateController.isShowing).thenReturn(true) `when`(keyguardStateController.isOccluded).thenReturn(true) `when`(communalSceneInteractor.isCommunalVisible).thenReturn(MutableStateFlow(true)) `when`(communalSettingsInteractor.isCommunalFlagEnabled()).thenReturn(false) underTest.startActivityDismissingKeyguard(intent, dismissShade = true) mainExecutor.runAllReady() val actionCaptor = argumentCaptor<OnDismissAction>() verify(statusBarKeyguardViewManager) .dismissWithAction(actionCaptor.capture(), any(), anyBoolean(), eq(null)) actionCaptor.firstValue.onDismiss() mainExecutor.runAllReady() verify(statusBarKeyguardViewManager).addAfterKeyguardGoneRunnable(any()) } @Test fun startActivityDismissingKeyguard_dismissShadeWhenOccluded_runImmediately() { val intent = mock(Intent::class.java) `when`(keyguardStateController.isShowing).thenReturn(true) `when`(keyguardStateController.isOccluded).thenReturn(true) `when`(communalSceneInteractor.isCommunalVisible).thenReturn(MutableStateFlow(true)) `when`(communalSettingsInteractor.isCommunalFlagEnabled()).thenReturn(true) underTest.startActivityDismissingKeyguard(intent, dismissShade = true) mainExecutor.runAllReady() val actionCaptor = argumentCaptor<OnDismissAction>() verify(statusBarKeyguardViewManager) .dismissWithAction(actionCaptor.capture(), any(), anyBoolean(), eq(null)) actionCaptor.firstValue.onDismiss() mainExecutor.runAllReady() verify(statusBarKeyguardViewManager, never()).addAfterKeyguardGoneRunnable(any()) verify(activityTransitionAnimator) .startIntentWithAnimation(eq(null), eq(false), eq(null), eq(false), any()) } @Test fun startPendingIntentDismissingKeyguard_keyguardShowing_dismissWithAction() { val pendingIntent = mock(PendingIntent::class.java) Loading Loading @@ -342,7 +384,6 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { ) } @EnableFlags(Flags.FLAG_COMMUNAL_HUB) @Test fun startPendingIntentDismissingKeyguard_transitionAnimator_animateCommunal() { val parent = FrameLayout(context) Loading Loading @@ -389,7 +430,6 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { ) } @DisableFlags(Flags.FLAG_COMMUNAL_HUB) @Test fun startPendingIntentDismissingKeyguard_transitionAnimator_doNotAnimateCommunal() { val parent = FrameLayout(context) Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImpl.kt +18 −4 Original line number Diff line number Diff line Loading @@ -208,10 +208,16 @@ constructor( val cancelRunnable = Runnable { callback?.onActivityStarted(ActivityManager.START_CANCELED) } // Do not deferKeyguard when occluded because, when keyguard is occluded, // we do not launch the activity until keyguard is done. // Do not deferKeyguard when occluded because, when keyguard is occluded, we do not launch // the activity until keyguard is done. The only exception is when we're on the Hub and want // to dismiss the shade immediately, which means that another animation will take care of // the transition. val occluded = (keyguardStateController.isShowing && keyguardStateController.isOccluded) val deferred = !occluded val dismissOnCommunal = communalSettingsInteractor.isCommunalFlagEnabled() && communalSceneInteractor.isCommunalVisible.value && dismissShadeDirectly val deferred = !occluded || dismissOnCommunal executeRunnableDismissingKeyguard( runnable, cancelRunnable, Loading Loading @@ -463,10 +469,18 @@ constructor( object : ActivityStarter.OnDismissAction { override fun onDismiss(): Boolean { if (runnable != null) { // We don't wait for Keyguard to be gone if we're dismissing the shade // immediately and we're on the Communal Hub. This is to make sure that the // Hub -> Edit Mode transition is seamless. val dismissOnCommunal = communalSettingsInteractor.isCommunalFlagEnabled() && communalSceneInteractor.isCommunalVisible.value && dismissShade if ( keyguardStateController.isShowing && keyguardStateController.isOccluded && !isCommunalWidgetLaunch() !isCommunalWidgetLaunch() && !dismissOnCommunal ) { statusBarKeyguardViewManagerLazy .get() Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/CommunalTransitionAnimatorControllerTest.kt +2 −1 Original line number Diff line number Diff line Loading @@ -14,13 +14,14 @@ * limitations under the License. */ package com.android.systemui.communal.widgets import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.animation.ActivityTransitionAnimator import com.android.systemui.communal.domain.interactor.communalSceneInteractor import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.communal.widgets.CommunalTransitionAnimatorController import com.android.systemui.coroutines.collectLastValue import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt +42 −2 Original line number Diff line number Diff line Loading @@ -146,6 +146,48 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { `when`(communalSceneInteractor.isLaunchingWidget).thenReturn(MutableStateFlow(false)) } @Test fun startActivityDismissingKeyguard_dismissShadeWhenOccluded_runAfterKeyguardGone() { val intent = mock(Intent::class.java) `when`(keyguardStateController.isShowing).thenReturn(true) `when`(keyguardStateController.isOccluded).thenReturn(true) `when`(communalSceneInteractor.isCommunalVisible).thenReturn(MutableStateFlow(true)) `when`(communalSettingsInteractor.isCommunalFlagEnabled()).thenReturn(false) underTest.startActivityDismissingKeyguard(intent, dismissShade = true) mainExecutor.runAllReady() val actionCaptor = argumentCaptor<OnDismissAction>() verify(statusBarKeyguardViewManager) .dismissWithAction(actionCaptor.capture(), any(), anyBoolean(), eq(null)) actionCaptor.firstValue.onDismiss() mainExecutor.runAllReady() verify(statusBarKeyguardViewManager).addAfterKeyguardGoneRunnable(any()) } @Test fun startActivityDismissingKeyguard_dismissShadeWhenOccluded_runImmediately() { val intent = mock(Intent::class.java) `when`(keyguardStateController.isShowing).thenReturn(true) `when`(keyguardStateController.isOccluded).thenReturn(true) `when`(communalSceneInteractor.isCommunalVisible).thenReturn(MutableStateFlow(true)) `when`(communalSettingsInteractor.isCommunalFlagEnabled()).thenReturn(true) underTest.startActivityDismissingKeyguard(intent, dismissShade = true) mainExecutor.runAllReady() val actionCaptor = argumentCaptor<OnDismissAction>() verify(statusBarKeyguardViewManager) .dismissWithAction(actionCaptor.capture(), any(), anyBoolean(), eq(null)) actionCaptor.firstValue.onDismiss() mainExecutor.runAllReady() verify(statusBarKeyguardViewManager, never()).addAfterKeyguardGoneRunnable(any()) verify(activityTransitionAnimator) .startIntentWithAnimation(eq(null), eq(false), eq(null), eq(false), any()) } @Test fun startPendingIntentDismissingKeyguard_keyguardShowing_dismissWithAction() { val pendingIntent = mock(PendingIntent::class.java) Loading Loading @@ -342,7 +384,6 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { ) } @EnableFlags(Flags.FLAG_COMMUNAL_HUB) @Test fun startPendingIntentDismissingKeyguard_transitionAnimator_animateCommunal() { val parent = FrameLayout(context) Loading Loading @@ -389,7 +430,6 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() { ) } @DisableFlags(Flags.FLAG_COMMUNAL_HUB) @Test fun startPendingIntentDismissingKeyguard_transitionAnimator_doNotAnimateCommunal() { val parent = FrameLayout(context) Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImpl.kt +18 −4 Original line number Diff line number Diff line Loading @@ -208,10 +208,16 @@ constructor( val cancelRunnable = Runnable { callback?.onActivityStarted(ActivityManager.START_CANCELED) } // Do not deferKeyguard when occluded because, when keyguard is occluded, // we do not launch the activity until keyguard is done. // Do not deferKeyguard when occluded because, when keyguard is occluded, we do not launch // the activity until keyguard is done. The only exception is when we're on the Hub and want // to dismiss the shade immediately, which means that another animation will take care of // the transition. val occluded = (keyguardStateController.isShowing && keyguardStateController.isOccluded) val deferred = !occluded val dismissOnCommunal = communalSettingsInteractor.isCommunalFlagEnabled() && communalSceneInteractor.isCommunalVisible.value && dismissShadeDirectly val deferred = !occluded || dismissOnCommunal executeRunnableDismissingKeyguard( runnable, cancelRunnable, Loading Loading @@ -463,10 +469,18 @@ constructor( object : ActivityStarter.OnDismissAction { override fun onDismiss(): Boolean { if (runnable != null) { // We don't wait for Keyguard to be gone if we're dismissing the shade // immediately and we're on the Communal Hub. This is to make sure that the // Hub -> Edit Mode transition is seamless. val dismissOnCommunal = communalSettingsInteractor.isCommunalFlagEnabled() && communalSceneInteractor.isCommunalVisible.value && dismissShade if ( keyguardStateController.isShowing && keyguardStateController.isOccluded && !isCommunalWidgetLaunch() !isCommunalWidgetLaunch() && !dismissOnCommunal ) { statusBarKeyguardViewManagerLazy .get() Loading