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

Commit 418c0f6a authored by Jeff DeCew's avatar Jeff DeCew Committed by Automerger Merge Worker
Browse files

Merge "Fix "Mark as Read" bug." into sc-dev am: 814fbb5f

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

Change-Id: Ic05c26ba140e7081d0f7cff2b20a57b828c127e7
parents 37935863 814fbb5f
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -168,7 +168,9 @@ public class NotificationRemoteInputManager implements Dumpable {
                    action == null ? false : action.isAuthenticationRequired(), () -> {
                    Pair<Intent, ActivityOptions> options = response.getLaunchOptions(view);
                    mLogger.logStartingIntentWithDefaultHandler(entry, pendingIntent);
                    return RemoteViews.startPendingIntent(view, pendingIntent, options);
                    boolean started = RemoteViews.startPendingIntent(view, pendingIntent, options);
                    if (started) releaseNotificationIfKeptForRemoteInputHistory(entry.getKey());
                    return started;
            });
        }

@@ -600,6 +602,22 @@ public class NotificationRemoteInputManager implements Dumpable {
                || entry.hasJustSentRemoteInput());
    }

    /**
     * Checks if the notification is being kept due to the user sending an inline reply, and if
     * so, releases that hold.  This is called anytime an action on the notification is dispatched
     * (after unlock, if applicable), and will then wait a short time to allow the app to update the
     * notification in response to the action.
     */
    private void releaseNotificationIfKeptForRemoteInputHistory(String key) {
        if (isNotificationKeptForRemoteInputHistory(key)) {
            mMainHandler.postDelayed(() -> {
                if (isNotificationKeptForRemoteInputHistory(key)) {
                    mNotificationLifetimeFinishedCallback.onSafeToRemove(key);
                }
            }, REMOTE_INPUT_KEPT_ENTRY_AUTO_CANCEL_DELAY);
        }
    }

    public boolean shouldKeepForSmartReplyHistory(NotificationEntry entry) {
        if (!FORCE_REMOTE_INPUT_HISTORY) {
            return false;