Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt +9 −3 Original line number Diff line number Diff line Loading @@ -637,7 +637,9 @@ class KeyguardUnlockAnimationController @Inject constructor( * Unlock to the launcher, using in-window animations, and the smartspace shared element * transition if possible. */ private fun unlockToLauncherWithInWindowAnimations() { @VisibleForTesting fun unlockToLauncherWithInWindowAnimations() { setSurfaceBehindAppearAmount(1f, wallpapers = false) try { Loading @@ -662,7 +664,9 @@ class KeyguardUnlockAnimationController @Inject constructor( // Now that the Launcher surface (with its smartspace positioned identically to ours) is // visible, hide our smartspace. if (lockscreenSmartspace?.visibility == View.VISIBLE) { lockscreenSmartspace?.visibility = View.INVISIBLE } // Start an animation for the wallpaper, which will finish keyguard exit when it completes. fadeInWallpaper() Loading Loading @@ -914,7 +918,9 @@ class KeyguardUnlockAnimationController @Inject constructor( willUnlockWithSmartspaceTransition = false // The lockscreen surface is gone, so it is now safe to re-show the smartspace. if (lockscreenSmartspace?.visibility == View.INVISIBLE) { lockscreenSmartspace?.visibility = View.VISIBLE } listeners.forEach { it.onUnlockAnimationFinished() } } Loading packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt +79 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ import android.testing.TestableLooper.RunWithLooper import android.view.RemoteAnimationTarget import android.view.SurfaceControl import android.view.SyncRtSurfaceTransactionApplier import android.view.View import android.view.ViewRootImpl import androidx.test.filters.SmallTest import com.android.keyguard.KeyguardViewController Loading @@ -32,6 +33,7 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.atLeastOnce import org.mockito.Mockito.mock import org.mockito.Mockito.never import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.Mockito.verifyNoMoreInteractions Loading Loading @@ -374,6 +376,83 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() { verifyNoMoreInteractions(surfaceTransactionApplier) } @Test fun unlockToLauncherWithInWindowAnimations_ssViewIsVisible() { val mockLockscreenSmartspaceView = mock(View::class.java) whenever(mockLockscreenSmartspaceView.visibility).thenReturn(View.VISIBLE) keyguardUnlockAnimationController.lockscreenSmartspace = mockLockscreenSmartspaceView keyguardUnlockAnimationController.unlockToLauncherWithInWindowAnimations() verify(mockLockscreenSmartspaceView).visibility = View.INVISIBLE } @Test fun unlockToLauncherWithInWindowAnimations_ssViewIsInvisible() { val mockLockscreenSmartspaceView = mock(View::class.java) whenever(mockLockscreenSmartspaceView.visibility).thenReturn(View.INVISIBLE) keyguardUnlockAnimationController.lockscreenSmartspace = mockLockscreenSmartspaceView keyguardUnlockAnimationController.unlockToLauncherWithInWindowAnimations() verify(mockLockscreenSmartspaceView, never()).visibility = View.INVISIBLE } @Test fun unlockToLauncherWithInWindowAnimations_ssViewIsGone() { val mockLockscreenSmartspaceView = mock(View::class.java) whenever(mockLockscreenSmartspaceView.visibility).thenReturn(View.GONE) keyguardUnlockAnimationController.lockscreenSmartspace = mockLockscreenSmartspaceView keyguardUnlockAnimationController.unlockToLauncherWithInWindowAnimations() verify(mockLockscreenSmartspaceView, never()).visibility = View.INVISIBLE } @Test fun notifyFinishedKeyguardExitAnimation_ssViewIsInvisibleAndCancelledIsTrue() { val mockLockscreenSmartspaceView = mock(View::class.java) whenever(mockLockscreenSmartspaceView.visibility).thenReturn(View.INVISIBLE) keyguardUnlockAnimationController.lockscreenSmartspace = mockLockscreenSmartspaceView keyguardUnlockAnimationController.notifyFinishedKeyguardExitAnimation(true) verify(mockLockscreenSmartspaceView).visibility = View.VISIBLE } @Test fun notifyFinishedKeyguardExitAnimation_ssViewIsGoneAndCancelledIsTrue() { val mockLockscreenSmartspaceView = mock(View::class.java) whenever(mockLockscreenSmartspaceView.visibility).thenReturn(View.GONE) keyguardUnlockAnimationController.lockscreenSmartspace = mockLockscreenSmartspaceView keyguardUnlockAnimationController.notifyFinishedKeyguardExitAnimation(true) verify(mockLockscreenSmartspaceView, never()).visibility = View.VISIBLE } @Test fun notifyFinishedKeyguardExitAnimation_ssViewIsInvisibleAndCancelledIsFalse() { val mockLockscreenSmartspaceView = mock(View::class.java) whenever(mockLockscreenSmartspaceView.visibility).thenReturn(View.INVISIBLE) keyguardUnlockAnimationController.lockscreenSmartspace = mockLockscreenSmartspaceView keyguardUnlockAnimationController.notifyFinishedKeyguardExitAnimation(false) verify(mockLockscreenSmartspaceView).visibility = View.VISIBLE } @Test fun notifyFinishedKeyguardExitAnimation_ssViewIsGoneAndCancelledIsFalse() { val mockLockscreenSmartspaceView = mock(View::class.java) whenever(mockLockscreenSmartspaceView.visibility).thenReturn(View.GONE) keyguardUnlockAnimationController.lockscreenSmartspace = mockLockscreenSmartspaceView keyguardUnlockAnimationController.notifyFinishedKeyguardExitAnimation(false) verify(mockLockscreenSmartspaceView, never()).visibility = View.VISIBLE } private class ArgThatCaptor<T> { private var allArgs: MutableList<T> = mutableListOf() Loading Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt +9 −3 Original line number Diff line number Diff line Loading @@ -637,7 +637,9 @@ class KeyguardUnlockAnimationController @Inject constructor( * Unlock to the launcher, using in-window animations, and the smartspace shared element * transition if possible. */ private fun unlockToLauncherWithInWindowAnimations() { @VisibleForTesting fun unlockToLauncherWithInWindowAnimations() { setSurfaceBehindAppearAmount(1f, wallpapers = false) try { Loading @@ -662,7 +664,9 @@ class KeyguardUnlockAnimationController @Inject constructor( // Now that the Launcher surface (with its smartspace positioned identically to ours) is // visible, hide our smartspace. if (lockscreenSmartspace?.visibility == View.VISIBLE) { lockscreenSmartspace?.visibility = View.INVISIBLE } // Start an animation for the wallpaper, which will finish keyguard exit when it completes. fadeInWallpaper() Loading Loading @@ -914,7 +918,9 @@ class KeyguardUnlockAnimationController @Inject constructor( willUnlockWithSmartspaceTransition = false // The lockscreen surface is gone, so it is now safe to re-show the smartspace. if (lockscreenSmartspace?.visibility == View.INVISIBLE) { lockscreenSmartspace?.visibility = View.VISIBLE } listeners.forEach { it.onUnlockAnimationFinished() } } Loading
packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt +79 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ import android.testing.TestableLooper.RunWithLooper import android.view.RemoteAnimationTarget import android.view.SurfaceControl import android.view.SyncRtSurfaceTransactionApplier import android.view.View import android.view.ViewRootImpl import androidx.test.filters.SmallTest import com.android.keyguard.KeyguardViewController Loading @@ -32,6 +33,7 @@ import org.junit.runner.RunWith import org.mockito.Mock import org.mockito.Mockito.atLeastOnce import org.mockito.Mockito.mock import org.mockito.Mockito.never import org.mockito.Mockito.times import org.mockito.Mockito.verify import org.mockito.Mockito.verifyNoMoreInteractions Loading Loading @@ -374,6 +376,83 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() { verifyNoMoreInteractions(surfaceTransactionApplier) } @Test fun unlockToLauncherWithInWindowAnimations_ssViewIsVisible() { val mockLockscreenSmartspaceView = mock(View::class.java) whenever(mockLockscreenSmartspaceView.visibility).thenReturn(View.VISIBLE) keyguardUnlockAnimationController.lockscreenSmartspace = mockLockscreenSmartspaceView keyguardUnlockAnimationController.unlockToLauncherWithInWindowAnimations() verify(mockLockscreenSmartspaceView).visibility = View.INVISIBLE } @Test fun unlockToLauncherWithInWindowAnimations_ssViewIsInvisible() { val mockLockscreenSmartspaceView = mock(View::class.java) whenever(mockLockscreenSmartspaceView.visibility).thenReturn(View.INVISIBLE) keyguardUnlockAnimationController.lockscreenSmartspace = mockLockscreenSmartspaceView keyguardUnlockAnimationController.unlockToLauncherWithInWindowAnimations() verify(mockLockscreenSmartspaceView, never()).visibility = View.INVISIBLE } @Test fun unlockToLauncherWithInWindowAnimations_ssViewIsGone() { val mockLockscreenSmartspaceView = mock(View::class.java) whenever(mockLockscreenSmartspaceView.visibility).thenReturn(View.GONE) keyguardUnlockAnimationController.lockscreenSmartspace = mockLockscreenSmartspaceView keyguardUnlockAnimationController.unlockToLauncherWithInWindowAnimations() verify(mockLockscreenSmartspaceView, never()).visibility = View.INVISIBLE } @Test fun notifyFinishedKeyguardExitAnimation_ssViewIsInvisibleAndCancelledIsTrue() { val mockLockscreenSmartspaceView = mock(View::class.java) whenever(mockLockscreenSmartspaceView.visibility).thenReturn(View.INVISIBLE) keyguardUnlockAnimationController.lockscreenSmartspace = mockLockscreenSmartspaceView keyguardUnlockAnimationController.notifyFinishedKeyguardExitAnimation(true) verify(mockLockscreenSmartspaceView).visibility = View.VISIBLE } @Test fun notifyFinishedKeyguardExitAnimation_ssViewIsGoneAndCancelledIsTrue() { val mockLockscreenSmartspaceView = mock(View::class.java) whenever(mockLockscreenSmartspaceView.visibility).thenReturn(View.GONE) keyguardUnlockAnimationController.lockscreenSmartspace = mockLockscreenSmartspaceView keyguardUnlockAnimationController.notifyFinishedKeyguardExitAnimation(true) verify(mockLockscreenSmartspaceView, never()).visibility = View.VISIBLE } @Test fun notifyFinishedKeyguardExitAnimation_ssViewIsInvisibleAndCancelledIsFalse() { val mockLockscreenSmartspaceView = mock(View::class.java) whenever(mockLockscreenSmartspaceView.visibility).thenReturn(View.INVISIBLE) keyguardUnlockAnimationController.lockscreenSmartspace = mockLockscreenSmartspaceView keyguardUnlockAnimationController.notifyFinishedKeyguardExitAnimation(false) verify(mockLockscreenSmartspaceView).visibility = View.VISIBLE } @Test fun notifyFinishedKeyguardExitAnimation_ssViewIsGoneAndCancelledIsFalse() { val mockLockscreenSmartspaceView = mock(View::class.java) whenever(mockLockscreenSmartspaceView.visibility).thenReturn(View.GONE) keyguardUnlockAnimationController.lockscreenSmartspace = mockLockscreenSmartspaceView keyguardUnlockAnimationController.notifyFinishedKeyguardExitAnimation(false) verify(mockLockscreenSmartspaceView, never()).visibility = View.VISIBLE } private class ArgThatCaptor<T> { private var allArgs: MutableList<T> = mutableListOf() Loading