From 55f14ae70dee23a4ea4988dad57d77d6b82ecd26 Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Fri, 20 Oct 2023 13:10:27 -0400 Subject: [PATCH] Allow background start from notif history Test: Tap on entries in 'Recently Dismissed' Fixes: 304651874 Change-Id: Ifcdd881cbd17903b47f93303bf33a72f718dc181 --- .../notification/history/NotificationSbnViewHolder.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/android/settings/notification/history/NotificationSbnViewHolder.java b/src/com/android/settings/notification/history/NotificationSbnViewHolder.java index 1a703eb11fb..df8aec44c0d 100644 --- a/src/com/android/settings/notification/history/NotificationSbnViewHolder.java +++ b/src/com/android/settings/notification/history/NotificationSbnViewHolder.java @@ -16,6 +16,9 @@ package com.android.settings.notification.history; +import static android.app.ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED; + +import android.app.ActivityOptions; import android.app.PendingIntent; import android.content.ActivityNotFoundException; import android.content.Intent; @@ -110,7 +113,10 @@ public class NotificationSbnViewHolder extends RecyclerView.ViewHolder { uid, pkg, instanceId, position); if (pi != null && isPendingIntentValid) { try { - pi.send(); + ActivityOptions options = ActivityOptions.makeBasic(); + options.setPendingIntentBackgroundActivityStartMode( + MODE_BACKGROUND_ACTIVITY_START_ALLOWED); + pi.send(options.toBundle()); } catch (PendingIntent.CanceledException e) { Slog.e(TAG, "Could not launch", e); }