Loading core/api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -12370,6 +12370,7 @@ package android.service.notification { 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"; field public static final String KEY_SENSITIVE_CONTENT = "key_sensitive_content"; field public static final String KEY_SNOOZE_CRITERIA = "key_snooze_criteria"; field public static final String KEY_TEXT_REPLIES = "key_text_replies"; field public static final String KEY_USER_SENTIMENT = "key_user_sentiment"; Loading Loading @@ -12409,6 +12410,7 @@ package android.service.notification { public static class NotificationListenerService.Ranking { method public int getProposedImportance(); method public boolean hasSensitiveContent(); } public final class NotificationStats implements android.os.Parcelable { core/java/android/service/notification/Adjustment.java +8 −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_IMPORTANCE_PROPOSAL KEY_TEXT_REPLIES, KEY_USER_SENTIMENT, KEY_IMPORTANCE_PROPOSAL, KEY_SENSITIVE_CONTENT }) @Retention(RetentionPolicy.SOURCE) public @interface Keys {} Loading Loading @@ -133,6 +133,13 @@ public final class Adjustment implements Parcelable { */ public static final String KEY_IMPORTANCE_PROPOSAL = "key_importance_proposal"; /** * Data type: boolean, when true it suggests that the content text of this notification is * sensitive. A notification listener can use this information to redact notifications on locked * devices. */ public static final String KEY_SENSITIVE_CONTENT = "key_sensitive_content"; /** * 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 +24 −4 Original line number Diff line number Diff line Loading @@ -1732,10 +1732,13 @@ public abstract class NotificationListenerService extends Service { private boolean mIsBubble; // Notification assistant importance suggestion private int mProposedImportance; // Sensitive info detected by the notification assistant private boolean mSensitiveContent; private static final int PARCEL_VERSION = 2; public Ranking() { } public Ranking() { } // You can parcel it, but it's not Parcelable /** @hide */ Loading Loading @@ -1770,6 +1773,7 @@ public abstract class NotificationListenerService extends Service { out.writeInt(mRankingAdjustment); out.writeBoolean(mIsBubble); out.writeInt(mProposedImportance); out.writeBoolean(mSensitiveContent); } /** @hide */ Loading Loading @@ -1809,6 +1813,7 @@ public abstract class NotificationListenerService extends Service { mRankingAdjustment = in.readInt(); mIsBubble = in.readBoolean(); mProposedImportance = in.readInt(); mSensitiveContent = in.readBoolean(); } Loading Loading @@ -1917,6 +1922,17 @@ public abstract class NotificationListenerService extends Service { return mProposedImportance; } /** * Returns true if the notification text is sensitive (e.g. containing an OTP). * * @return whether the notification contains sensitive content * @hide */ @SystemApi public boolean hasSensitiveContent() { return mSensitiveContent; } /** * 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 @@ -2081,7 +2097,8 @@ 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 proposedImportance) { int rankingAdjustment, boolean isBubble, int proposedImportance, boolean sensitiveContent) { mKey = key; mRank = rank; mIsAmbient = importance < NotificationManager.IMPORTANCE_LOW; Loading @@ -2108,6 +2125,7 @@ public abstract class NotificationListenerService extends Service { mRankingAdjustment = rankingAdjustment; mIsBubble = isBubble; mProposedImportance = proposedImportance; mSensitiveContent = sensitiveContent; } /** Loading Loading @@ -2149,7 +2167,8 @@ public abstract class NotificationListenerService extends Service { other.mShortcutInfo, other.mRankingAdjustment, other.mIsBubble, other.mProposedImportance); other.mProposedImportance, other.mSensitiveContent); } /** Loading Loading @@ -2209,7 +2228,8 @@ public abstract class NotificationListenerService extends Service { (other.mShortcutInfo == null ? 0 : other.mShortcutInfo.getId())) && Objects.equals(mRankingAdjustment, other.mRankingAdjustment) && Objects.equals(mIsBubble, other.mIsBubble) && Objects.equals(mProposedImportance, other.mProposedImportance); && Objects.equals(mProposedImportance, other.mProposedImportance) && Objects.equals(mSensitiveContent, other.mSensitiveContent); } } Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java +25 −24 Original line number Diff line number Diff line Loading @@ -268,30 +268,31 @@ public class NotificationListener extends NotificationListenerWithPlugins implem if (!rankingMap.getRanking(key, ranking)) { ranking.populate( key, 0, false, 0, 0, 0, null, null, null, new ArrayList<>(), new ArrayList<>(), false, 0, false, 0, false, new ArrayList<>(), new ArrayList<>(), false, false, false, null, 0, false, 0 /* rank= */ 0, /* matchesInterruptionFilter= */ false, /* visibilityOverride= */ 0, /* suppressedVisualEffects= */ 0, /* importance= */ 0, /* explanation= */ null, /* overrideGroupKey= */ null, /* channel= */ null, /* overridePeople= */ new ArrayList<>(), /* snoozeCriteria= */ new ArrayList<>(), /* showBadge= */ false, /* userSentiment= */ 0, /* hidden= */ false, /* lastAudiblyAlertedMs= */ 0, /* noisy= */ false, /* smartActions= */ new ArrayList<>(), /* smartReplies= */ new ArrayList<>(), /* canBubble= */ false, /* isTextChanged= */ false, /* isConversation= */ false, /* shortcutInfo= */ null, /* rankingAdjustment= */ 0, /* isBubble= */ false, /* proposedImportance= */ 0, /* sensitiveContent= */ false ); } return ranking; Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/TargetSdkResolverTest.kt +26 −8 Original line number Diff line number Diff line Loading @@ -120,13 +120,31 @@ class TargetSdkResolverTest : SysuiTestCase() { private fun createRanking(key: String) = Ranking().apply { populate( key, 0, false, 0, 0, NotificationManager.IMPORTANCE_DEFAULT, null, null, null, null, null, true, 0, false, -1, false, null, null, false, false, false, null, 0, false, 0) /* rank = */ 0, /* matchesInterruptionFilter = */ false, /* visibilityOverride = */ 0, /* suppressedVisualEffects = */ 0, /* importance = */ NotificationManager.IMPORTANCE_DEFAULT, /* explanation = */ null, /* overrideGroupKey = */ null, /* channel = */ null, /* overridePeople = */ null, /* snoozeCriteria = */ null, /* showBadge = */ true, /* userSentiment = */ 0, /* hidden = */ false, /* lastAudiblyAlertedMs = */ -1, /* noisy = */ false, /* smartActions = */ null, /* smartReplies = */ null, /* canBubble = */ false, /* isTextChanged = */ false, /* isConversation = */ false, /* shortcutInfo = */ null, /* rankingAdjustment = */ 0, /* isBubble = */ false, /* proposedImportance = */ 0, /* sensitiveContent = */ false ) } } Loading
core/api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -12370,6 +12370,7 @@ package android.service.notification { 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"; field public static final String KEY_SENSITIVE_CONTENT = "key_sensitive_content"; field public static final String KEY_SNOOZE_CRITERIA = "key_snooze_criteria"; field public static final String KEY_TEXT_REPLIES = "key_text_replies"; field public static final String KEY_USER_SENTIMENT = "key_user_sentiment"; Loading Loading @@ -12409,6 +12410,7 @@ package android.service.notification { public static class NotificationListenerService.Ranking { method public int getProposedImportance(); method public boolean hasSensitiveContent(); } public final class NotificationStats implements android.os.Parcelable {
core/java/android/service/notification/Adjustment.java +8 −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_IMPORTANCE_PROPOSAL KEY_TEXT_REPLIES, KEY_USER_SENTIMENT, KEY_IMPORTANCE_PROPOSAL, KEY_SENSITIVE_CONTENT }) @Retention(RetentionPolicy.SOURCE) public @interface Keys {} Loading Loading @@ -133,6 +133,13 @@ public final class Adjustment implements Parcelable { */ public static final String KEY_IMPORTANCE_PROPOSAL = "key_importance_proposal"; /** * Data type: boolean, when true it suggests that the content text of this notification is * sensitive. A notification listener can use this information to redact notifications on locked * devices. */ public static final String KEY_SENSITIVE_CONTENT = "key_sensitive_content"; /** * 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 +24 −4 Original line number Diff line number Diff line Loading @@ -1732,10 +1732,13 @@ public abstract class NotificationListenerService extends Service { private boolean mIsBubble; // Notification assistant importance suggestion private int mProposedImportance; // Sensitive info detected by the notification assistant private boolean mSensitiveContent; private static final int PARCEL_VERSION = 2; public Ranking() { } public Ranking() { } // You can parcel it, but it's not Parcelable /** @hide */ Loading Loading @@ -1770,6 +1773,7 @@ public abstract class NotificationListenerService extends Service { out.writeInt(mRankingAdjustment); out.writeBoolean(mIsBubble); out.writeInt(mProposedImportance); out.writeBoolean(mSensitiveContent); } /** @hide */ Loading Loading @@ -1809,6 +1813,7 @@ public abstract class NotificationListenerService extends Service { mRankingAdjustment = in.readInt(); mIsBubble = in.readBoolean(); mProposedImportance = in.readInt(); mSensitiveContent = in.readBoolean(); } Loading Loading @@ -1917,6 +1922,17 @@ public abstract class NotificationListenerService extends Service { return mProposedImportance; } /** * Returns true if the notification text is sensitive (e.g. containing an OTP). * * @return whether the notification contains sensitive content * @hide */ @SystemApi public boolean hasSensitiveContent() { return mSensitiveContent; } /** * 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 @@ -2081,7 +2097,8 @@ 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 proposedImportance) { int rankingAdjustment, boolean isBubble, int proposedImportance, boolean sensitiveContent) { mKey = key; mRank = rank; mIsAmbient = importance < NotificationManager.IMPORTANCE_LOW; Loading @@ -2108,6 +2125,7 @@ public abstract class NotificationListenerService extends Service { mRankingAdjustment = rankingAdjustment; mIsBubble = isBubble; mProposedImportance = proposedImportance; mSensitiveContent = sensitiveContent; } /** Loading Loading @@ -2149,7 +2167,8 @@ public abstract class NotificationListenerService extends Service { other.mShortcutInfo, other.mRankingAdjustment, other.mIsBubble, other.mProposedImportance); other.mProposedImportance, other.mSensitiveContent); } /** Loading Loading @@ -2209,7 +2228,8 @@ public abstract class NotificationListenerService extends Service { (other.mShortcutInfo == null ? 0 : other.mShortcutInfo.getId())) && Objects.equals(mRankingAdjustment, other.mRankingAdjustment) && Objects.equals(mIsBubble, other.mIsBubble) && Objects.equals(mProposedImportance, other.mProposedImportance); && Objects.equals(mProposedImportance, other.mProposedImportance) && Objects.equals(mSensitiveContent, other.mSensitiveContent); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java +25 −24 Original line number Diff line number Diff line Loading @@ -268,30 +268,31 @@ public class NotificationListener extends NotificationListenerWithPlugins implem if (!rankingMap.getRanking(key, ranking)) { ranking.populate( key, 0, false, 0, 0, 0, null, null, null, new ArrayList<>(), new ArrayList<>(), false, 0, false, 0, false, new ArrayList<>(), new ArrayList<>(), false, false, false, null, 0, false, 0 /* rank= */ 0, /* matchesInterruptionFilter= */ false, /* visibilityOverride= */ 0, /* suppressedVisualEffects= */ 0, /* importance= */ 0, /* explanation= */ null, /* overrideGroupKey= */ null, /* channel= */ null, /* overridePeople= */ new ArrayList<>(), /* snoozeCriteria= */ new ArrayList<>(), /* showBadge= */ false, /* userSentiment= */ 0, /* hidden= */ false, /* lastAudiblyAlertedMs= */ 0, /* noisy= */ false, /* smartActions= */ new ArrayList<>(), /* smartReplies= */ new ArrayList<>(), /* canBubble= */ false, /* isTextChanged= */ false, /* isConversation= */ false, /* shortcutInfo= */ null, /* rankingAdjustment= */ 0, /* isBubble= */ false, /* proposedImportance= */ 0, /* sensitiveContent= */ false ); } return ranking; Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/TargetSdkResolverTest.kt +26 −8 Original line number Diff line number Diff line Loading @@ -120,13 +120,31 @@ class TargetSdkResolverTest : SysuiTestCase() { private fun createRanking(key: String) = Ranking().apply { populate( key, 0, false, 0, 0, NotificationManager.IMPORTANCE_DEFAULT, null, null, null, null, null, true, 0, false, -1, false, null, null, false, false, false, null, 0, false, 0) /* rank = */ 0, /* matchesInterruptionFilter = */ false, /* visibilityOverride = */ 0, /* suppressedVisualEffects = */ 0, /* importance = */ NotificationManager.IMPORTANCE_DEFAULT, /* explanation = */ null, /* overrideGroupKey = */ null, /* channel = */ null, /* overridePeople = */ null, /* snoozeCriteria = */ null, /* showBadge = */ true, /* userSentiment = */ 0, /* hidden = */ false, /* lastAudiblyAlertedMs = */ -1, /* noisy = */ false, /* smartActions = */ null, /* smartReplies = */ null, /* canBubble = */ false, /* isTextChanged = */ false, /* isConversation = */ false, /* shortcutInfo = */ null, /* rankingAdjustment = */ 0, /* isBubble = */ false, /* proposedImportance = */ 0, /* sensitiveContent = */ false ) } }