Merge "Don't do in-window animations if launching an activity." into tm-dev am: fc8db7210a am: 5e405e4b0e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18329502

Change-Id: I23603a66a191fff85d0f3b3eab7011e139ec5ec4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Josh Tsuji
2022-05-12 18:04:26 +00:00
committed by Automerger Merge Worker
2 changed files with 31 additions and 3 deletions

View File

@@ -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.ISysuiUnlockAnimationController
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.phone.BiometricUnlockController
import com.android.systemui.statusbar.policy.KeyguardStateController
@@ -142,7 +143,8 @@ class KeyguardUnlockAnimationController @Inject constructor(
private val keyguardViewController: KeyguardViewController,
private val featureFlags: FeatureFlags,
private val biometricUnlockControllerLazy: Lazy<BiometricUnlockController>,
private val statusBarStateController: SysuiStatusBarStateController
private val statusBarStateController: SysuiStatusBarStateController,
private val notificationShadeWindowController: NotificationShadeWindowController
) : KeyguardStateController.Callback, ISysuiUnlockAnimationController.Stub() {
interface KeyguardUnlockAnimationListener {
@@ -362,6 +364,9 @@ class KeyguardUnlockAnimationController @Inject constructor(
*/
fun canPerformInWindowLauncherAnimations(): Boolean {
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 &&
!keyguardStateController.isDismissingFromSwipe &&
// 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
try {
// Let the launcher know to prepare for this animation.
launcherUnlockController?.prepareForUnlock(
willUnlockWithSmartspaceTransition, /* willAnimateSmartspace */

View File

@@ -14,6 +14,8 @@ import androidx.test.filters.SmallTest
import com.android.keyguard.KeyguardViewController
import com.android.systemui.SysuiTestCase
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.phone.BiometricUnlockController
import com.android.systemui.statusbar.policy.KeyguardStateController
@@ -52,6 +54,11 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() {
private lateinit var surfaceTransactionApplier: SyncRtSurfaceTransactionApplier
@Mock
private lateinit var statusBarStateController: SysuiStatusBarStateController
@Mock
private lateinit var notificationShadeWindowController: NotificationShadeWindowController
@Mock
private lateinit var launcherUnlockAnimationController: ILauncherUnlockAnimationController.Stub
private lateinit var remoteAnimationTarget: RemoteAnimationTarget
@@ -60,8 +67,11 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() {
MockitoAnnotations.initMocks(this)
keyguardUnlockAnimationController = KeyguardUnlockAnimationController(
context, keyguardStateController, { keyguardViewMediator }, keyguardViewController,
featureFlags, { biometricUnlockController }, statusBarStateController
featureFlags, { biometricUnlockController }, statusBarStateController,
notificationShadeWindowController
)
keyguardUnlockAnimationController.setLauncherUnlockController(
launcherUnlockAnimationController)
`when`(keyguardViewController.viewRootImpl).thenReturn(mock(ViewRootImpl::class.java))
@@ -194,4 +204,18 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() {
assertTrue(keyguardUnlockAnimationController.isPlayingCannedUnlockAnimation())
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())
}
}