Loading packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/ui/controller/KeyguardMediaControllerTest.kt +3 −26 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.media.controls.ui.controller import android.provider.Settings import android.testing.TestableLooper import android.view.View.GONE import android.view.View.VISIBLE Loading Loading @@ -88,7 +87,7 @@ class KeyguardMediaControllerTest : SysuiTestCase() { configurationController, ResourcesSplitShadeStateController(), mock<KeyguardMediaControllerLogger>(), mock<DumpManager>() mock<DumpManager>(), ) keyguardMediaController.attachSinglePaneContainer(mediaContainerView) keyguardMediaController.useSplitShade = false Loading Loading @@ -142,7 +141,7 @@ class KeyguardMediaControllerTest : SysuiTestCase() { assertTrue( "HostView wasn't attached to the split pane container", splitShadeContainer.childCount == 1 splitShadeContainer.childCount == 1, ) } Loading @@ -153,7 +152,7 @@ class KeyguardMediaControllerTest : SysuiTestCase() { assertTrue( "HostView wasn't attached to the single pane container", mediaContainerView.childCount == 1 mediaContainerView.childCount == 1, ) } Loading @@ -173,17 +172,6 @@ class KeyguardMediaControllerTest : SysuiTestCase() { assertThat(splitShadeContainer.visibility).isEqualTo(GONE) } @Test fun dozeWakeUpAnimationWaiting_inSplitShade_mediaIsHidden() { val splitShadeContainer = FrameLayout(context) keyguardMediaController.attachSplitShadeContainer(splitShadeContainer) keyguardMediaController.useSplitShade = true keyguardMediaController.isDozeWakeUpAnimationWaiting = true assertThat(splitShadeContainer.visibility).isEqualTo(GONE) } @Test fun dozing_inSingleShade_mediaIsVisible() { val splitShadeContainer = FrameLayout(context) Loading @@ -195,17 +183,6 @@ class KeyguardMediaControllerTest : SysuiTestCase() { assertThat(mediaContainerView.visibility).isEqualTo(VISIBLE) } @Test fun dozeWakeUpAnimationWaiting_inSingleShade_mediaIsVisible() { val splitShadeContainer = FrameLayout(context) keyguardMediaController.attachSplitShadeContainer(splitShadeContainer) keyguardMediaController.useSplitShade = false keyguardMediaController.isDozeWakeUpAnimationWaiting = true assertThat(mediaContainerView.visibility).isEqualTo(VISIBLE) } private fun setDozing() { whenever(statusBarStateController.isDozing).thenReturn(true) statusBarStateListener.onDozingChanged(true) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorLoggerTest.kt +24 −64 Original line number Diff line number Diff line Loading @@ -84,91 +84,50 @@ class NotificationWakeUpCoordinatorLoggerTest : SysuiTestCase() { @Test fun updateDozeAmountWillThrottleFractionalInputUpdates() { logger.logUpdateDozeAmount(0f, 0f, null, 0f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(0f, null, 0f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(0.1f, 0f, null, 0.1f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.1f, null, 0.1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) logger.logUpdateDozeAmount(0.2f, 0f, null, 0.2f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.3f, 0f, null, 0.3f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.4f, 0f, null, 0.4f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, 0f, null, 0.5f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.2f, null, 0.2f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.3f, null, 0.3f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.4f, null, 0.4f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, null, 0.5f, StatusBarState.SHADE, changed = true) verifyDidLog(0) logger.logUpdateDozeAmount(1f, 0f, null, 1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) } @Test fun updateDozeAmountWillThrottleFractionalDelayUpdates() { logger.logUpdateDozeAmount(0f, 0f, null, 0f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(0f, 0.1f, null, 0.1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) logger.logUpdateDozeAmount(0f, 0.2f, null, 0.2f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0f, 0.3f, null, 0.3f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0f, 0.4f, null, 0.4f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0f, 0.5f, null, 0.5f, StatusBarState.SHADE, changed = true) verifyDidLog(0) logger.logUpdateDozeAmount(0f, 1f, null, 1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) } @Test fun updateDozeAmountWillIncludeFractionalUpdatesWhenOtherInputChangesFractionality() { logger.logUpdateDozeAmount(0.0f, 1.0f, 1f, 1f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(0.1f, 1.0f, 1f, 1f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(0.2f, 1.0f, 1f, 1f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(0.3f, 1.0f, 1f, 1f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(0.4f, 1.0f, 1f, 1f, StatusBarState.SHADE, changed = false) verifyDidLog(0) logger.logUpdateDozeAmount(0.5f, 0.9f, 1f, 1f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(0.6f, 0.8f, 1f, 1f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(0.8f, 0.6f, 1f, 1f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(0.9f, 0.5f, 1f, 1f, StatusBarState.SHADE, changed = false) verifyDidLog(0) logger.logUpdateDozeAmount(1.0f, 0.4f, 1f, 1f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(1.0f, 0.3f, 1f, 1f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(1.0f, 0.2f, 1f, 1f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(1.0f, 0.1f, 1f, 1f, StatusBarState.SHADE, changed = false) verifyDidLog(0) logger.logUpdateDozeAmount(1.0f, 0.0f, 1f, 1f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(1f, null, 1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) } @Test fun updateDozeAmountWillIncludeFractionalUpdatesWhenStateChanges() { logger.logUpdateDozeAmount(0f, 0f, null, 0f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(0f, null, 0f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(0.1f, 0f, null, 0.1f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.1f, null, 0.1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) logger.logUpdateDozeAmount(0.2f, 0f, null, 0.2f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.3f, 0f, null, 0.3f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.4f, 0f, null, 0.4f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, 0f, null, 0.5f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.2f, null, 0.2f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.3f, null, 0.3f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.4f, null, 0.4f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, null, 0.5f, StatusBarState.SHADE, changed = true) verifyDidLog(0) logger.logUpdateDozeAmount(0.5f, 0f, null, 0.5f, StatusBarState.KEYGUARD, changed = false) logger.logUpdateDozeAmount(0.5f, null, 0.5f, StatusBarState.KEYGUARD, changed = false) verifyDidLog(1) } @Test fun updateDozeAmountWillIncludeFractionalUpdatesWhenHardOverrideChanges() { logger.logUpdateDozeAmount(0f, 0f, null, 0f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(0f, null, 0f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(0.1f, 0f, null, 0.1f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.1f, null, 0.1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) logger.logUpdateDozeAmount(0.2f, 0f, null, 0.2f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.3f, 0f, null, 0.3f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.4f, 0f, null, 0.4f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, 0f, null, 0.5f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.2f, null, 0.2f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.3f, null, 0.3f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.4f, null, 0.4f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, null, 0.5f, StatusBarState.SHADE, changed = true) verifyDidLog(0) logger.logUpdateDozeAmount(0.5f, 0f, 1f, 1f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, 1f, 1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) logger.logUpdateDozeAmount(0.5f, 0f, 0f, 0f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, 0f, 0f, StatusBarState.SHADE, changed = true) verifyDidLog(1) logger.logUpdateDozeAmount(0.5f, 0f, null, 0.5f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, null, 0.5f, StatusBarState.SHADE, changed = true) verifyDidLog(1) } Loading @@ -177,6 +136,7 @@ class NotificationWakeUpCoordinatorLoggerTest : SysuiTestCase() { val tracker = object : LogcatEchoTracker { override fun isBufferLoggable(bufferName: String, level: LogLevel): Boolean = false override fun isTagLoggable(tagName: String, level: LogLevel): Boolean { recentLogs.add(tagName to level) return true Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt +0 −128 Original line number Diff line number Diff line Loading @@ -37,11 +37,9 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.scene.data.repository.Idle import com.android.systemui.scene.data.repository.setSceneTransition import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.ShadeViewController.Companion.WAKEUP_ANIMATION_DELAY_MS import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.notification.headsup.HeadsUpManager import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController import com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_WAKEUP import com.android.systemui.statusbar.notification.stack.domain.interactor.notificationsKeyguardInteractor import com.android.systemui.statusbar.phone.DozeParameters import com.android.systemui.statusbar.phone.KeyguardBypassController Loading @@ -61,7 +59,6 @@ import org.mockito.Mockito.anyFloat import org.mockito.kotlin.clearInvocations import org.mockito.kotlin.eq import org.mockito.kotlin.mock import org.mockito.kotlin.never import org.mockito.kotlin.verify import org.mockito.kotlin.verifyNoMoreInteractions import org.mockito.kotlin.whenever Loading Loading @@ -266,52 +263,6 @@ class NotificationWakeUpCoordinatorTest(flags: FlagsParameterization) : SysuiTes assertThat(notificationWakeUpCoordinator.statusBarState).isEqualTo(StatusBarState.SHADE) } private val delayedDozeDelay = WAKEUP_ANIMATION_DELAY_MS.toLong() private val delayedDozeDuration = ANIMATION_DURATION_WAKEUP.toLong() @Test fun dozeAmountOutputClampsTo1WhenDelayStarts() { notificationWakeUpCoordinator.setWakingUp(true, requestDelayedAnimation = true) verifyStackScrollerDozeAndHideAmount(dozeAmount = 1f, hideAmount = 1f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isTrue() // verify further doze amount changes have no effect on output setDozeAmount(0.5f) verifyStackScrollerDozeAndHideAmount(dozeAmount = 1f, hideAmount = 1f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isTrue() } @Test fun verifyDozeAmountOutputTracksDelay() { dozeAmountOutputClampsTo1WhenDelayStarts() // Animator waiting the delay amount should not yet affect the output animatorTestRule.advanceTimeBy(delayedDozeDelay) verifyStackScrollerDozeAndHideAmount(dozeAmount = 1f, hideAmount = 1f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isTrue() // input doze amount change to 0 has no effect setDozeAmount(0.0f) verifyStackScrollerDozeAndHideAmount(dozeAmount = 1f, hideAmount = 1f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isTrue() // Advancing the delay to 50% will cause the 50% output animatorTestRule.advanceTimeBy(delayedDozeDuration / 2) verifyStackScrollerDozeAndHideAmount(dozeAmount = 0.5f, hideAmount = 0.5f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isFalse() // Now advance delay to 100% completion; notifications become fully visible animatorTestRule.advanceTimeBy(delayedDozeDuration / 2) verifyStackScrollerDozeAndHideAmount(dozeAmount = 0f, hideAmount = 0f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isFalse() // Now advance delay to 200% completion -- should not invoke anything else animatorTestRule.advanceTimeBy(delayedDozeDuration) verify(stackScrollerController, never()).setDozeAmount(anyFloat()) verify(stackScrollerController, never()).setHideAmount(anyFloat(), anyFloat()) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isFalse() } @Test fun verifyWakeUpListenerCallbacksWhenDozing() { // prime internal state as dozing, then add the listener Loading @@ -334,85 +285,6 @@ class NotificationWakeUpCoordinatorTest(flags: FlagsParameterization) : SysuiTes verifyNoMoreInteractions(wakeUpListener) } @Test fun verifyWakeUpListenerCallbacksWhenDelayingAnimation() { // prime internal state as dozing, then add the listener setDozeAmount(1f) notificationWakeUpCoordinator.addListener(wakeUpListener) // setWakingUp() doesn't do anything yet notificationWakeUpCoordinator.setWakingUp(true, requestDelayedAnimation = true) verifyNoMoreInteractions(wakeUpListener) // verify further doze amount changes have no effect setDozeAmount(0.5f) verifyNoMoreInteractions(wakeUpListener) // advancing to just before the start time should not invoke the listener animatorTestRule.advanceTimeBy(delayedDozeDelay - 1) verifyNoMoreInteractions(wakeUpListener) animatorTestRule.advanceTimeBy(1) verify(wakeUpListener).onDelayedDozeAmountAnimationRunning(eq(true)) verifyNoMoreInteractions(wakeUpListener) clearInvocations(wakeUpListener) // input doze amount change to 0 has no effect setDozeAmount(0.0f) verifyNoMoreInteractions(wakeUpListener) // Advancing the delay to 50% will cause notifications to no longer be fully hidden animatorTestRule.advanceTimeBy(delayedDozeDuration / 2) verify(wakeUpListener).onFullyHiddenChanged(eq(false)) verifyNoMoreInteractions(wakeUpListener) clearInvocations(wakeUpListener) // Now advance delay to 99.x% completion; notifications become fully visible animatorTestRule.advanceTimeBy(delayedDozeDuration / 2 - 1) verifyNoMoreInteractions(wakeUpListener) // advance to 100%; animation no longer running animatorTestRule.advanceTimeBy(1) verify(wakeUpListener).onDelayedDozeAmountAnimationRunning(eq(false)) verifyNoMoreInteractions(wakeUpListener) clearInvocations(wakeUpListener) // Now advance delay to 200% completion -- should not invoke anything else animatorTestRule.advanceTimeBy(delayedDozeDuration) verifyNoMoreInteractions(wakeUpListener) } @Test fun verifyDelayedDozeAmountCanBeOverridden() { dozeAmountOutputClampsTo1WhenDelayStarts() // input doze amount change to 0 has no effect setDozeAmount(0.0f) verifyStackScrollerDozeAndHideAmount(dozeAmount = 1f, hideAmount = 1f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isTrue() // Advancing the delay to 50% will cause the 50% output animatorTestRule.advanceTimeBy(delayedDozeDelay + delayedDozeDuration / 2) verifyStackScrollerDozeAndHideAmount(dozeAmount = 0.5f, hideAmount = 0.5f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isFalse() // Enabling bypass and showing keyguard will override back to fully dozing/hidden setBypassEnabled(true) setStatusBarState(StatusBarState.KEYGUARD) verifyStackScrollerDozeAndHideAmount(dozeAmount = 1f, hideAmount = 1f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isTrue() } @Test fun verifyRemovingOverrideRestoresOtherwiseCalculatedDozeAmount() { verifyDelayedDozeAmountCanBeOverridden() // Disabling bypass will return back to the 50% value setBypassEnabled(false) verifyStackScrollerDozeAndHideAmount(dozeAmount = 0.5f, hideAmount = 0.5f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isFalse() } private fun verifyStackScrollerDozeAndHideAmount(dozeAmount: Float, hideAmount: Float) { // First verify that we did in-fact receive the correct values verify(stackScrollerController).setDozeAmount(eased(dozeAmount)) Loading packages/SystemUI/src/com/android/systemui/flags/Flags.kt +0 −5 Original line number Diff line number Diff line Loading @@ -335,11 +335,6 @@ object Flags { // 2900 - Zero Jank fixes. Naming convention is: zj_<bug number>_<cuj name> // TODO:(b/285623104): Tracking bug @JvmField val ZJ_285570694_LOCKSCREEN_TRANSITION_FROM_AOD = releasedFlag("zj_285570694_lockscreen_transition_from_aod") // TODO(b/283447257): Tracking bug @JvmField val BIGPICTURE_NOTIFICATION_LAZY_LOADING = Loading packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/KeyguardMediaController.kt +4 −21 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import androidx.annotation.VisibleForTesting import com.android.systemui.Dumpable import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dump.DumpManager import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.media.controls.ui.view.MediaHost import com.android.systemui.media.controls.ui.view.MediaHostState import com.android.systemui.media.dagger.MediaModule.KEYGUARD Loading Loading @@ -114,15 +113,6 @@ constructor( var visibilityChangedListener: ((Boolean) -> Unit)? = null /** * Whether the doze wake up animation is delayed and we are currently waiting for it to start. */ var isDozeWakeUpAnimationWaiting: Boolean = false set(value) { field = value refreshMediaPosition(reason = "isDozeWakeUpAnimationWaiting changed") } /** single pane media container placed at the top of the notifications list */ var singlePaneContainer: MediaContainerView? = null private set Loading Loading @@ -150,7 +140,7 @@ constructor( refreshMediaPosition(reason = "onMediaHostVisibilityChanged") if (visible) { if (MigrateClocksToBlueprint.isEnabled && useSplitShade) { if (useSplitShade) { return } mediaHost.hostView.layoutParams.apply { Loading Loading @@ -241,13 +231,7 @@ constructor( // by the clock. This is not the case for single-line clock though. // For single shade, we don't need to do it, because media is a child of NSSL, which already // gets hidden on AOD. // Media also has to be hidden when waking up from dozing, and the doze wake up animation is // delayed and waiting to be started. // This is to stay in sync with the delaying of the horizontal alignment of the rest of the // keyguard container, that is also delayed until the "wait" is over. // If we show media during this waiting period, the shade will still be centered, and using // the entire width of the screen, and making media show fully stretched. return !statusBarStateController.isDozing && !isDozeWakeUpAnimationWaiting return !statusBarStateController.isDozing } private fun showMediaPlayer() { Loading Loading @@ -291,18 +275,17 @@ constructor( println("visible", visible) println("useSplitShade", useSplitShade) println("bypassController.bypassEnabled", bypassController.bypassEnabled) println("isDozeWakeUpAnimationWaiting", isDozeWakeUpAnimationWaiting) println("singlePaneContainer", singlePaneContainer) println("splitShadeContainer", splitShadeContainer) if (lastUsedStatusBarState != -1) { println( "lastUsedStatusBarState", StatusBarState.toString(lastUsedStatusBarState) StatusBarState.toString(lastUsedStatusBarState), ) } println( "statusBarStateController.state", StatusBarState.toString(statusBarStateController.state) StatusBarState.toString(statusBarStateController.state), ) } } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/media/controls/ui/controller/KeyguardMediaControllerTest.kt +3 −26 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.media.controls.ui.controller import android.provider.Settings import android.testing.TestableLooper import android.view.View.GONE import android.view.View.VISIBLE Loading Loading @@ -88,7 +87,7 @@ class KeyguardMediaControllerTest : SysuiTestCase() { configurationController, ResourcesSplitShadeStateController(), mock<KeyguardMediaControllerLogger>(), mock<DumpManager>() mock<DumpManager>(), ) keyguardMediaController.attachSinglePaneContainer(mediaContainerView) keyguardMediaController.useSplitShade = false Loading Loading @@ -142,7 +141,7 @@ class KeyguardMediaControllerTest : SysuiTestCase() { assertTrue( "HostView wasn't attached to the split pane container", splitShadeContainer.childCount == 1 splitShadeContainer.childCount == 1, ) } Loading @@ -153,7 +152,7 @@ class KeyguardMediaControllerTest : SysuiTestCase() { assertTrue( "HostView wasn't attached to the single pane container", mediaContainerView.childCount == 1 mediaContainerView.childCount == 1, ) } Loading @@ -173,17 +172,6 @@ class KeyguardMediaControllerTest : SysuiTestCase() { assertThat(splitShadeContainer.visibility).isEqualTo(GONE) } @Test fun dozeWakeUpAnimationWaiting_inSplitShade_mediaIsHidden() { val splitShadeContainer = FrameLayout(context) keyguardMediaController.attachSplitShadeContainer(splitShadeContainer) keyguardMediaController.useSplitShade = true keyguardMediaController.isDozeWakeUpAnimationWaiting = true assertThat(splitShadeContainer.visibility).isEqualTo(GONE) } @Test fun dozing_inSingleShade_mediaIsVisible() { val splitShadeContainer = FrameLayout(context) Loading @@ -195,17 +183,6 @@ class KeyguardMediaControllerTest : SysuiTestCase() { assertThat(mediaContainerView.visibility).isEqualTo(VISIBLE) } @Test fun dozeWakeUpAnimationWaiting_inSingleShade_mediaIsVisible() { val splitShadeContainer = FrameLayout(context) keyguardMediaController.attachSplitShadeContainer(splitShadeContainer) keyguardMediaController.useSplitShade = false keyguardMediaController.isDozeWakeUpAnimationWaiting = true assertThat(mediaContainerView.visibility).isEqualTo(VISIBLE) } private fun setDozing() { whenever(statusBarStateController.isDozing).thenReturn(true) statusBarStateListener.onDozingChanged(true) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorLoggerTest.kt +24 −64 Original line number Diff line number Diff line Loading @@ -84,91 +84,50 @@ class NotificationWakeUpCoordinatorLoggerTest : SysuiTestCase() { @Test fun updateDozeAmountWillThrottleFractionalInputUpdates() { logger.logUpdateDozeAmount(0f, 0f, null, 0f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(0f, null, 0f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(0.1f, 0f, null, 0.1f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.1f, null, 0.1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) logger.logUpdateDozeAmount(0.2f, 0f, null, 0.2f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.3f, 0f, null, 0.3f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.4f, 0f, null, 0.4f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, 0f, null, 0.5f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.2f, null, 0.2f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.3f, null, 0.3f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.4f, null, 0.4f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, null, 0.5f, StatusBarState.SHADE, changed = true) verifyDidLog(0) logger.logUpdateDozeAmount(1f, 0f, null, 1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) } @Test fun updateDozeAmountWillThrottleFractionalDelayUpdates() { logger.logUpdateDozeAmount(0f, 0f, null, 0f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(0f, 0.1f, null, 0.1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) logger.logUpdateDozeAmount(0f, 0.2f, null, 0.2f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0f, 0.3f, null, 0.3f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0f, 0.4f, null, 0.4f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0f, 0.5f, null, 0.5f, StatusBarState.SHADE, changed = true) verifyDidLog(0) logger.logUpdateDozeAmount(0f, 1f, null, 1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) } @Test fun updateDozeAmountWillIncludeFractionalUpdatesWhenOtherInputChangesFractionality() { logger.logUpdateDozeAmount(0.0f, 1.0f, 1f, 1f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(0.1f, 1.0f, 1f, 1f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(0.2f, 1.0f, 1f, 1f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(0.3f, 1.0f, 1f, 1f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(0.4f, 1.0f, 1f, 1f, StatusBarState.SHADE, changed = false) verifyDidLog(0) logger.logUpdateDozeAmount(0.5f, 0.9f, 1f, 1f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(0.6f, 0.8f, 1f, 1f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(0.8f, 0.6f, 1f, 1f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(0.9f, 0.5f, 1f, 1f, StatusBarState.SHADE, changed = false) verifyDidLog(0) logger.logUpdateDozeAmount(1.0f, 0.4f, 1f, 1f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(1.0f, 0.3f, 1f, 1f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(1.0f, 0.2f, 1f, 1f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(1.0f, 0.1f, 1f, 1f, StatusBarState.SHADE, changed = false) verifyDidLog(0) logger.logUpdateDozeAmount(1.0f, 0.0f, 1f, 1f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(1f, null, 1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) } @Test fun updateDozeAmountWillIncludeFractionalUpdatesWhenStateChanges() { logger.logUpdateDozeAmount(0f, 0f, null, 0f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(0f, null, 0f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(0.1f, 0f, null, 0.1f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.1f, null, 0.1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) logger.logUpdateDozeAmount(0.2f, 0f, null, 0.2f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.3f, 0f, null, 0.3f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.4f, 0f, null, 0.4f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, 0f, null, 0.5f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.2f, null, 0.2f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.3f, null, 0.3f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.4f, null, 0.4f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, null, 0.5f, StatusBarState.SHADE, changed = true) verifyDidLog(0) logger.logUpdateDozeAmount(0.5f, 0f, null, 0.5f, StatusBarState.KEYGUARD, changed = false) logger.logUpdateDozeAmount(0.5f, null, 0.5f, StatusBarState.KEYGUARD, changed = false) verifyDidLog(1) } @Test fun updateDozeAmountWillIncludeFractionalUpdatesWhenHardOverrideChanges() { logger.logUpdateDozeAmount(0f, 0f, null, 0f, StatusBarState.SHADE, changed = false) logger.logUpdateDozeAmount(0f, null, 0f, StatusBarState.SHADE, changed = false) verifyDidLog(1) logger.logUpdateDozeAmount(0.1f, 0f, null, 0.1f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.1f, null, 0.1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) logger.logUpdateDozeAmount(0.2f, 0f, null, 0.2f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.3f, 0f, null, 0.3f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.4f, 0f, null, 0.4f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, 0f, null, 0.5f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.2f, null, 0.2f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.3f, null, 0.3f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.4f, null, 0.4f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, null, 0.5f, StatusBarState.SHADE, changed = true) verifyDidLog(0) logger.logUpdateDozeAmount(0.5f, 0f, 1f, 1f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, 1f, 1f, StatusBarState.SHADE, changed = true) verifyDidLog(1) logger.logUpdateDozeAmount(0.5f, 0f, 0f, 0f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, 0f, 0f, StatusBarState.SHADE, changed = true) verifyDidLog(1) logger.logUpdateDozeAmount(0.5f, 0f, null, 0.5f, StatusBarState.SHADE, changed = true) logger.logUpdateDozeAmount(0.5f, null, 0.5f, StatusBarState.SHADE, changed = true) verifyDidLog(1) } Loading @@ -177,6 +136,7 @@ class NotificationWakeUpCoordinatorLoggerTest : SysuiTestCase() { val tracker = object : LogcatEchoTracker { override fun isBufferLoggable(bufferName: String, level: LogLevel): Boolean = false override fun isTagLoggable(tagName: String, level: LogLevel): Boolean { recentLogs.add(tagName to level) return true Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinatorTest.kt +0 −128 Original line number Diff line number Diff line Loading @@ -37,11 +37,9 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.scene.data.repository.Idle import com.android.systemui.scene.data.repository.setSceneTransition import com.android.systemui.scene.shared.model.Scenes import com.android.systemui.shade.ShadeViewController.Companion.WAKEUP_ANIMATION_DELAY_MS import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.notification.headsup.HeadsUpManager import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController import com.android.systemui.statusbar.notification.stack.StackStateAnimator.ANIMATION_DURATION_WAKEUP import com.android.systemui.statusbar.notification.stack.domain.interactor.notificationsKeyguardInteractor import com.android.systemui.statusbar.phone.DozeParameters import com.android.systemui.statusbar.phone.KeyguardBypassController Loading @@ -61,7 +59,6 @@ import org.mockito.Mockito.anyFloat import org.mockito.kotlin.clearInvocations import org.mockito.kotlin.eq import org.mockito.kotlin.mock import org.mockito.kotlin.never import org.mockito.kotlin.verify import org.mockito.kotlin.verifyNoMoreInteractions import org.mockito.kotlin.whenever Loading Loading @@ -266,52 +263,6 @@ class NotificationWakeUpCoordinatorTest(flags: FlagsParameterization) : SysuiTes assertThat(notificationWakeUpCoordinator.statusBarState).isEqualTo(StatusBarState.SHADE) } private val delayedDozeDelay = WAKEUP_ANIMATION_DELAY_MS.toLong() private val delayedDozeDuration = ANIMATION_DURATION_WAKEUP.toLong() @Test fun dozeAmountOutputClampsTo1WhenDelayStarts() { notificationWakeUpCoordinator.setWakingUp(true, requestDelayedAnimation = true) verifyStackScrollerDozeAndHideAmount(dozeAmount = 1f, hideAmount = 1f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isTrue() // verify further doze amount changes have no effect on output setDozeAmount(0.5f) verifyStackScrollerDozeAndHideAmount(dozeAmount = 1f, hideAmount = 1f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isTrue() } @Test fun verifyDozeAmountOutputTracksDelay() { dozeAmountOutputClampsTo1WhenDelayStarts() // Animator waiting the delay amount should not yet affect the output animatorTestRule.advanceTimeBy(delayedDozeDelay) verifyStackScrollerDozeAndHideAmount(dozeAmount = 1f, hideAmount = 1f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isTrue() // input doze amount change to 0 has no effect setDozeAmount(0.0f) verifyStackScrollerDozeAndHideAmount(dozeAmount = 1f, hideAmount = 1f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isTrue() // Advancing the delay to 50% will cause the 50% output animatorTestRule.advanceTimeBy(delayedDozeDuration / 2) verifyStackScrollerDozeAndHideAmount(dozeAmount = 0.5f, hideAmount = 0.5f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isFalse() // Now advance delay to 100% completion; notifications become fully visible animatorTestRule.advanceTimeBy(delayedDozeDuration / 2) verifyStackScrollerDozeAndHideAmount(dozeAmount = 0f, hideAmount = 0f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isFalse() // Now advance delay to 200% completion -- should not invoke anything else animatorTestRule.advanceTimeBy(delayedDozeDuration) verify(stackScrollerController, never()).setDozeAmount(anyFloat()) verify(stackScrollerController, never()).setHideAmount(anyFloat(), anyFloat()) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isFalse() } @Test fun verifyWakeUpListenerCallbacksWhenDozing() { // prime internal state as dozing, then add the listener Loading @@ -334,85 +285,6 @@ class NotificationWakeUpCoordinatorTest(flags: FlagsParameterization) : SysuiTes verifyNoMoreInteractions(wakeUpListener) } @Test fun verifyWakeUpListenerCallbacksWhenDelayingAnimation() { // prime internal state as dozing, then add the listener setDozeAmount(1f) notificationWakeUpCoordinator.addListener(wakeUpListener) // setWakingUp() doesn't do anything yet notificationWakeUpCoordinator.setWakingUp(true, requestDelayedAnimation = true) verifyNoMoreInteractions(wakeUpListener) // verify further doze amount changes have no effect setDozeAmount(0.5f) verifyNoMoreInteractions(wakeUpListener) // advancing to just before the start time should not invoke the listener animatorTestRule.advanceTimeBy(delayedDozeDelay - 1) verifyNoMoreInteractions(wakeUpListener) animatorTestRule.advanceTimeBy(1) verify(wakeUpListener).onDelayedDozeAmountAnimationRunning(eq(true)) verifyNoMoreInteractions(wakeUpListener) clearInvocations(wakeUpListener) // input doze amount change to 0 has no effect setDozeAmount(0.0f) verifyNoMoreInteractions(wakeUpListener) // Advancing the delay to 50% will cause notifications to no longer be fully hidden animatorTestRule.advanceTimeBy(delayedDozeDuration / 2) verify(wakeUpListener).onFullyHiddenChanged(eq(false)) verifyNoMoreInteractions(wakeUpListener) clearInvocations(wakeUpListener) // Now advance delay to 99.x% completion; notifications become fully visible animatorTestRule.advanceTimeBy(delayedDozeDuration / 2 - 1) verifyNoMoreInteractions(wakeUpListener) // advance to 100%; animation no longer running animatorTestRule.advanceTimeBy(1) verify(wakeUpListener).onDelayedDozeAmountAnimationRunning(eq(false)) verifyNoMoreInteractions(wakeUpListener) clearInvocations(wakeUpListener) // Now advance delay to 200% completion -- should not invoke anything else animatorTestRule.advanceTimeBy(delayedDozeDuration) verifyNoMoreInteractions(wakeUpListener) } @Test fun verifyDelayedDozeAmountCanBeOverridden() { dozeAmountOutputClampsTo1WhenDelayStarts() // input doze amount change to 0 has no effect setDozeAmount(0.0f) verifyStackScrollerDozeAndHideAmount(dozeAmount = 1f, hideAmount = 1f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isTrue() // Advancing the delay to 50% will cause the 50% output animatorTestRule.advanceTimeBy(delayedDozeDelay + delayedDozeDuration / 2) verifyStackScrollerDozeAndHideAmount(dozeAmount = 0.5f, hideAmount = 0.5f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isFalse() // Enabling bypass and showing keyguard will override back to fully dozing/hidden setBypassEnabled(true) setStatusBarState(StatusBarState.KEYGUARD) verifyStackScrollerDozeAndHideAmount(dozeAmount = 1f, hideAmount = 1f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isTrue() } @Test fun verifyRemovingOverrideRestoresOtherwiseCalculatedDozeAmount() { verifyDelayedDozeAmountCanBeOverridden() // Disabling bypass will return back to the 50% value setBypassEnabled(false) verifyStackScrollerDozeAndHideAmount(dozeAmount = 0.5f, hideAmount = 0.5f) assertThat(notificationWakeUpCoordinator.notificationsFullyHidden).isFalse() } private fun verifyStackScrollerDozeAndHideAmount(dozeAmount: Float, hideAmount: Float) { // First verify that we did in-fact receive the correct values verify(stackScrollerController).setDozeAmount(eased(dozeAmount)) Loading
packages/SystemUI/src/com/android/systemui/flags/Flags.kt +0 −5 Original line number Diff line number Diff line Loading @@ -335,11 +335,6 @@ object Flags { // 2900 - Zero Jank fixes. Naming convention is: zj_<bug number>_<cuj name> // TODO:(b/285623104): Tracking bug @JvmField val ZJ_285570694_LOCKSCREEN_TRANSITION_FROM_AOD = releasedFlag("zj_285570694_lockscreen_transition_from_aod") // TODO(b/283447257): Tracking bug @JvmField val BIGPICTURE_NOTIFICATION_LAZY_LOADING = Loading
packages/SystemUI/src/com/android/systemui/media/controls/ui/controller/KeyguardMediaController.kt +4 −21 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import androidx.annotation.VisibleForTesting import com.android.systemui.Dumpable import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dump.DumpManager import com.android.systemui.keyguard.MigrateClocksToBlueprint import com.android.systemui.media.controls.ui.view.MediaHost import com.android.systemui.media.controls.ui.view.MediaHostState import com.android.systemui.media.dagger.MediaModule.KEYGUARD Loading Loading @@ -114,15 +113,6 @@ constructor( var visibilityChangedListener: ((Boolean) -> Unit)? = null /** * Whether the doze wake up animation is delayed and we are currently waiting for it to start. */ var isDozeWakeUpAnimationWaiting: Boolean = false set(value) { field = value refreshMediaPosition(reason = "isDozeWakeUpAnimationWaiting changed") } /** single pane media container placed at the top of the notifications list */ var singlePaneContainer: MediaContainerView? = null private set Loading Loading @@ -150,7 +140,7 @@ constructor( refreshMediaPosition(reason = "onMediaHostVisibilityChanged") if (visible) { if (MigrateClocksToBlueprint.isEnabled && useSplitShade) { if (useSplitShade) { return } mediaHost.hostView.layoutParams.apply { Loading Loading @@ -241,13 +231,7 @@ constructor( // by the clock. This is not the case for single-line clock though. // For single shade, we don't need to do it, because media is a child of NSSL, which already // gets hidden on AOD. // Media also has to be hidden when waking up from dozing, and the doze wake up animation is // delayed and waiting to be started. // This is to stay in sync with the delaying of the horizontal alignment of the rest of the // keyguard container, that is also delayed until the "wait" is over. // If we show media during this waiting period, the shade will still be centered, and using // the entire width of the screen, and making media show fully stretched. return !statusBarStateController.isDozing && !isDozeWakeUpAnimationWaiting return !statusBarStateController.isDozing } private fun showMediaPlayer() { Loading Loading @@ -291,18 +275,17 @@ constructor( println("visible", visible) println("useSplitShade", useSplitShade) println("bypassController.bypassEnabled", bypassController.bypassEnabled) println("isDozeWakeUpAnimationWaiting", isDozeWakeUpAnimationWaiting) println("singlePaneContainer", singlePaneContainer) println("splitShadeContainer", splitShadeContainer) if (lastUsedStatusBarState != -1) { println( "lastUsedStatusBarState", StatusBarState.toString(lastUsedStatusBarState) StatusBarState.toString(lastUsedStatusBarState), ) } println( "statusBarStateController.state", StatusBarState.toString(statusBarStateController.state) StatusBarState.toString(statusBarStateController.state), ) } } Loading