From a660be4ef13cd76f21f14291c42eb4360ea5b8ff Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Wed, 2 Oct 2024 15:02:00 -0400 Subject: Settings intent action for promoted notifs Test: make Flag: android.app.api_rich_ongoing Fixes: 369152226 Change-Id: I8a4d3eb02858d7ff8697067fdd6d246326c5f9af --- core/api/current.txt | 1 + core/java/android/app/NotificationManager.java | 3 +++ core/java/android/provider/Settings.java | 15 +++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index 67b328057efe..8a7e8113bf17 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -37429,6 +37429,7 @@ package android.provider { field public static final String ACTION_APPLICATION_SETTINGS = "android.settings.APPLICATION_SETTINGS"; field public static final String ACTION_APP_LOCALE_SETTINGS = "android.settings.APP_LOCALE_SETTINGS"; field public static final String ACTION_APP_NOTIFICATION_BUBBLE_SETTINGS = "android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS"; + field @FlaggedApi("android.app.api_rich_ongoing") public static final String ACTION_APP_NOTIFICATION_PROMOTION_SETTINGS = "android.settings.APP_NOTIFICATION_PROMOTION_SETTINGS"; field public static final String ACTION_APP_NOTIFICATION_SETTINGS = "android.settings.APP_NOTIFICATION_SETTINGS"; field public static final String ACTION_APP_OPEN_BY_DEFAULT_SETTINGS = "android.settings.APP_OPEN_BY_DEFAULT_SETTINGS"; field public static final String ACTION_APP_SEARCH_SETTINGS = "android.settings.APP_SEARCH_SETTINGS"; diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java index dfed1f738e44..41abd68c9924 100644 --- a/core/java/android/app/NotificationManager.java +++ b/core/java/android/app/NotificationManager.java @@ -958,6 +958,9 @@ public class NotificationManager { * Returns whether the calling app's properly formatted notifications can appear in a promoted * format, which may result in higher ranking, appearances on additional surfaces, and richer * presentation. + * + * Apps can request this permission by sending the user to the activity that matches the system + * intent action {@link android.provider.Settings#ACTION_APP_NOTIFICATION_PROMOTION_SETTINGS}. */ @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING) public boolean canPostPromotedNotifications() { diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index d82af55e2771..b84e3bdc0ac2 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -2366,6 +2366,21 @@ public final class Settings { public static final String ACTION_ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW = "android.settings.ALL_APPS_NOTIFICATION_SETTINGS_FOR_REVIEW"; + /** + * Activity Action: Show the permission screen for allowing apps to post promoted notifications. + *

+ * Input: {@link #EXTRA_APP_PACKAGE}, the package to display. + *

+ * In some cases, a matching Activity may not exist, so ensure you + * safeguard against this. + *

+ * Output: Nothing. + */ + @FlaggedApi(android.app.Flags.FLAG_API_RICH_ONGOING) + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_APP_NOTIFICATION_PROMOTION_SETTINGS + = "android.settings.APP_NOTIFICATION_PROMOTION_SETTINGS"; + /** * Activity Action: Show notification settings for a single app. *

-- cgit v1.2.3-59-g8ed1b