Merge "Don't do in-window animations if launching an activity." into tm-dev am: fc8db7210a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18329502 Change-Id: Icfd169ae40e6d5fffc0e6d47e5033ae8efdbc0b3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -44,6 +44,7 @@ import com.android.systemui.shared.system.QuickStepContract
|
|||||||
import com.android.systemui.shared.system.smartspace.ILauncherUnlockAnimationController
|
import com.android.systemui.shared.system.smartspace.ILauncherUnlockAnimationController
|
||||||
import com.android.systemui.shared.system.smartspace.ISysuiUnlockAnimationController
|
import com.android.systemui.shared.system.smartspace.ISysuiUnlockAnimationController
|
||||||
import com.android.systemui.shared.system.smartspace.SmartspaceState
|
import com.android.systemui.shared.system.smartspace.SmartspaceState
|
||||||
|
import com.android.systemui.statusbar.NotificationShadeWindowController
|
||||||
import com.android.systemui.statusbar.SysuiStatusBarStateController
|
import com.android.systemui.statusbar.SysuiStatusBarStateController
|
||||||
import com.android.systemui.statusbar.phone.BiometricUnlockController
|
import com.android.systemui.statusbar.phone.BiometricUnlockController
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController
|
import com.android.systemui.statusbar.policy.KeyguardStateController
|
||||||
@@ -142,7 +143,8 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
private val keyguardViewController: KeyguardViewController,
|
private val keyguardViewController: KeyguardViewController,
|
||||||
private val featureFlags: FeatureFlags,
|
private val featureFlags: FeatureFlags,
|
||||||
private val biometricUnlockControllerLazy: Lazy<BiometricUnlockController>,
|
private val biometricUnlockControllerLazy: Lazy<BiometricUnlockController>,
|
||||||
private val statusBarStateController: SysuiStatusBarStateController
|
private val statusBarStateController: SysuiStatusBarStateController,
|
||||||
|
private val notificationShadeWindowController: NotificationShadeWindowController
|
||||||
) : KeyguardStateController.Callback, ISysuiUnlockAnimationController.Stub() {
|
) : KeyguardStateController.Callback, ISysuiUnlockAnimationController.Stub() {
|
||||||
|
|
||||||
interface KeyguardUnlockAnimationListener {
|
interface KeyguardUnlockAnimationListener {
|
||||||
@@ -362,6 +364,9 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
*/
|
*/
|
||||||
fun canPerformInWindowLauncherAnimations(): Boolean {
|
fun canPerformInWindowLauncherAnimations(): Boolean {
|
||||||
return isNexusLauncherUnderneath() &&
|
return isNexusLauncherUnderneath() &&
|
||||||
|
// If the launcher is underneath, but we're about to launch an activity, don't do
|
||||||
|
// the animations since they won't be visible.
|
||||||
|
!notificationShadeWindowController.isLaunchingActivity &&
|
||||||
launcherUnlockController != null &&
|
launcherUnlockController != null &&
|
||||||
!keyguardStateController.isDismissingFromSwipe &&
|
!keyguardStateController.isDismissingFromSwipe &&
|
||||||
// Temporarily disable for foldables since foldable launcher has two first pages,
|
// Temporarily disable for foldables since foldable launcher has two first pages,
|
||||||
@@ -413,7 +418,6 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
(lockscreenSmartspace as BcSmartspaceDataPlugin.SmartspaceView?)?.selectedPage ?: -1
|
(lockscreenSmartspace as BcSmartspaceDataPlugin.SmartspaceView?)?.selectedPage ?: -1
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Let the launcher know to prepare for this animation.
|
// Let the launcher know to prepare for this animation.
|
||||||
launcherUnlockController?.prepareForUnlock(
|
launcherUnlockController?.prepareForUnlock(
|
||||||
willUnlockWithSmartspaceTransition, /* willAnimateSmartspace */
|
willUnlockWithSmartspaceTransition, /* willAnimateSmartspace */
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import androidx.test.filters.SmallTest
|
|||||||
import com.android.keyguard.KeyguardViewController
|
import com.android.keyguard.KeyguardViewController
|
||||||
import com.android.systemui.SysuiTestCase
|
import com.android.systemui.SysuiTestCase
|
||||||
import com.android.systemui.flags.FeatureFlags
|
import com.android.systemui.flags.FeatureFlags
|
||||||
|
import com.android.systemui.shared.system.smartspace.ILauncherUnlockAnimationController
|
||||||
|
import com.android.systemui.statusbar.NotificationShadeWindowController
|
||||||
import com.android.systemui.statusbar.SysuiStatusBarStateController
|
import com.android.systemui.statusbar.SysuiStatusBarStateController
|
||||||
import com.android.systemui.statusbar.phone.BiometricUnlockController
|
import com.android.systemui.statusbar.phone.BiometricUnlockController
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController
|
import com.android.systemui.statusbar.policy.KeyguardStateController
|
||||||
@@ -52,6 +54,11 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() {
|
|||||||
private lateinit var surfaceTransactionApplier: SyncRtSurfaceTransactionApplier
|
private lateinit var surfaceTransactionApplier: SyncRtSurfaceTransactionApplier
|
||||||
@Mock
|
@Mock
|
||||||
private lateinit var statusBarStateController: SysuiStatusBarStateController
|
private lateinit var statusBarStateController: SysuiStatusBarStateController
|
||||||
|
@Mock
|
||||||
|
private lateinit var notificationShadeWindowController: NotificationShadeWindowController
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
private lateinit var launcherUnlockAnimationController: ILauncherUnlockAnimationController.Stub
|
||||||
|
|
||||||
private lateinit var remoteAnimationTarget: RemoteAnimationTarget
|
private lateinit var remoteAnimationTarget: RemoteAnimationTarget
|
||||||
|
|
||||||
@@ -60,8 +67,11 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() {
|
|||||||
MockitoAnnotations.initMocks(this)
|
MockitoAnnotations.initMocks(this)
|
||||||
keyguardUnlockAnimationController = KeyguardUnlockAnimationController(
|
keyguardUnlockAnimationController = KeyguardUnlockAnimationController(
|
||||||
context, keyguardStateController, { keyguardViewMediator }, keyguardViewController,
|
context, keyguardStateController, { keyguardViewMediator }, keyguardViewController,
|
||||||
featureFlags, { biometricUnlockController }, statusBarStateController
|
featureFlags, { biometricUnlockController }, statusBarStateController,
|
||||||
|
notificationShadeWindowController
|
||||||
)
|
)
|
||||||
|
keyguardUnlockAnimationController.setLauncherUnlockController(
|
||||||
|
launcherUnlockAnimationController)
|
||||||
|
|
||||||
`when`(keyguardViewController.viewRootImpl).thenReturn(mock(ViewRootImpl::class.java))
|
`when`(keyguardViewController.viewRootImpl).thenReturn(mock(ViewRootImpl::class.java))
|
||||||
|
|
||||||
@@ -194,4 +204,18 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() {
|
|||||||
assertTrue(keyguardUnlockAnimationController.isPlayingCannedUnlockAnimation())
|
assertTrue(keyguardUnlockAnimationController.isPlayingCannedUnlockAnimation())
|
||||||
assertFalse(keyguardUnlockAnimationController.surfaceBehindAlphaAnimator.isRunning)
|
assertFalse(keyguardUnlockAnimationController.surfaceBehindAlphaAnimator.isRunning)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun doNotPlayCannedUnlockAnimation_ifLaunchingApp() {
|
||||||
|
`when`(notificationShadeWindowController.isLaunchingActivity).thenReturn(true)
|
||||||
|
|
||||||
|
keyguardUnlockAnimationController.notifyStartSurfaceBehindRemoteAnimation(
|
||||||
|
remoteAnimationTarget,
|
||||||
|
0 /* startTime */,
|
||||||
|
true /* requestedShowSurfaceBehindKeyguard */
|
||||||
|
)
|
||||||
|
|
||||||
|
assertFalse(keyguardUnlockAnimationController.canPerformInWindowLauncherAnimations())
|
||||||
|
assertFalse(keyguardUnlockAnimationController.isPlayingCannedUnlockAnimation())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user