Loading packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/WindowManagerLockscreenVisibilityManagerTest.kt +8 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.internal.widget.LockPatternUtils import com.android.systemui.SysuiTestCase import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor import com.android.systemui.keyguard.WindowManagerLockscreenVisibilityManager import com.android.systemui.keyguard.domain.interactor.KeyguardDismissTransitionInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardShowWhileAwakeInteractor Loading @@ -36,6 +37,7 @@ import com.android.systemui.util.concurrency.FakeExecutor import com.android.systemui.util.time.FakeSystemClock import com.android.window.flags.Flags import com.android.wm.shell.keyguard.KeyguardTransitions import kotlinx.coroutines.flow.MutableStateFlow import org.junit.Before import org.junit.Rule import org.junit.Test Loading Loading @@ -74,6 +76,7 @@ class WindowManagerLockscreenVisibilityManagerTest : SysuiTestCase() { @Mock private lateinit var lockPatternUtils: LockPatternUtils @Mock private lateinit var keyguardShowWhileAwakeInteractor: KeyguardShowWhileAwakeInteractor @Mock private lateinit var selectedUserInteractor: SelectedUserInteractor @Mock private lateinit var deviceEntryInteractor: DeviceEntryInteractor @Before fun setUp() { Loading @@ -93,6 +96,7 @@ class WindowManagerLockscreenVisibilityManagerTest : SysuiTestCase() { selectedUserInteractor = selectedUserInteractor, lockPatternUtils = lockPatternUtils, keyguardShowWhileAwakeInteractor = keyguardShowWhileAwakeInteractor, deviceEntryInteractor = { deviceEntryInteractor }, ) } Loading Loading @@ -287,6 +291,10 @@ class WindowManagerLockscreenVisibilityManagerTest : SysuiTestCase() { .whenever(keyguardDismissTransitionInteractor) .startDismissKeyguardTransition(any(), any()) // Or, if flexiglass is enabled, return that the device is already entered so that we call // the callback immediately. whenever(deviceEntryInteractor.isDeviceEntered).thenReturn(MutableStateFlow(true)) whenever(selectedUserInteractor.getSelectedUserId()).thenReturn(-1) underTest.onKeyguardGoingAwayRemoteAnimationStart( Loading packages/SystemUI/src/com/android/systemui/keyguard/WindowManagerLockscreenVisibilityManager.kt +31 −18 Original line number Diff line number Diff line Loading @@ -26,9 +26,11 @@ import com.android.internal.widget.LockPatternUtils import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.dagger.qualifiers.UiBackground import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardDismissTransitionInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardShowWhileAwakeInteractor import com.android.systemui.keyguard.ui.binder.KeyguardSurfaceBehindParamsApplier import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.user.domain.interactor.SelectedUserInteractor import com.android.window.flags.Flags Loading @@ -54,6 +56,7 @@ constructor( private val selectedUserInteractor: SelectedUserInteractor, private val lockPatternUtils: LockPatternUtils, private val keyguardShowWhileAwakeInteractor: KeyguardShowWhileAwakeInteractor, private val deviceEntryInteractor: dagger.Lazy<DeviceEntryInteractor>, ) { /** Loading Loading @@ -204,16 +207,12 @@ constructor( // If we weren't expecting the keyguard to be going away, WM triggered this transition. if (!isKeyguardGoingAway) { // Since WM triggered this, we're likely not transitioning to GONE yet. See if we can // start that transition. keyguardDismissTransitionInteractor.startDismissKeyguardTransition( reason = "Going away remote animation started", onAlreadyGone = { // Called if we're already GONE by the time the dismiss transition would have // started. This can happen due to timing issues, where the remote animation // took a long time to start, and something else caused us to unlock in the // meantime. Since we're already GONE, simply end the remote animation // immediately. val alreadyGoneCallback = { // Called if we're already GONE by the time the dismiss transition would // have started. This can happen due to timing issues, where the remote // animation took a long time to start, and something else caused us to // unlock in the meantime. Since we're already GONE, simply end the remote // animation immediately. Log.d( TAG, "onKeyguardGoingAwayRemoteAnimationStart: " + Loading @@ -222,8 +221,22 @@ constructor( ) finishedCallback.onAnimationFinished() isKeyguardGoingAway = false }, } // Since WM triggered this, we're likely not transitioning to GONE yet. See if we can // start that transition. if (SceneContainerFlag.isEnabled) { if (deviceEntryInteractor.get().isDeviceEntered.value) { alreadyGoneCallback.invoke() } else { deviceEntryInteractor.get().attemptDeviceEntry() } } else { keyguardDismissTransitionInteractor.startDismissKeyguardTransition( reason = "Going away remote animation started", onAlreadyGone = alreadyGoneCallback, ) } isKeyguardGoingAway = true } Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/binder/WindowManagerLockscreenVisibilityManagerTest.kt +8 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.internal.widget.LockPatternUtils import com.android.systemui.SysuiTestCase import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor import com.android.systemui.keyguard.WindowManagerLockscreenVisibilityManager import com.android.systemui.keyguard.domain.interactor.KeyguardDismissTransitionInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardShowWhileAwakeInteractor Loading @@ -36,6 +37,7 @@ import com.android.systemui.util.concurrency.FakeExecutor import com.android.systemui.util.time.FakeSystemClock import com.android.window.flags.Flags import com.android.wm.shell.keyguard.KeyguardTransitions import kotlinx.coroutines.flow.MutableStateFlow import org.junit.Before import org.junit.Rule import org.junit.Test Loading Loading @@ -74,6 +76,7 @@ class WindowManagerLockscreenVisibilityManagerTest : SysuiTestCase() { @Mock private lateinit var lockPatternUtils: LockPatternUtils @Mock private lateinit var keyguardShowWhileAwakeInteractor: KeyguardShowWhileAwakeInteractor @Mock private lateinit var selectedUserInteractor: SelectedUserInteractor @Mock private lateinit var deviceEntryInteractor: DeviceEntryInteractor @Before fun setUp() { Loading @@ -93,6 +96,7 @@ class WindowManagerLockscreenVisibilityManagerTest : SysuiTestCase() { selectedUserInteractor = selectedUserInteractor, lockPatternUtils = lockPatternUtils, keyguardShowWhileAwakeInteractor = keyguardShowWhileAwakeInteractor, deviceEntryInteractor = { deviceEntryInteractor }, ) } Loading Loading @@ -287,6 +291,10 @@ class WindowManagerLockscreenVisibilityManagerTest : SysuiTestCase() { .whenever(keyguardDismissTransitionInteractor) .startDismissKeyguardTransition(any(), any()) // Or, if flexiglass is enabled, return that the device is already entered so that we call // the callback immediately. whenever(deviceEntryInteractor.isDeviceEntered).thenReturn(MutableStateFlow(true)) whenever(selectedUserInteractor.getSelectedUserId()).thenReturn(-1) underTest.onKeyguardGoingAwayRemoteAnimationStart( Loading
packages/SystemUI/src/com/android/systemui/keyguard/WindowManagerLockscreenVisibilityManager.kt +31 −18 Original line number Diff line number Diff line Loading @@ -26,9 +26,11 @@ import com.android.internal.widget.LockPatternUtils import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.dagger.qualifiers.UiBackground import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardDismissTransitionInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardShowWhileAwakeInteractor import com.android.systemui.keyguard.ui.binder.KeyguardSurfaceBehindParamsApplier import com.android.systemui.scene.shared.flag.SceneContainerFlag import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.user.domain.interactor.SelectedUserInteractor import com.android.window.flags.Flags Loading @@ -54,6 +56,7 @@ constructor( private val selectedUserInteractor: SelectedUserInteractor, private val lockPatternUtils: LockPatternUtils, private val keyguardShowWhileAwakeInteractor: KeyguardShowWhileAwakeInteractor, private val deviceEntryInteractor: dagger.Lazy<DeviceEntryInteractor>, ) { /** Loading Loading @@ -204,16 +207,12 @@ constructor( // If we weren't expecting the keyguard to be going away, WM triggered this transition. if (!isKeyguardGoingAway) { // Since WM triggered this, we're likely not transitioning to GONE yet. See if we can // start that transition. keyguardDismissTransitionInteractor.startDismissKeyguardTransition( reason = "Going away remote animation started", onAlreadyGone = { // Called if we're already GONE by the time the dismiss transition would have // started. This can happen due to timing issues, where the remote animation // took a long time to start, and something else caused us to unlock in the // meantime. Since we're already GONE, simply end the remote animation // immediately. val alreadyGoneCallback = { // Called if we're already GONE by the time the dismiss transition would // have started. This can happen due to timing issues, where the remote // animation took a long time to start, and something else caused us to // unlock in the meantime. Since we're already GONE, simply end the remote // animation immediately. Log.d( TAG, "onKeyguardGoingAwayRemoteAnimationStart: " + Loading @@ -222,8 +221,22 @@ constructor( ) finishedCallback.onAnimationFinished() isKeyguardGoingAway = false }, } // Since WM triggered this, we're likely not transitioning to GONE yet. See if we can // start that transition. if (SceneContainerFlag.isEnabled) { if (deviceEntryInteractor.get().isDeviceEntered.value) { alreadyGoneCallback.invoke() } else { deviceEntryInteractor.get().attemptDeviceEntry() } } else { keyguardDismissTransitionInteractor.startDismissKeyguardTransition( reason = "Going away remote animation started", onAlreadyGone = alreadyGoneCallback, ) } isKeyguardGoingAway = true } Loading