Loading core/api/system-current.txt +5 −0 Original line number Diff line number Diff line Loading @@ -11880,6 +11880,7 @@ package android.service.notification { field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.Adjustment> CREATOR; field public static final String KEY_CONTEXTUAL_ACTIONS = "key_contextual_actions"; field public static final String KEY_IMPORTANCE = "key_importance"; field public static final String KEY_IMPORTANCE_PROPOSAL = "key_importance_proposal"; field public static final String KEY_NOT_CONVERSATION = "key_not_conversation"; field public static final String KEY_PEOPLE = "key_people"; field public static final String KEY_RANKING_SCORE = "key_ranking_score"; Loading Loading @@ -11920,6 +11921,10 @@ package android.service.notification { method public void onNotificationRemoved(@NonNull android.service.notification.StatusBarNotification, @NonNull android.service.notification.NotificationListenerService.RankingMap, @NonNull android.service.notification.NotificationStats, int); } public static class NotificationListenerService.Ranking { method public int getProposedImportance(); } public final class NotificationStats implements android.os.Parcelable { ctor public NotificationStats(); ctor protected NotificationStats(android.os.Parcel); core/java/android/service/notification/Adjustment.java +13 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ public final class Adjustment implements Parcelable { /** @hide */ @StringDef (prefix = { "KEY_" }, value = { KEY_CONTEXTUAL_ACTIONS, KEY_GROUP_KEY, KEY_IMPORTANCE, KEY_PEOPLE, KEY_SNOOZE_CRITERIA, KEY_TEXT_REPLIES, KEY_USER_SENTIMENT KEY_TEXT_REPLIES, KEY_USER_SENTIMENT, KEY_IMPORTANCE_PROPOSAL }) @Retention(RetentionPolicy.SOURCE) public @interface Keys {} Loading Loading @@ -121,6 +121,18 @@ public final class Adjustment implements Parcelable { */ public static final String KEY_IMPORTANCE = "key_importance"; /** * Weaker than {@link #KEY_IMPORTANCE}, this adjustment suggests an importance rather than * mandates an importance change. * * A notification listener can interpet this suggestion to show the user a prompt to change * notification importance for the notification (or type, or app) moving forward. * * Data type: int, one of importance values e.g. * {@link android.app.NotificationManager#IMPORTANCE_MIN}. */ public static final String KEY_IMPORTANCE_PROPOSAL = "key_importance_proposal"; /** * Data type: float, a ranking score from 0 (lowest) to 1 (highest). * Used to rank notifications inside that fall under the same classification (i.e. alerting, Loading core/java/android/service/notification/NotificationListenerService.java +27 −3 Original line number Diff line number Diff line Loading @@ -1730,6 +1730,8 @@ public abstract class NotificationListenerService extends Service { private ShortcutInfo mShortcutInfo; private @RankingAdjustment int mRankingAdjustment; private boolean mIsBubble; // Notification assistant importance suggestion private int mProposedImportance; private static final int PARCEL_VERSION = 2; Loading Loading @@ -1767,6 +1769,7 @@ public abstract class NotificationListenerService extends Service { out.writeParcelable(mShortcutInfo, flags); out.writeInt(mRankingAdjustment); out.writeBoolean(mIsBubble); out.writeInt(mProposedImportance); } /** @hide */ Loading Loading @@ -1805,6 +1808,7 @@ public abstract class NotificationListenerService extends Service { mShortcutInfo = in.readParcelable(cl, android.content.pm.ShortcutInfo.class); mRankingAdjustment = in.readInt(); mIsBubble = in.readBoolean(); mProposedImportance = in.readInt(); } Loading Loading @@ -1896,6 +1900,23 @@ public abstract class NotificationListenerService extends Service { return mRankingScore; } /** * Returns the proposed importance provided by the {@link NotificationAssistantService}. * * This can be used to suggest that the user change the importance of this type of * notification moving forward. A value of * {@link NotificationManager#IMPORTANCE_UNSPECIFIED} means that the NAS has not recommended * a change to the importance, and no UI should be shown to the user. See * {@link Adjustment#KEY_IMPORTANCE_PROPOSAL}. * * @return the importance of the notification * @hide */ @SystemApi public @NotificationManager.Importance int getProposedImportance() { return mProposedImportance; } /** * If the system has overridden the group key, then this will be non-null, and this * key should be used to bundle notifications. Loading Loading @@ -2060,7 +2081,7 @@ public abstract class NotificationListenerService extends Service { boolean noisy, ArrayList<Notification.Action> smartActions, ArrayList<CharSequence> smartReplies, boolean canBubble, boolean isTextChanged, boolean isConversation, ShortcutInfo shortcutInfo, int rankingAdjustment, boolean isBubble) { int rankingAdjustment, boolean isBubble, int proposedImportance) { mKey = key; mRank = rank; mIsAmbient = importance < NotificationManager.IMPORTANCE_LOW; Loading @@ -2086,6 +2107,7 @@ public abstract class NotificationListenerService extends Service { mShortcutInfo = shortcutInfo; mRankingAdjustment = rankingAdjustment; mIsBubble = isBubble; mProposedImportance = proposedImportance; } /** Loading Loading @@ -2126,7 +2148,8 @@ public abstract class NotificationListenerService extends Service { other.mIsConversation, other.mShortcutInfo, other.mRankingAdjustment, other.mIsBubble); other.mIsBubble, other.mProposedImportance); } /** Loading Loading @@ -2185,7 +2208,8 @@ public abstract class NotificationListenerService extends Service { && Objects.equals((mShortcutInfo == null ? 0 : mShortcutInfo.getId()), (other.mShortcutInfo == null ? 0 : other.mShortcutInfo.getId())) && Objects.equals(mRankingAdjustment, other.mRankingAdjustment) && Objects.equals(mIsBubble, other.mIsBubble); && Objects.equals(mIsBubble, other.mIsBubble) && Objects.equals(mProposedImportance, other.mProposedImportance); } } Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java +2 −1 Original line number Diff line number Diff line Loading @@ -290,7 +290,8 @@ public class NotificationListener extends NotificationListenerWithPlugins implem false, null, 0, false false, 0 ); } return ranking; Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/TargetSdkResolverTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -127,6 +127,6 @@ class TargetSdkResolverTest : SysuiTestCase() { NotificationManager.IMPORTANCE_DEFAULT, null, null, null, null, null, true, 0, false, -1, false, null, null, false, false, false, null, 0, false) false, null, 0, false, 0) } } Loading
core/api/system-current.txt +5 −0 Original line number Diff line number Diff line Loading @@ -11880,6 +11880,7 @@ package android.service.notification { field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.Adjustment> CREATOR; field public static final String KEY_CONTEXTUAL_ACTIONS = "key_contextual_actions"; field public static final String KEY_IMPORTANCE = "key_importance"; field public static final String KEY_IMPORTANCE_PROPOSAL = "key_importance_proposal"; field public static final String KEY_NOT_CONVERSATION = "key_not_conversation"; field public static final String KEY_PEOPLE = "key_people"; field public static final String KEY_RANKING_SCORE = "key_ranking_score"; Loading Loading @@ -11920,6 +11921,10 @@ package android.service.notification { method public void onNotificationRemoved(@NonNull android.service.notification.StatusBarNotification, @NonNull android.service.notification.NotificationListenerService.RankingMap, @NonNull android.service.notification.NotificationStats, int); } public static class NotificationListenerService.Ranking { method public int getProposedImportance(); } public final class NotificationStats implements android.os.Parcelable { ctor public NotificationStats(); ctor protected NotificationStats(android.os.Parcel);
core/java/android/service/notification/Adjustment.java +13 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ public final class Adjustment implements Parcelable { /** @hide */ @StringDef (prefix = { "KEY_" }, value = { KEY_CONTEXTUAL_ACTIONS, KEY_GROUP_KEY, KEY_IMPORTANCE, KEY_PEOPLE, KEY_SNOOZE_CRITERIA, KEY_TEXT_REPLIES, KEY_USER_SENTIMENT KEY_TEXT_REPLIES, KEY_USER_SENTIMENT, KEY_IMPORTANCE_PROPOSAL }) @Retention(RetentionPolicy.SOURCE) public @interface Keys {} Loading Loading @@ -121,6 +121,18 @@ public final class Adjustment implements Parcelable { */ public static final String KEY_IMPORTANCE = "key_importance"; /** * Weaker than {@link #KEY_IMPORTANCE}, this adjustment suggests an importance rather than * mandates an importance change. * * A notification listener can interpet this suggestion to show the user a prompt to change * notification importance for the notification (or type, or app) moving forward. * * Data type: int, one of importance values e.g. * {@link android.app.NotificationManager#IMPORTANCE_MIN}. */ public static final String KEY_IMPORTANCE_PROPOSAL = "key_importance_proposal"; /** * Data type: float, a ranking score from 0 (lowest) to 1 (highest). * Used to rank notifications inside that fall under the same classification (i.e. alerting, Loading
core/java/android/service/notification/NotificationListenerService.java +27 −3 Original line number Diff line number Diff line Loading @@ -1730,6 +1730,8 @@ public abstract class NotificationListenerService extends Service { private ShortcutInfo mShortcutInfo; private @RankingAdjustment int mRankingAdjustment; private boolean mIsBubble; // Notification assistant importance suggestion private int mProposedImportance; private static final int PARCEL_VERSION = 2; Loading Loading @@ -1767,6 +1769,7 @@ public abstract class NotificationListenerService extends Service { out.writeParcelable(mShortcutInfo, flags); out.writeInt(mRankingAdjustment); out.writeBoolean(mIsBubble); out.writeInt(mProposedImportance); } /** @hide */ Loading Loading @@ -1805,6 +1808,7 @@ public abstract class NotificationListenerService extends Service { mShortcutInfo = in.readParcelable(cl, android.content.pm.ShortcutInfo.class); mRankingAdjustment = in.readInt(); mIsBubble = in.readBoolean(); mProposedImportance = in.readInt(); } Loading Loading @@ -1896,6 +1900,23 @@ public abstract class NotificationListenerService extends Service { return mRankingScore; } /** * Returns the proposed importance provided by the {@link NotificationAssistantService}. * * This can be used to suggest that the user change the importance of this type of * notification moving forward. A value of * {@link NotificationManager#IMPORTANCE_UNSPECIFIED} means that the NAS has not recommended * a change to the importance, and no UI should be shown to the user. See * {@link Adjustment#KEY_IMPORTANCE_PROPOSAL}. * * @return the importance of the notification * @hide */ @SystemApi public @NotificationManager.Importance int getProposedImportance() { return mProposedImportance; } /** * If the system has overridden the group key, then this will be non-null, and this * key should be used to bundle notifications. Loading Loading @@ -2060,7 +2081,7 @@ public abstract class NotificationListenerService extends Service { boolean noisy, ArrayList<Notification.Action> smartActions, ArrayList<CharSequence> smartReplies, boolean canBubble, boolean isTextChanged, boolean isConversation, ShortcutInfo shortcutInfo, int rankingAdjustment, boolean isBubble) { int rankingAdjustment, boolean isBubble, int proposedImportance) { mKey = key; mRank = rank; mIsAmbient = importance < NotificationManager.IMPORTANCE_LOW; Loading @@ -2086,6 +2107,7 @@ public abstract class NotificationListenerService extends Service { mShortcutInfo = shortcutInfo; mRankingAdjustment = rankingAdjustment; mIsBubble = isBubble; mProposedImportance = proposedImportance; } /** Loading Loading @@ -2126,7 +2148,8 @@ public abstract class NotificationListenerService extends Service { other.mIsConversation, other.mShortcutInfo, other.mRankingAdjustment, other.mIsBubble); other.mIsBubble, other.mProposedImportance); } /** Loading Loading @@ -2185,7 +2208,8 @@ public abstract class NotificationListenerService extends Service { && Objects.equals((mShortcutInfo == null ? 0 : mShortcutInfo.getId()), (other.mShortcutInfo == null ? 0 : other.mShortcutInfo.getId())) && Objects.equals(mRankingAdjustment, other.mRankingAdjustment) && Objects.equals(mIsBubble, other.mIsBubble); && Objects.equals(mIsBubble, other.mIsBubble) && Objects.equals(mProposedImportance, other.mProposedImportance); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java +2 −1 Original line number Diff line number Diff line Loading @@ -290,7 +290,8 @@ public class NotificationListener extends NotificationListenerWithPlugins implem false, null, 0, false false, 0 ); } return ranking; Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/TargetSdkResolverTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -127,6 +127,6 @@ class TargetSdkResolverTest : SysuiTestCase() { NotificationManager.IMPORTANCE_DEFAULT, null, null, null, null, null, true, 0, false, -1, false, null, null, false, false, false, null, 0, false) false, null, 0, false, 0) } }