Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt +15 −2 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.scene.data.repository.Idle import com.android.systemui.scene.data.repository.setTransition import com.android.systemui.scene.domain.interactor.sceneBackInteractor import com.android.systemui.scene.domain.interactor.sceneContainerOcclusionInteractor import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Scenes Loading Loading @@ -112,6 +113,7 @@ class StatusBarStateControllerImplTest(flags: FlagsParameterization) : SysuiTest { kosmos.sceneInteractor }, { kosmos.sceneContainerOcclusionInteractor }, { kosmos.keyguardClockInteractor }, { kosmos.sceneBackInteractor }, ) { override fun createDarkAnimator(): ObjectAnimator { return mockDarkAnimator Loading Loading @@ -320,12 +322,23 @@ class StatusBarStateControllerImplTest(flags: FlagsParameterization) : SysuiTest assertThat(deviceUnlockStatus!!.isUnlocked).isTrue() kosmos.sceneInteractor.changeScene(toScene = Scenes.Gone, loggingReason = "reason") kosmos.sceneInteractor.changeScene( toScene = Scenes.Lockscreen, loggingReason = "reason" ) runCurrent() assertThat(currentScene).isEqualTo(Scenes.Gone) assertThat(currentScene).isEqualTo(Scenes.Lockscreen) // Call start to begin hydrating based on the scene framework: underTest.start() runCurrent() assertThat(statusBarState).isEqualTo(StatusBarState.KEYGUARD) kosmos.sceneInteractor.changeScene(toScene = Scenes.Gone, loggingReason = "reason") runCurrent() assertThat(currentScene).isEqualTo(Scenes.Gone) assertThat(statusBarState).isEqualTo(StatusBarState.SHADE) kosmos.sceneInteractor.changeScene(toScene = Scenes.Shade, loggingReason = "reason") runCurrent() Loading packages/SystemUI/src/com/android/systemui/scene/data/model/SceneStack.kt +3 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,9 @@ fun SceneStack.asIterable(): Iterable<SceneKey> = Iterable { } } /** Does this stack contain the given [sceneKey]? O(N) */ fun SceneStack.contains(sceneKey: SceneKey): Boolean = asIterable().any { it == sceneKey } /** * Returns a new [SceneStack] containing the given [scenes], ordered such that the first argument is * the head returned from [peek], then the second, and so forth. Loading packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java +15 −3 Original line number Diff line number Diff line Loading @@ -54,6 +54,9 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInterac import com.android.systemui.keyguard.shared.model.KeyguardState; import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener; import com.android.systemui.res.R; import com.android.systemui.scene.data.model.SceneStack; import com.android.systemui.scene.data.model.SceneStackKt; import com.android.systemui.scene.domain.interactor.SceneBackInteractor; import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor; import com.android.systemui.scene.domain.interactor.SceneInteractor; import com.android.systemui.scene.shared.flag.SceneContainerFlag; Loading Loading @@ -118,6 +121,7 @@ public class StatusBarStateControllerImpl implements private final Lazy<SceneInteractor> mSceneInteractorLazy; private final Lazy<SceneContainerOcclusionInteractor> mSceneContainerOcclusionInteractorLazy; private final Lazy<KeyguardClockInteractor> mKeyguardClockInteractorLazy; private final Lazy<SceneBackInteractor> mSceneBackInteractorLazy; private int mState; private int mLastState; private int mUpcomingState; Loading Loading @@ -186,7 +190,8 @@ public class StatusBarStateControllerImpl implements Lazy<DeviceUnlockedInteractor> deviceUnlockedInteractorLazy, Lazy<SceneInteractor> sceneInteractorLazy, Lazy<SceneContainerOcclusionInteractor> sceneContainerOcclusionInteractor, Lazy<KeyguardClockInteractor> keyguardClockInteractorLazy) { Lazy<KeyguardClockInteractor> keyguardClockInteractorLazy, Lazy<SceneBackInteractor> sceneBackInteractorLazy) { mUiEventLogger = uiEventLogger; mInteractionJankMonitorLazy = interactionJankMonitorLazy; mJavaAdapter = javaAdapter; Loading @@ -196,6 +201,7 @@ public class StatusBarStateControllerImpl implements mSceneInteractorLazy = sceneInteractorLazy; mSceneContainerOcclusionInteractorLazy = sceneContainerOcclusionInteractor; mKeyguardClockInteractorLazy = keyguardClockInteractorLazy; mSceneBackInteractorLazy = sceneBackInteractorLazy; for (int i = 0; i < HISTORY_SIZE; i++) { mHistoricalRecords[i] = new HistoricalState(); } Loading @@ -221,6 +227,7 @@ public class StatusBarStateControllerImpl implements combineFlows( mDeviceUnlockedInteractorLazy.get().getDeviceUnlockStatus(), mSceneInteractorLazy.get().getCurrentScene(), mSceneBackInteractorLazy.get().getBackStack(), mSceneContainerOcclusionInteractorLazy.get().getInvisibleDueToOcclusion(), this::calculateStateFromSceneFramework), this::onStatusBarStateChanged); Loading Loading @@ -677,10 +684,15 @@ public class StatusBarStateControllerImpl implements private int calculateStateFromSceneFramework( DeviceUnlockStatus deviceUnlockStatus, SceneKey currentScene, SceneStack backStack, boolean isOccluded) { SceneContainerFlag.isUnexpectedlyInLegacyMode(); if (deviceUnlockStatus.isUnlocked() || isOccluded) { if (currentScene.equals(Scenes.Lockscreen)) { return StatusBarState.KEYGUARD; } else if (currentScene.equals(Scenes.Shade) && SceneStackKt.contains(backStack, Scenes.Lockscreen)) { return StatusBarState.SHADE_LOCKED; } else if (deviceUnlockStatus.isUnlocked() || isOccluded) { return StatusBarState.SHADE; } else { return Preconditions.checkNotNull(sStatusBarStateByLockedSceneKey.get(currentScene)); Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +8 −1 Original line number Diff line number Diff line Loading @@ -1487,7 +1487,14 @@ public class NotificationStackScrollLayout private float updateStackEndHeight() { if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return 0f; float height = Math.max(0f, mAmbientState.getStackCutoff() - mAmbientState.getStackTop()); final float height; if (mMaxDisplayedNotifications != -1) { // The stack intrinsic height already contains the correct value when there is a limit // in the max number of notifications (e.g. as in keyguard). height = mIntrinsicContentHeight; } else { height = Math.max(0f, mAmbientState.getStackCutoff() - mAmbientState.getStackTop()); } mAmbientState.setStackEndHeight(height); return height; } Loading packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -468,7 +468,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { () -> mKosmos.getDeviceUnlockedInteractor(), () -> mKosmos.getSceneInteractor(), () -> mKosmos.getSceneContainerOcclusionInteractor(), () -> mKosmos.getKeyguardClockInteractor()); () -> mKosmos.getKeyguardClockInteractor(), () -> mKosmos.getSceneBackInteractor()); KeyguardStatusView keyguardStatusView = new KeyguardStatusView(mContext); keyguardStatusView.setId(R.id.keyguard_status_view); Loading Loading @@ -625,7 +626,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { () -> mKosmos.getDeviceUnlockedInteractor(), () -> mKosmos.getSceneInteractor(), () -> mKosmos.getSceneContainerOcclusionInteractor(), () -> mKosmos.getKeyguardClockInteractor()), () -> mKosmos.getKeyguardClockInteractor(), () -> mKosmos.getSceneBackInteractor()), mKeyguardBypassController, mDozeParameters, mScreenOffAnimationController, Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/StatusBarStateControllerImplTest.kt +15 −2 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import com.android.systemui.kosmos.testScope import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.scene.data.repository.Idle import com.android.systemui.scene.data.repository.setTransition import com.android.systemui.scene.domain.interactor.sceneBackInteractor import com.android.systemui.scene.domain.interactor.sceneContainerOcclusionInteractor import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.scene.shared.model.Scenes Loading Loading @@ -112,6 +113,7 @@ class StatusBarStateControllerImplTest(flags: FlagsParameterization) : SysuiTest { kosmos.sceneInteractor }, { kosmos.sceneContainerOcclusionInteractor }, { kosmos.keyguardClockInteractor }, { kosmos.sceneBackInteractor }, ) { override fun createDarkAnimator(): ObjectAnimator { return mockDarkAnimator Loading Loading @@ -320,12 +322,23 @@ class StatusBarStateControllerImplTest(flags: FlagsParameterization) : SysuiTest assertThat(deviceUnlockStatus!!.isUnlocked).isTrue() kosmos.sceneInteractor.changeScene(toScene = Scenes.Gone, loggingReason = "reason") kosmos.sceneInteractor.changeScene( toScene = Scenes.Lockscreen, loggingReason = "reason" ) runCurrent() assertThat(currentScene).isEqualTo(Scenes.Gone) assertThat(currentScene).isEqualTo(Scenes.Lockscreen) // Call start to begin hydrating based on the scene framework: underTest.start() runCurrent() assertThat(statusBarState).isEqualTo(StatusBarState.KEYGUARD) kosmos.sceneInteractor.changeScene(toScene = Scenes.Gone, loggingReason = "reason") runCurrent() assertThat(currentScene).isEqualTo(Scenes.Gone) assertThat(statusBarState).isEqualTo(StatusBarState.SHADE) kosmos.sceneInteractor.changeScene(toScene = Scenes.Shade, loggingReason = "reason") runCurrent() Loading
packages/SystemUI/src/com/android/systemui/scene/data/model/SceneStack.kt +3 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,9 @@ fun SceneStack.asIterable(): Iterable<SceneKey> = Iterable { } } /** Does this stack contain the given [sceneKey]? O(N) */ fun SceneStack.contains(sceneKey: SceneKey): Boolean = asIterable().any { it == sceneKey } /** * Returns a new [SceneStack] containing the given [scenes], ordered such that the first argument is * the head returned from [peek], then the second, and so forth. Loading
packages/SystemUI/src/com/android/systemui/statusbar/StatusBarStateControllerImpl.java +15 −3 Original line number Diff line number Diff line Loading @@ -54,6 +54,9 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInterac import com.android.systemui.keyguard.shared.model.KeyguardState; import com.android.systemui.plugins.statusbar.StatusBarStateController.StateListener; import com.android.systemui.res.R; import com.android.systemui.scene.data.model.SceneStack; import com.android.systemui.scene.data.model.SceneStackKt; import com.android.systemui.scene.domain.interactor.SceneBackInteractor; import com.android.systemui.scene.domain.interactor.SceneContainerOcclusionInteractor; import com.android.systemui.scene.domain.interactor.SceneInteractor; import com.android.systemui.scene.shared.flag.SceneContainerFlag; Loading Loading @@ -118,6 +121,7 @@ public class StatusBarStateControllerImpl implements private final Lazy<SceneInteractor> mSceneInteractorLazy; private final Lazy<SceneContainerOcclusionInteractor> mSceneContainerOcclusionInteractorLazy; private final Lazy<KeyguardClockInteractor> mKeyguardClockInteractorLazy; private final Lazy<SceneBackInteractor> mSceneBackInteractorLazy; private int mState; private int mLastState; private int mUpcomingState; Loading Loading @@ -186,7 +190,8 @@ public class StatusBarStateControllerImpl implements Lazy<DeviceUnlockedInteractor> deviceUnlockedInteractorLazy, Lazy<SceneInteractor> sceneInteractorLazy, Lazy<SceneContainerOcclusionInteractor> sceneContainerOcclusionInteractor, Lazy<KeyguardClockInteractor> keyguardClockInteractorLazy) { Lazy<KeyguardClockInteractor> keyguardClockInteractorLazy, Lazy<SceneBackInteractor> sceneBackInteractorLazy) { mUiEventLogger = uiEventLogger; mInteractionJankMonitorLazy = interactionJankMonitorLazy; mJavaAdapter = javaAdapter; Loading @@ -196,6 +201,7 @@ public class StatusBarStateControllerImpl implements mSceneInteractorLazy = sceneInteractorLazy; mSceneContainerOcclusionInteractorLazy = sceneContainerOcclusionInteractor; mKeyguardClockInteractorLazy = keyguardClockInteractorLazy; mSceneBackInteractorLazy = sceneBackInteractorLazy; for (int i = 0; i < HISTORY_SIZE; i++) { mHistoricalRecords[i] = new HistoricalState(); } Loading @@ -221,6 +227,7 @@ public class StatusBarStateControllerImpl implements combineFlows( mDeviceUnlockedInteractorLazy.get().getDeviceUnlockStatus(), mSceneInteractorLazy.get().getCurrentScene(), mSceneBackInteractorLazy.get().getBackStack(), mSceneContainerOcclusionInteractorLazy.get().getInvisibleDueToOcclusion(), this::calculateStateFromSceneFramework), this::onStatusBarStateChanged); Loading Loading @@ -677,10 +684,15 @@ public class StatusBarStateControllerImpl implements private int calculateStateFromSceneFramework( DeviceUnlockStatus deviceUnlockStatus, SceneKey currentScene, SceneStack backStack, boolean isOccluded) { SceneContainerFlag.isUnexpectedlyInLegacyMode(); if (deviceUnlockStatus.isUnlocked() || isOccluded) { if (currentScene.equals(Scenes.Lockscreen)) { return StatusBarState.KEYGUARD; } else if (currentScene.equals(Scenes.Shade) && SceneStackKt.contains(backStack, Scenes.Lockscreen)) { return StatusBarState.SHADE_LOCKED; } else if (deviceUnlockStatus.isUnlocked() || isOccluded) { return StatusBarState.SHADE; } else { return Preconditions.checkNotNull(sStatusBarStateByLockedSceneKey.get(currentScene)); Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +8 −1 Original line number Diff line number Diff line Loading @@ -1487,7 +1487,14 @@ public class NotificationStackScrollLayout private float updateStackEndHeight() { if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return 0f; float height = Math.max(0f, mAmbientState.getStackCutoff() - mAmbientState.getStackTop()); final float height; if (mMaxDisplayedNotifications != -1) { // The stack intrinsic height already contains the correct value when there is a limit // in the max number of notifications (e.g. as in keyguard). height = mIntrinsicContentHeight; } else { height = Math.max(0f, mAmbientState.getStackCutoff() - mAmbientState.getStackTop()); } mAmbientState.setStackEndHeight(height); return height; } Loading
packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -468,7 +468,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { () -> mKosmos.getDeviceUnlockedInteractor(), () -> mKosmos.getSceneInteractor(), () -> mKosmos.getSceneContainerOcclusionInteractor(), () -> mKosmos.getKeyguardClockInteractor()); () -> mKosmos.getKeyguardClockInteractor(), () -> mKosmos.getSceneBackInteractor()); KeyguardStatusView keyguardStatusView = new KeyguardStatusView(mContext); keyguardStatusView.setId(R.id.keyguard_status_view); Loading Loading @@ -625,7 +626,8 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { () -> mKosmos.getDeviceUnlockedInteractor(), () -> mKosmos.getSceneInteractor(), () -> mKosmos.getSceneContainerOcclusionInteractor(), () -> mKosmos.getKeyguardClockInteractor()), () -> mKosmos.getKeyguardClockInteractor(), () -> mKosmos.getSceneBackInteractor()), mKeyguardBypassController, mDozeParameters, mScreenOffAnimationController, Loading