summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt43
1 files changed, 43 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt
index 6f38f4f53b7c..5f96a3b56e27 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt
@@ -285,6 +285,14 @@ class KeyguardUnlockAnimationController @Inject constructor(
var willUnlockWithInWindowLauncherAnimations: Boolean = false
/**
+ * Whether we called [ILauncherUnlockAnimationController.prepareForUnlock], but have not yet
+ * called [ILauncherUnlockAnimationController.playUnlockAnimation]. This is used exclusively for
+ * logging purposes to help track down bugs where the Launcher surface is prepared for unlock
+ * but then never animated.
+ */
+ private var launcherPreparedForUnlock = false
+
+ /**
* Whether we decided in [prepareForInWindowLauncherAnimations] that we are able to and want to
* play the smartspace shared element animation. If true,
* [willUnlockWithInWindowLauncherAnimations] will also always be true since in-window
@@ -376,6 +384,20 @@ class KeyguardUnlockAnimationController @Inject constructor(
}
/**
+ * Logging helper to log the conditions under which we decide to perform the in-window
+ * animations. This is used if we prepare to unlock but then somehow decide later to not play
+ * the animation, which would leave Launcher in a bad state.
+ */
+ private fun logInWindowAnimationConditions() {
+ Log.wtf(TAG, "canPerformInWindowLauncherAnimations expected all of these to be true: ")
+ Log.wtf(TAG, " isNexusLauncherUnderneath: ${isNexusLauncherUnderneath()}")
+ Log.wtf(TAG, " !notificationShadeWindowController.isLaunchingActivity: " +
+ "${!notificationShadeWindowController.isLaunchingActivity}")
+ Log.wtf(TAG, " launcherUnlockController != null: ${launcherUnlockController != null}")
+ Log.wtf(TAG, " !isFoldable(context): ${!isFoldable(context)}")
+ }
+
+ /**
* Called from [KeyguardStateController] to let us know that the keyguard going away state has
* changed.
*/
@@ -384,6 +406,15 @@ class KeyguardUnlockAnimationController @Inject constructor(
!statusBarStateController.leaveOpenOnKeyguardHide()) {
prepareForInWindowLauncherAnimations()
}
+
+ // If the keyguard is no longer going away and we were unlocking with in-window animations,
+ // make sure that we've left the launcher at 100% unlocked. This is a fail-safe to prevent
+ // against "tiny launcher" and similar states where the launcher is left in the prepared to
+ // animate state.
+ if (!keyguardStateController.isKeyguardGoingAway &&
+ willUnlockWithInWindowLauncherAnimations) {
+ launcherUnlockController?.setUnlockAmount(1f, true /* forceIfAnimating */)
+ }
}
/**
@@ -437,6 +468,8 @@ class KeyguardUnlockAnimationController @Inject constructor(
lockscreenSmartspaceBounds, /* lockscreenSmartspaceBounds */
selectedPage /* selectedPage */
)
+
+ launcherPreparedForUnlock = true
} catch (e: RemoteException) {
Log.e(TAG, "Remote exception in prepareForInWindowUnlockAnimations.", e)
}
@@ -495,6 +528,8 @@ class KeyguardUnlockAnimationController @Inject constructor(
true,
UNLOCK_ANIMATION_DURATION_MS + CANNED_UNLOCK_START_DELAY,
0 /* startDelay */)
+
+ launcherPreparedForUnlock = false
} else {
// Otherwise, we're swiping in an app and should just fade it in. The swipe gesture
// will translate it until the end of the swipe gesture.
@@ -554,6 +589,12 @@ class KeyguardUnlockAnimationController @Inject constructor(
surfaceBehindEntryAnimator.start()
}
}
+
+ if (launcherPreparedForUnlock && !willUnlockWithInWindowLauncherAnimations) {
+ Log.wtf(TAG, "Launcher is prepared for unlock, so we should have started the " +
+ "in-window animation, however we apparently did not.")
+ logInWindowAnimationConditions()
+ }
}
/**
@@ -569,6 +610,8 @@ class KeyguardUnlockAnimationController @Inject constructor(
LAUNCHER_ICONS_ANIMATION_DURATION_MS /* duration */,
CANNED_UNLOCK_START_DELAY /* startDelay */)
+ launcherPreparedForUnlock = false
+
// Now that the Launcher surface (with its smartspace positioned identically to ours) is
// visible, hide our smartspace.
lockscreenSmartspace?.visibility = View.INVISIBLE