Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToGlanceableHubTransitionViewModelTest.kt 0 → 100644 +68 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.keyguard.ui.viewmodel import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.keyguard.ui.transitions.blurConfig import com.android.systemui.kosmos.collectValues import com.android.systemui.kosmos.runTest import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import org.junit.Test import org.junit.runner.RunWith @SmallTest @DisableSceneContainer @RunWith(AndroidJUnit4::class) class AodToGlanceableHubTransitionViewModelTest : SysuiTestCase() { val kosmos = testKosmos() val testScope = kosmos.testScope val keyguardTransitionRepository = kosmos.fakeKeyguardTransitionRepository val configurationRepository = kosmos.fakeConfigurationRepository val underTest by lazy { kosmos.aodToGlanceableHubTransitionViewModel } @Test fun blurBecomesMaxValueImmediately() = kosmos.runTest { val values by collectValues(underTest.windowBlurRadius) keyguardWindowBlurTestUtil.assertTransitionToBlurRadius( transitionProgress = listOf(0.0f, 0.2f, 0.3f, 0.6f, 0.7f, 1.0f), startValue = blurConfig.minBlurRadiusPx, endValue = blurConfig.maxBlurRadiusPx, actualValuesProvider = { values }, transitionFactory = { step, transitionState -> TransitionStep( from = KeyguardState.AOD, to = KeyguardState.GLANCEABLE_HUB, value = step, transitionState = transitionState, ownerName = "AodToGlanceableHubTransitionViewModelTest", ) }, checkInterpolatedValues = false, ) } } packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GlanceableHubToAodTransitionViewModelTest.kt 0 → 100644 +68 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.keyguard.ui.viewmodel import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.keyguard.ui.transitions.blurConfig import com.android.systemui.kosmos.collectValues import com.android.systemui.kosmos.runTest import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import org.junit.Test import org.junit.runner.RunWith @SmallTest @DisableSceneContainer @RunWith(AndroidJUnit4::class) class GlanceableHubToAodTransitionViewModelTest : SysuiTestCase() { val kosmos = testKosmos() val testScope = kosmos.testScope val keyguardTransitionRepository = kosmos.fakeKeyguardTransitionRepository val configurationRepository = kosmos.fakeConfigurationRepository val underTest by lazy { kosmos.glanceableHubToAodTransitionViewModel } @Test fun blurBecomesMinValueImmediately() = kosmos.runTest { val values by collectValues(underTest.windowBlurRadius) keyguardWindowBlurTestUtil.assertTransitionToBlurRadius( transitionProgress = listOf(0.0f, 0.2f, 0.3f, 0.6f, 0.7f, 1.0f), startValue = blurConfig.maxBlurRadiusPx, endValue = blurConfig.minBlurRadiusPx, actualValuesProvider = { values }, transitionFactory = { step, transitionState -> TransitionStep( from = KeyguardState.GLANCEABLE_HUB, to = KeyguardState.AOD, value = step, transitionState = transitionState, ownerName = "GlanceableHubToAodTransitionViewModelTest", ) }, checkInterpolatedValues = false, ) } } packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt +0 −71 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ import com.android.systemui.keyguard.domain.interactor.pulseExpansionInteractor import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.TransitionState import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel.Companion.DEPTH_PUSH_WALLPAPER_FROM_GLANCEABLE_HUB import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel.Companion.PUSHBACK_SCALE_FOR_LOCKSCREEN import com.android.systemui.kosmos.collectLastValue import com.android.systemui.kosmos.runCurrent Loading Loading @@ -551,76 +550,6 @@ class KeyguardRootViewModelTest(flags: FlagsParameterization) : SysuiTestCase() assertThat(alpha).isEqualTo(1.0f) } @Test @EnableFlags(FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION) @DisableSceneContainer fun wallpaperZoomOut_transitionFromLockscreenToHubAndBack() = testScope.runTest { val zoomOut by collectLastValue(underTest.wallpaperZoomOut) val transitionState: MutableStateFlow<ObservableTransitionState> = MutableStateFlow( ObservableTransitionState.Transition( fromScene = CommunalScenes.Blank, toScene = CommunalScenes.Communal, currentScene = flowOf(CommunalScenes.Communal), progress = flowOf(0f), isInitiatedByUserInput = true, isUserInputOngoing = flowOf(false), ) ) // Start transition to communal communalRepository.setTransitionState(transitionState) keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.LOCKSCREEN, to = KeyguardState.GLANCEABLE_HUB, testScope, ) // Finish transition to communal transitionState.value = ObservableTransitionState.Idle(CommunalScenes.Communal) assertThat(zoomOut).isEqualTo(DEPTH_PUSH_WALLPAPER_FROM_GLANCEABLE_HUB) // Start transitioning back. keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.GLANCEABLE_HUB, to = KeyguardState.LOCKSCREEN, testScope, ) transitionState.value = ObservableTransitionState.Idle(CommunalScenes.Blank) assertThat(zoomOut).isEqualTo(0f) } @Test @DisableSceneContainer @EnableFlags(FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION) fun wallpaperZoomOut_reset_transitionedAwayFromHub() = testScope.runTest { val zoomOut by collectLastValue(underTest.wallpaperZoomOut) val transitionState: MutableStateFlow<ObservableTransitionState> = MutableStateFlow(ObservableTransitionState.Idle(CommunalScenes.Blank)) // Transition to the glanceable hub and then to bouncer. keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.LOCKSCREEN, to = KeyguardState.GLANCEABLE_HUB, testScope, ) transitionState.value = ObservableTransitionState.Idle(CommunalScenes.Communal) keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.GLANCEABLE_HUB, to = KeyguardState.PRIMARY_BOUNCER, testScope, ) transitionState.value = ObservableTransitionState.Idle(CommunalScenes.Blank) assertThat(zoomOut).isEqualTo(0f) } @Test @DisableSceneContainer @EnableFlags(FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION) Loading packages/SystemUI/multivalentTests/src/com/android/systemui/window/ui/viewmodel/WindowRootViewModelTest.kt +71 −0 Original line number Diff line number Diff line Loading @@ -16,17 +16,23 @@ package com.android.systemui.window.ui.viewmodel import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.compose.animation.scene.ObservableTransitionState import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.communal.data.repository.communalSceneRepository import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.coroutines.collectLastValue import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.window.data.repository.fakeWindowRootViewBlurRepository import com.android.systemui.window.data.repository.windowRootViewBlurRepository import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test Loading @@ -38,6 +44,7 @@ import org.junit.runner.RunWith class WindowRootViewModelTest : SysuiTestCase() { val kosmos = testKosmos() val testScope = kosmos.testScope private val communalRepository by lazy { kosmos.communalSceneRepository } val underTest by lazy { kosmos.windowRootViewModel } Loading Loading @@ -78,4 +85,68 @@ class WindowRootViewModelTest : SysuiTestCase() { assertThat(blurRadius).isEqualTo(0f) } @Test @DisableSceneContainer @EnableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION) fun blurScale_changes_onZoomOutFromGlanceableHubFlagEnabled() = testScope.runTest { kosmos.fakeWindowRootViewBlurRepository.isBlurSupported.value = true val blurScale by collectLastValue(underTest.blurScale) // Communal scene is visible val transitionState: MutableStateFlow<ObservableTransitionState> = MutableStateFlow(ObservableTransitionState.Idle(CommunalScenes.Communal)) communalRepository.setTransitionState(transitionState) kosmos.fakeGlanceableHubTransitions.first().zoomOut.value = 0.95f runCurrent() assertThat(blurScale).isEqualTo(0.95f) } @Test @DisableSceneContainer @EnableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION) fun blurScale_reset_onExitCommunalScene() = testScope.runTest { kosmos.fakeWindowRootViewBlurRepository.isBlurSupported.value = true val blurScale by collectLastValue(underTest.blurScale) // Communal scene is visible val transitionState: MutableStateFlow<ObservableTransitionState> = MutableStateFlow(ObservableTransitionState.Idle(CommunalScenes.Communal)) communalRepository.setTransitionState(transitionState) kosmos.fakeGlanceableHubTransitions.first().zoomOut.value = 0.95f runCurrent() assertThat(blurScale).isEqualTo(0.95f) // Fully exits communal scene transitionState.value = ObservableTransitionState.Idle(CommunalScenes.Blank) // Scale is reset assertThat(blurScale).isEqualTo(1f) } @Test @DisableSceneContainer @DisableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION) fun blurScale_doesNotChange_onZoomOutFromGlanceableHubFlagDisabled() = testScope.runTest { kosmos.fakeWindowRootViewBlurRepository.isBlurSupported.value = true val blurScale by collectLastValue(underTest.blurScale) // Communal scene is visible val transitionState: MutableStateFlow<ObservableTransitionState> = MutableStateFlow(ObservableTransitionState.Idle(CommunalScenes.Communal)) communalRepository.setTransitionState(transitionState) kosmos.fakeGlanceableHubTransitions.first().zoomOut.value = 0.95f runCurrent() // Scale is not changed assertThat(blurScale).isEqualTo(1f) } } packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt +0 −3 Original line number Diff line number Diff line Loading @@ -52,7 +52,6 @@ import com.android.systemui.statusbar.VibratorHelper import com.android.systemui.statusbar.phone.ScreenOffAnimationController import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator import com.android.systemui.util.WallpaperController import com.android.systemui.wallpapers.ui.viewmodel.WallpaperViewModel import com.google.android.msdl.domain.MSDLPlayer import java.util.Optional Loading Loading @@ -92,7 +91,6 @@ constructor( @Main private val mainDispatcher: CoroutineDispatcher, private val msdlPlayer: MSDLPlayer, @KeyguardBlueprintLog private val blueprintLog: LogBuffer, private val wallpaperController: WallpaperController, ) : CoreStartable { private var rootViewHandle: DisposableHandle? = null Loading Loading @@ -154,7 +152,6 @@ constructor( mainDispatcher, msdlPlayer, blueprintLog, wallpaperController, ) } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/AodToGlanceableHubTransitionViewModelTest.kt 0 → 100644 +68 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.keyguard.ui.viewmodel import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.keyguard.ui.transitions.blurConfig import com.android.systemui.kosmos.collectValues import com.android.systemui.kosmos.runTest import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import org.junit.Test import org.junit.runner.RunWith @SmallTest @DisableSceneContainer @RunWith(AndroidJUnit4::class) class AodToGlanceableHubTransitionViewModelTest : SysuiTestCase() { val kosmos = testKosmos() val testScope = kosmos.testScope val keyguardTransitionRepository = kosmos.fakeKeyguardTransitionRepository val configurationRepository = kosmos.fakeConfigurationRepository val underTest by lazy { kosmos.aodToGlanceableHubTransitionViewModel } @Test fun blurBecomesMaxValueImmediately() = kosmos.runTest { val values by collectValues(underTest.windowBlurRadius) keyguardWindowBlurTestUtil.assertTransitionToBlurRadius( transitionProgress = listOf(0.0f, 0.2f, 0.3f, 0.6f, 0.7f, 1.0f), startValue = blurConfig.minBlurRadiusPx, endValue = blurConfig.maxBlurRadiusPx, actualValuesProvider = { values }, transitionFactory = { step, transitionState -> TransitionStep( from = KeyguardState.AOD, to = KeyguardState.GLANCEABLE_HUB, value = step, transitionState = transitionState, ownerName = "AodToGlanceableHubTransitionViewModelTest", ) }, checkInterpolatedValues = false, ) } }
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/GlanceableHubToAodTransitionViewModelTest.kt 0 → 100644 +68 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.keyguard.ui.viewmodel import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.common.ui.data.repository.fakeConfigurationRepository import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.keyguard.ui.transitions.blurConfig import com.android.systemui.kosmos.collectValues import com.android.systemui.kosmos.runTest import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import org.junit.Test import org.junit.runner.RunWith @SmallTest @DisableSceneContainer @RunWith(AndroidJUnit4::class) class GlanceableHubToAodTransitionViewModelTest : SysuiTestCase() { val kosmos = testKosmos() val testScope = kosmos.testScope val keyguardTransitionRepository = kosmos.fakeKeyguardTransitionRepository val configurationRepository = kosmos.fakeConfigurationRepository val underTest by lazy { kosmos.glanceableHubToAodTransitionViewModel } @Test fun blurBecomesMinValueImmediately() = kosmos.runTest { val values by collectValues(underTest.windowBlurRadius) keyguardWindowBlurTestUtil.assertTransitionToBlurRadius( transitionProgress = listOf(0.0f, 0.2f, 0.3f, 0.6f, 0.7f, 1.0f), startValue = blurConfig.maxBlurRadiusPx, endValue = blurConfig.minBlurRadiusPx, actualValuesProvider = { values }, transitionFactory = { step, transitionState -> TransitionStep( from = KeyguardState.GLANCEABLE_HUB, to = KeyguardState.AOD, value = step, transitionState = transitionState, ownerName = "GlanceableHubToAodTransitionViewModelTest", ) }, checkInterpolatedValues = false, ) } }
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardRootViewModelTest.kt +0 −71 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ import com.android.systemui.keyguard.domain.interactor.pulseExpansionInteractor import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.keyguard.shared.model.TransitionState import com.android.systemui.keyguard.shared.model.TransitionStep import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel.Companion.DEPTH_PUSH_WALLPAPER_FROM_GLANCEABLE_HUB import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel.Companion.PUSHBACK_SCALE_FOR_LOCKSCREEN import com.android.systemui.kosmos.collectLastValue import com.android.systemui.kosmos.runCurrent Loading Loading @@ -551,76 +550,6 @@ class KeyguardRootViewModelTest(flags: FlagsParameterization) : SysuiTestCase() assertThat(alpha).isEqualTo(1.0f) } @Test @EnableFlags(FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION) @DisableSceneContainer fun wallpaperZoomOut_transitionFromLockscreenToHubAndBack() = testScope.runTest { val zoomOut by collectLastValue(underTest.wallpaperZoomOut) val transitionState: MutableStateFlow<ObservableTransitionState> = MutableStateFlow( ObservableTransitionState.Transition( fromScene = CommunalScenes.Blank, toScene = CommunalScenes.Communal, currentScene = flowOf(CommunalScenes.Communal), progress = flowOf(0f), isInitiatedByUserInput = true, isUserInputOngoing = flowOf(false), ) ) // Start transition to communal communalRepository.setTransitionState(transitionState) keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.LOCKSCREEN, to = KeyguardState.GLANCEABLE_HUB, testScope, ) // Finish transition to communal transitionState.value = ObservableTransitionState.Idle(CommunalScenes.Communal) assertThat(zoomOut).isEqualTo(DEPTH_PUSH_WALLPAPER_FROM_GLANCEABLE_HUB) // Start transitioning back. keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.GLANCEABLE_HUB, to = KeyguardState.LOCKSCREEN, testScope, ) transitionState.value = ObservableTransitionState.Idle(CommunalScenes.Blank) assertThat(zoomOut).isEqualTo(0f) } @Test @DisableSceneContainer @EnableFlags(FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION) fun wallpaperZoomOut_reset_transitionedAwayFromHub() = testScope.runTest { val zoomOut by collectLastValue(underTest.wallpaperZoomOut) val transitionState: MutableStateFlow<ObservableTransitionState> = MutableStateFlow(ObservableTransitionState.Idle(CommunalScenes.Blank)) // Transition to the glanceable hub and then to bouncer. keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.LOCKSCREEN, to = KeyguardState.GLANCEABLE_HUB, testScope, ) transitionState.value = ObservableTransitionState.Idle(CommunalScenes.Communal) keyguardTransitionRepository.sendTransitionSteps( from = KeyguardState.GLANCEABLE_HUB, to = KeyguardState.PRIMARY_BOUNCER, testScope, ) transitionState.value = ObservableTransitionState.Idle(CommunalScenes.Blank) assertThat(zoomOut).isEqualTo(0f) } @Test @DisableSceneContainer @EnableFlags(FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION) Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/window/ui/viewmodel/WindowRootViewModelTest.kt +71 −0 Original line number Diff line number Diff line Loading @@ -16,17 +16,23 @@ package com.android.systemui.window.ui.viewmodel import android.platform.test.annotations.DisableFlags import android.platform.test.annotations.EnableFlags import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.compose.animation.scene.ObservableTransitionState import com.android.systemui.Flags import com.android.systemui.SysuiTestCase import com.android.systemui.communal.data.repository.communalSceneRepository import com.android.systemui.communal.shared.model.CommunalScenes import com.android.systemui.coroutines.collectLastValue import com.android.systemui.flags.DisableSceneContainer import com.android.systemui.kosmos.testScope import com.android.systemui.testKosmos import com.android.systemui.window.data.repository.fakeWindowRootViewBlurRepository import com.android.systemui.window.data.repository.windowRootViewBlurRepository import com.google.common.truth.Truth.assertThat import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runCurrent import kotlinx.coroutines.test.runTest import org.junit.Test Loading @@ -38,6 +44,7 @@ import org.junit.runner.RunWith class WindowRootViewModelTest : SysuiTestCase() { val kosmos = testKosmos() val testScope = kosmos.testScope private val communalRepository by lazy { kosmos.communalSceneRepository } val underTest by lazy { kosmos.windowRootViewModel } Loading Loading @@ -78,4 +85,68 @@ class WindowRootViewModelTest : SysuiTestCase() { assertThat(blurRadius).isEqualTo(0f) } @Test @DisableSceneContainer @EnableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION) fun blurScale_changes_onZoomOutFromGlanceableHubFlagEnabled() = testScope.runTest { kosmos.fakeWindowRootViewBlurRepository.isBlurSupported.value = true val blurScale by collectLastValue(underTest.blurScale) // Communal scene is visible val transitionState: MutableStateFlow<ObservableTransitionState> = MutableStateFlow(ObservableTransitionState.Idle(CommunalScenes.Communal)) communalRepository.setTransitionState(transitionState) kosmos.fakeGlanceableHubTransitions.first().zoomOut.value = 0.95f runCurrent() assertThat(blurScale).isEqualTo(0.95f) } @Test @DisableSceneContainer @EnableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION) fun blurScale_reset_onExitCommunalScene() = testScope.runTest { kosmos.fakeWindowRootViewBlurRepository.isBlurSupported.value = true val blurScale by collectLastValue(underTest.blurScale) // Communal scene is visible val transitionState: MutableStateFlow<ObservableTransitionState> = MutableStateFlow(ObservableTransitionState.Idle(CommunalScenes.Communal)) communalRepository.setTransitionState(transitionState) kosmos.fakeGlanceableHubTransitions.first().zoomOut.value = 0.95f runCurrent() assertThat(blurScale).isEqualTo(0.95f) // Fully exits communal scene transitionState.value = ObservableTransitionState.Idle(CommunalScenes.Blank) // Scale is reset assertThat(blurScale).isEqualTo(1f) } @Test @DisableSceneContainer @DisableFlags(Flags.FLAG_GESTURE_BETWEEN_HUB_AND_LOCKSCREEN_MOTION) fun blurScale_doesNotChange_onZoomOutFromGlanceableHubFlagDisabled() = testScope.runTest { kosmos.fakeWindowRootViewBlurRepository.isBlurSupported.value = true val blurScale by collectLastValue(underTest.blurScale) // Communal scene is visible val transitionState: MutableStateFlow<ObservableTransitionState> = MutableStateFlow(ObservableTransitionState.Idle(CommunalScenes.Communal)) communalRepository.setTransitionState(transitionState) kosmos.fakeGlanceableHubTransitions.first().zoomOut.value = 0.95f runCurrent() // Scale is not changed assertThat(blurScale).isEqualTo(1f) } }
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewConfigurator.kt +0 −3 Original line number Diff line number Diff line Loading @@ -52,7 +52,6 @@ import com.android.systemui.statusbar.VibratorHelper import com.android.systemui.statusbar.phone.ScreenOffAnimationController import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator import com.android.systemui.util.WallpaperController import com.android.systemui.wallpapers.ui.viewmodel.WallpaperViewModel import com.google.android.msdl.domain.MSDLPlayer import java.util.Optional Loading Loading @@ -92,7 +91,6 @@ constructor( @Main private val mainDispatcher: CoroutineDispatcher, private val msdlPlayer: MSDLPlayer, @KeyguardBlueprintLog private val blueprintLog: LogBuffer, private val wallpaperController: WallpaperController, ) : CoreStartable { private var rootViewHandle: DisposableHandle? = null Loading Loading @@ -154,7 +152,6 @@ constructor( mainDispatcher, msdlPlayer, blueprintLog, wallpaperController, ) } Loading