Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c6d49fa4 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Automerger Merge Worker
Browse files

Merge "Fix the media launch animation on lockscreen" into sc-dev am: f0b85630 am: 21037051

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

Change-Id: If643a39e63c2b57f86bab56c20fdb0b26e8d6a8c
parents 3f638021 21037051
Loading
Loading
Loading
Loading
+21 −12
Original line number Diff line number Diff line
@@ -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) {
+7 −4
Original line number Diff line number Diff line
@@ -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(