Merge "Fixes Smartspace jumps issue during unlock animation" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
66b0e8ad1e
@@ -637,7 +637,9 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
* Unlock to the launcher, using in-window animations, and the smartspace shared element
|
* Unlock to the launcher, using in-window animations, and the smartspace shared element
|
||||||
* transition if possible.
|
* transition if possible.
|
||||||
*/
|
*/
|
||||||
private fun unlockToLauncherWithInWindowAnimations() {
|
|
||||||
|
@VisibleForTesting
|
||||||
|
fun unlockToLauncherWithInWindowAnimations() {
|
||||||
setSurfaceBehindAppearAmount(1f, wallpapers = false)
|
setSurfaceBehindAppearAmount(1f, wallpapers = false)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -662,7 +664,9 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
|
|
||||||
// Now that the Launcher surface (with its smartspace positioned identically to ours) is
|
// Now that the Launcher surface (with its smartspace positioned identically to ours) is
|
||||||
// visible, hide our smartspace.
|
// visible, hide our smartspace.
|
||||||
lockscreenSmartspace?.visibility = View.INVISIBLE
|
if (lockscreenSmartspace?.visibility == View.VISIBLE) {
|
||||||
|
lockscreenSmartspace?.visibility = View.INVISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
// Start an animation for the wallpaper, which will finish keyguard exit when it completes.
|
// Start an animation for the wallpaper, which will finish keyguard exit when it completes.
|
||||||
fadeInWallpaper()
|
fadeInWallpaper()
|
||||||
@@ -914,7 +918,9 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
willUnlockWithSmartspaceTransition = false
|
willUnlockWithSmartspaceTransition = false
|
||||||
|
|
||||||
// The lockscreen surface is gone, so it is now safe to re-show the smartspace.
|
// The lockscreen surface is gone, so it is now safe to re-show the smartspace.
|
||||||
lockscreenSmartspace?.visibility = View.VISIBLE
|
if (lockscreenSmartspace?.visibility == View.INVISIBLE) {
|
||||||
|
lockscreenSmartspace?.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
listeners.forEach { it.onUnlockAnimationFinished() }
|
listeners.forEach { it.onUnlockAnimationFinished() }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import android.testing.TestableLooper.RunWithLooper
|
|||||||
import android.view.RemoteAnimationTarget
|
import android.view.RemoteAnimationTarget
|
||||||
import android.view.SurfaceControl
|
import android.view.SurfaceControl
|
||||||
import android.view.SyncRtSurfaceTransactionApplier
|
import android.view.SyncRtSurfaceTransactionApplier
|
||||||
|
import android.view.View
|
||||||
import android.view.ViewRootImpl
|
import android.view.ViewRootImpl
|
||||||
import androidx.test.filters.SmallTest
|
import androidx.test.filters.SmallTest
|
||||||
import com.android.keyguard.KeyguardViewController
|
import com.android.keyguard.KeyguardViewController
|
||||||
@@ -32,6 +33,7 @@ import org.junit.runner.RunWith
|
|||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito.atLeastOnce
|
import org.mockito.Mockito.atLeastOnce
|
||||||
import org.mockito.Mockito.mock
|
import org.mockito.Mockito.mock
|
||||||
|
import org.mockito.Mockito.never
|
||||||
import org.mockito.Mockito.times
|
import org.mockito.Mockito.times
|
||||||
import org.mockito.Mockito.verify
|
import org.mockito.Mockito.verify
|
||||||
import org.mockito.Mockito.verifyNoMoreInteractions
|
import org.mockito.Mockito.verifyNoMoreInteractions
|
||||||
@@ -374,6 +376,83 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() {
|
|||||||
verifyNoMoreInteractions(surfaceTransactionApplier)
|
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 class ArgThatCaptor<T> {
|
||||||
private var allArgs: MutableList<T> = mutableListOf()
|
private var allArgs: MutableList<T> = mutableListOf()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user