Merge "Add null-check for lockscreenSmartspace" into tm-qpr-dev am: 2383244013
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19886645 Change-Id: I862ef624c9e10afbc811eb026269409274219d35 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -282,7 +282,8 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
* window like any other app. This can be true while [willUnlockWithSmartspaceTransition] is
|
* window like any other app. This can be true while [willUnlockWithSmartspaceTransition] is
|
||||||
* false, if the smartspace is not available or was not ready in time.
|
* false, if the smartspace is not available or was not ready in time.
|
||||||
*/
|
*/
|
||||||
private var willUnlockWithInWindowLauncherAnimations: Boolean = false
|
@VisibleForTesting
|
||||||
|
var willUnlockWithInWindowLauncherAnimations: Boolean = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether we decided in [prepareForInWindowLauncherAnimations] that we are able to and want to
|
* Whether we decided in [prepareForInWindowLauncherAnimations] that we are able to and want to
|
||||||
@@ -484,8 +485,8 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
// surface behind the keyguard to finish unlocking.
|
// surface behind the keyguard to finish unlocking.
|
||||||
if (keyguardStateController.isFlingingToDismissKeyguard) {
|
if (keyguardStateController.isFlingingToDismissKeyguard) {
|
||||||
playCannedUnlockAnimation()
|
playCannedUnlockAnimation()
|
||||||
} else if (keyguardStateController.isDismissingFromSwipe
|
} else if (keyguardStateController.isDismissingFromSwipe &&
|
||||||
&& willUnlockWithInWindowLauncherAnimations) {
|
willUnlockWithInWindowLauncherAnimations) {
|
||||||
// If we're swiping to unlock to the Launcher, and can play in-window animations,
|
// If we're swiping to unlock to the Launcher, and can play in-window animations,
|
||||||
// make the launcher surface fully visible and play the in-window unlock animation
|
// make the launcher surface fully visible and play the in-window unlock animation
|
||||||
// on the launcher icons. System UI will remain locked, using the swipe-to-unlock
|
// on the launcher icons. System UI will remain locked, using the swipe-to-unlock
|
||||||
@@ -574,7 +575,7 @@ 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
|
lockscreenSmartspace?.visibility = View.INVISIBLE
|
||||||
|
|
||||||
// As soon as the shade has animated out of the way, finish the keyguard exit animation. The
|
// As soon as the shade has animated out of the way, finish the keyguard exit animation. The
|
||||||
// in-window animations in the Launcher window will end on their own.
|
// in-window animations in the Launcher window will end on their own.
|
||||||
@@ -727,8 +728,8 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
|
|
||||||
// If we're dismissing via swipe to the Launcher, we'll play in-window scale animations, so
|
// If we're dismissing via swipe to the Launcher, we'll play in-window scale animations, so
|
||||||
// don't also scale the window.
|
// don't also scale the window.
|
||||||
if (keyguardStateController.isDismissingFromSwipe
|
if (keyguardStateController.isDismissingFromSwipe &&
|
||||||
&& willUnlockWithInWindowLauncherAnimations) {
|
willUnlockWithInWindowLauncherAnimations) {
|
||||||
scaleFactor = 1f
|
scaleFactor = 1f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ import org.junit.Test
|
|||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
import org.mockito.ArgumentCaptor.forClass
|
import org.mockito.ArgumentCaptor.forClass
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito.`when`
|
|
||||||
import org.mockito.Mockito.mock
|
import org.mockito.Mockito.mock
|
||||||
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
|
||||||
|
import org.mockito.Mockito.`when`
|
||||||
import org.mockito.MockitoAnnotations
|
import org.mockito.MockitoAnnotations
|
||||||
|
|
||||||
@RunWith(AndroidTestingRunner::class)
|
@RunWith(AndroidTestingRunner::class)
|
||||||
@@ -218,4 +218,18 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() {
|
|||||||
assertFalse(keyguardUnlockAnimationController.canPerformInWindowLauncherAnimations())
|
assertFalse(keyguardUnlockAnimationController.canPerformInWindowLauncherAnimations())
|
||||||
assertFalse(keyguardUnlockAnimationController.isPlayingCannedUnlockAnimation())
|
assertFalse(keyguardUnlockAnimationController.isPlayingCannedUnlockAnimation())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun playCannedUnlockAnimation_nullSmartspaceView_doesNotThrowExecption() {
|
||||||
|
keyguardUnlockAnimationController.lockscreenSmartspace = null
|
||||||
|
keyguardUnlockAnimationController.willUnlockWithInWindowLauncherAnimations = true
|
||||||
|
|
||||||
|
keyguardUnlockAnimationController.notifyStartSurfaceBehindRemoteAnimation(
|
||||||
|
remoteAnimationTarget,
|
||||||
|
0 /* startTime */,
|
||||||
|
false /* requestedShowSurfaceBehindKeyguard */
|
||||||
|
)
|
||||||
|
|
||||||
|
assertTrue(keyguardUnlockAnimationController.isPlayingCannedUnlockAnimation())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user