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

Commit 02f5329c authored by Gus Prevas's avatar Gus Prevas Committed by Android (Google) Code Review
Browse files

Merge "Fixes opening activities from notifications over lockscreen."

parents b64445db ea077749
Loading
Loading
Loading
Loading
+28 −5
Original line number Diff line number Diff line
@@ -524,6 +524,7 @@ public class StatusBar extends SystemUI implements DemoMode,
    private boolean mIsOccluded;
    private boolean mWereIconsJustHidden;
    private boolean mBouncerWasShowingWhenHidden;
    private boolean mIsCollapsingToShowActivityOverLockscreen;

    // Notifies StatusBarKeyguardViewManager every time the keyguard transition is over,
    // this animation is tied to the scrim for historic reasons.
@@ -2232,7 +2233,11 @@ public class StatusBar extends SystemUI implements DemoMode,

        runPostCollapseRunnables();
        setInteracting(StatusBarManager.WINDOW_STATUS_BAR, false);
        if (!mIsCollapsingToShowActivityOverLockscreen) {
            showBouncerIfKeyguard();
        } else if (DEBUG) {
            Log.d(TAG, "Not showing bouncer due to activity showing over lockscreen");
        }
        recomputeDisableFlags(mNotificationPanel.hideStatusBarIconsWhenExpanded() /* animate */);

        // Trimming will happen later if Keyguard is showing - doing it here might cause a jank in
@@ -4745,7 +4750,11 @@ public class StatusBar extends SystemUI implements DemoMode,
                && PreviewInflater.wouldLaunchResolverActivity(mContext, intent.getIntent(),
                mLockscreenUserManager.getCurrentUserId());
        final boolean wasOccluded = mIsOccluded;
        dismissKeyguardThenExecute(() -> {
        boolean showOverLockscreen = mStatusBarKeyguardViewManager.isShowing()
                && PreviewInflater.wouldShowOverLockscreen(mContext,
                intent.getIntent(),
                mLockscreenUserManager.getCurrentUserId());
        OnDismissAction postKeyguardAction = () -> {
            // TODO: Some of this code may be able to move to NotificationEntryManager.
            if (mHeadsUpManager != null && mHeadsUpManager.isAlerting(notificationKey)) {
                // Release the HUN notification to the shade.
@@ -4853,9 +4862,14 @@ public class StatusBar extends SystemUI implements DemoMode,
                    // Automatically remove all notifications that we may have kept around longer
                    removeNotification(sbn);
                }

                mIsCollapsingToShowActivityOverLockscreen = false;
            };

            if (mStatusBarKeyguardViewManager.isShowing()
            if (showOverLockscreen) {
                addPostCollapseAction(runnable);
                collapsePanel(true /* animate */);
            } else if (mStatusBarKeyguardViewManager.isShowing()
                    && mStatusBarKeyguardViewManager.isOccluded()) {
                mStatusBarKeyguardViewManager.addAfterKeyguardGoneRunnable(runnable);
                collapsePanel(true /* animate */);
@@ -4864,7 +4878,13 @@ public class StatusBar extends SystemUI implements DemoMode,
            }

            return !mNotificationPanel.isFullyCollapsed();
        }, afterKeyguardGone);
        };
        if (showOverLockscreen) {
            mIsCollapsingToShowActivityOverLockscreen = true;
            postKeyguardAction.onDismiss();
        } else {
            dismissKeyguardThenExecute(postKeyguardAction, afterKeyguardGone);
        }
    }

    private void collapseOnMainThread() {
@@ -4881,7 +4901,10 @@ public class StatusBar extends SystemUI implements DemoMode,

    public void collapsePanel(boolean animate) {
        if (animate) {
            collapsePanel();
            boolean willCollapse = collapsePanel();
            if (!willCollapse) {
                runPostCollapseRunnables();
            }
        } else if (!isPresenterFullyCollapsed()) {
            instantCollapseNotificationPanel();
            visibilityChanged(false);
+8 −0
Original line number Diff line number Diff line
@@ -146,6 +146,14 @@ public class PreviewInflater {
                == null;
    }

    public static boolean wouldShowOverLockscreen(Context ctx, Intent intent, int currentUserId) {
        ActivityInfo targetActivityInfo = getTargetActivityInfo(ctx, intent, currentUserId,
                false /* onlyDirectBootAware */);
        return targetActivityInfo != null
                && (targetActivityInfo.flags & (ActivityInfo.FLAG_SHOW_WHEN_LOCKED
                | ActivityInfo.FLAG_SHOW_FOR_ALL_USERS)) > 0;
    }

    /**
     * @param onlyDirectBootAware a boolean indicating whether the matched activity packages must
     *                            be direct boot aware when in direct boot mode if false, all