Merge "Fix the media launch animation on lockscreen" into sc-dev

This commit is contained in:
Jordan Demeulenaere
2021-06-14 07:28:00 +00:00
committed by Android (Google) Code Review
2 changed files with 28 additions and 16 deletions

View File

@@ -2846,12 +2846,13 @@ public class StatusBar extends SystemUI implements DemoMode,
@Nullable ActivityLaunchAnimator.Controller animationController) {
if (onlyProvisioned && !mDeviceProvisionedController.isDeviceProvisioned()) return;
final boolean afterKeyguardGone = mActivityIntentHelper.wouldLaunchResolverActivity(
intent, mLockscreenUserManager.getCurrentUserId());
final boolean willLaunchResolverActivity =
mActivityIntentHelper.wouldLaunchResolverActivity(intent,
mLockscreenUserManager.getCurrentUserId());
ActivityLaunchAnimator.Controller animController =
shouldAnimateLaunch(true /* isActivityIntent */) ? wrapAnimationController(
animationController, dismissShade) : null;
!willLaunchResolverActivity && shouldAnimateLaunch(true /* isActivityIntent */)
? wrapAnimationController(animationController, dismissShade) : null;
// If we animate, we will dismiss the shade only once the animation is done. This is taken
// care of by the StatusBarLaunchAnimationController.
@@ -2915,7 +2916,7 @@ public class StatusBar extends SystemUI implements DemoMode,
}
};
executeRunnableDismissingKeyguard(runnable, cancelRunnable, dismissShadeDirectly,
afterKeyguardGone, true /* deferred */);
willLaunchResolverActivity, true /* deferred */);
}
@Nullable
@@ -4617,9 +4618,11 @@ public class StatusBar extends SystemUI implements DemoMode,
*
* @param action The action to execute after dismissing the keyguard.
* @param collapsePanel Whether we should collapse the panel after dismissing the keyguard.
* @param deferKeyguardDismiss Whether we should defer the keyguard actual dismissal, for
* instance to run animations on the keyguard before hiding it.
*/
private void executeActionDismissingKeyguard(Runnable action, boolean afterKeyguardGone,
boolean collapsePanel) {
boolean collapsePanel, boolean deferKeyguardDismiss) {
if (!mDeviceProvisionedController.isDeviceProvisioned()) return;
dismissKeyguardThenExecute(() -> {
@@ -4635,8 +4638,7 @@ public class StatusBar extends SystemUI implements DemoMode,
action.run();
}).start();
boolean deferred = collapsePanel ? mShadeController.collapsePanel() : false;
return deferred;
return collapsePanel ? mShadeController.collapsePanel() : deferKeyguardDismiss;
}, afterKeyguardGone);
}
@@ -4669,12 +4671,19 @@ public class StatusBar extends SystemUI implements DemoMode,
public void startPendingIntentDismissingKeyguard(
final PendingIntent intent, @Nullable final Runnable intentSentUiThreadCallback,
@Nullable ActivityLaunchAnimator.Controller animationController) {
final boolean afterKeyguardGone = intent.isActivity()
final boolean willLaunchResolverActivity = intent.isActivity()
&& mActivityIntentHelper.wouldLaunchResolverActivity(intent.getIntent(),
mLockscreenUserManager.getCurrentUserId());
boolean collapse = animationController == null;
boolean animate = shouldAnimateLaunch(intent.isActivity());
boolean animate = !willLaunchResolverActivity
&& animationController != null
&& shouldAnimateLaunch(intent.isActivity());
// If we animate, don't collapse the shade and defer the keyguard dismiss (in case we run
// the animation on the keyguard). The animation will take care of (instantly) collapsing
// the shade and hiding the keyguard once it is done.
boolean collapse = !animate;
boolean deferKeyguardDismiss = animate;
executeActionDismissingKeyguard(() -> {
try {
// We wrap animationCallback with a StatusBarLaunchAnimatorController so that the
@@ -4703,7 +4712,7 @@ public class StatusBar extends SystemUI implements DemoMode,
if (intentSentUiThreadCallback != null) {
postOnUiThread(intentSentUiThreadCallback);
}
}, afterKeyguardGone, collapse);
}, willLaunchResolverActivity, collapse, deferKeyguardDismiss);
}
private void postOnUiThread(Runnable runnable) {

View File

@@ -252,10 +252,11 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
}
boolean isActivityIntent = intent != null && intent.isActivity() && !isBubble;
final boolean afterKeyguardGone = isActivityIntent
final boolean willLaunchResolverActivity = isActivityIntent
&& mActivityIntentHelper.wouldLaunchResolverActivity(intent.getIntent(),
mLockscreenUserManager.getCurrentUserId());
final boolean animate = mStatusBar.shouldAnimateLaunch(isActivityIntent);
final boolean animate = !willLaunchResolverActivity
&& mStatusBar.shouldAnimateLaunch(isActivityIntent);
boolean showOverLockscreen = mKeyguardStateController.isShowing() && intent != null
&& mActivityIntentHelper.wouldShowOverLockscreen(intent.getIntent(),
mLockscreenUserManager.getCurrentUserId());
@@ -268,7 +269,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
postKeyguardAction.onDismiss();
} else {
mActivityStarter.dismissKeyguardThenExecute(
postKeyguardAction, null /* cancel */, afterKeyguardGone);
postKeyguardAction, null /* cancel */, willLaunchResolverActivity);
}
}
@@ -296,7 +297,9 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
} else {
runnable.run();
}
return !mNotificationPanel.isFullyCollapsed();
// Always defer the keyguard dismiss when animating.
return animate || !mNotificationPanel.isFullyCollapsed();
}
private void handleNotificationClickAfterPanelCollapsed(