Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -41701,6 +41701,7 @@ package android.service.notification { public static class NotificationListenerService.Ranking { ctor public NotificationListenerService.Ranking(); method public boolean canBubble(); method public boolean canShowBadge(); method public android.app.NotificationChannel getChannel(); method public int getImportance(); api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -1851,6 +1851,7 @@ package android.provider { field @Deprecated public static final String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES = "enabled_notification_policy_access_packages"; field public static final String LOCATION_ACCESS_CHECK_DELAY_MILLIS = "location_access_check_delay_millis"; field public static final String LOCATION_ACCESS_CHECK_INTERVAL_MILLIS = "location_access_check_interval_millis"; field public static final String NOTIFICATION_BUBBLES = "notification_bubbles"; field @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds"; field public static final String USER_SETUP_COMPLETE = "user_setup_complete"; field public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service"; Loading core/java/android/app/NotificationChannel.java +1 −9 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ public final class NotificationChannel implements Parcelable { private static final String ATT_FG_SERVICE_SHOWN = "fgservice"; private static final String ATT_GROUP = "group"; private static final String ATT_BLOCKABLE_SYSTEM = "blockable_system"; private static final String ATT_ALLOW_BUBBLE = "allow_bubble"; private static final String ATT_ALLOW_BUBBLE = "can_bubble"; private static final String DELIMITER = ","; /** Loading Loading @@ -611,14 +611,6 @@ public final class NotificationChannel implements Parcelable { * shade, in a floating window on top of other apps. */ public boolean canBubble() { return isBubbleAllowed() && getImportance() >= IMPORTANCE_HIGH; } /** * Like {@link #canBubble()}, but only checks the permission, not the importance. * @hide */ public boolean isBubbleAllowed() { return mAllowBubbles; } Loading core/java/android/provider/Settings.java +12 −0 Original line number Diff line number Diff line Loading @@ -8293,6 +8293,16 @@ public final class Settings { private static final Validator NOTIFICATION_BADGING_VALIDATOR = BOOLEAN_VALIDATOR; /** * Whether the notification bubbles are globally enabled * The value is boolean (1 or 0). * @hide */ @TestApi public static final String NOTIFICATION_BUBBLES = "notification_bubbles"; private static final Validator NOTIFICATION_BUBBLES_VALIDATOR = BOOLEAN_VALIDATOR; /** * Whether notifications are dismissed by a right-to-left swipe (instead of a left-to-right * swipe). Loading Loading @@ -8604,6 +8614,7 @@ public final class Settings { ASSIST_GESTURE_WAKE_ENABLED, VR_DISPLAY_MODE, NOTIFICATION_BADGING, NOTIFICATION_BUBBLES, NOTIFICATION_DISMISS_RTL, QS_AUTO_ADDED_TILES, SCREENSAVER_ENABLED, Loading Loading @@ -8766,6 +8777,7 @@ public final class Settings { VALIDATORS.put(ASSIST_GESTURE_WAKE_ENABLED, ASSIST_GESTURE_WAKE_ENABLED_VALIDATOR); VALIDATORS.put(VR_DISPLAY_MODE, VR_DISPLAY_MODE_VALIDATOR); VALIDATORS.put(NOTIFICATION_BADGING, NOTIFICATION_BADGING_VALIDATOR); VALIDATORS.put(NOTIFICATION_BUBBLES, NOTIFICATION_BUBBLES_VALIDATOR); VALIDATORS.put(NOTIFICATION_DISMISS_RTL, NOTIFICATION_DISMISS_RTL_VALIDATOR); VALIDATORS.put(QS_AUTO_ADDED_TILES, QS_AUTO_ADDED_TILES_VALIDATOR); VALIDATORS.put(SCREENSAVER_ENABLED, SCREENSAVER_ENABLED_VALIDATOR); Loading core/java/android/service/notification/NotificationListenerService.java +29 −2 Original line number Diff line number Diff line Loading @@ -1503,6 +1503,7 @@ public abstract class NotificationListenerService extends Service { private boolean mNoisy; private ArrayList<Notification.Action> mSmartActions; private ArrayList<CharSequence> mSmartReplies; private boolean mCanBubble; public Ranking() {} Loading Loading @@ -1677,6 +1678,17 @@ public abstract class NotificationListenerService extends Service { return mLastAudiblyAlertedMs; } /** * Returns whether the user has allowed bubbles globally, at the app level, and at the * channel level for this notification. * * <p>This does not take into account the current importance of the notification, the * current DND state, or whether the posting app is foreground.</p> */ public boolean canBubble() { return mCanBubble; } /** @hide */ public boolean isNoisy() { return mNoisy; Loading @@ -1693,7 +1705,7 @@ public abstract class NotificationListenerService extends Service { ArrayList<SnoozeCriterion> snoozeCriteria, boolean showBadge, int userSentiment, boolean hidden, long lastAudiblyAlertedMs, boolean noisy, ArrayList<Notification.Action> smartActions, ArrayList<CharSequence> smartReplies) { ArrayList<CharSequence> smartReplies, boolean canBubble) { mKey = key; mRank = rank; mIsAmbient = importance < NotificationManager.IMPORTANCE_LOW; Loading @@ -1713,6 +1725,7 @@ public abstract class NotificationListenerService extends Service { mNoisy = noisy; mSmartActions = smartActions; mSmartReplies = smartReplies; mCanBubble = canBubble; } /** Loading Loading @@ -1766,6 +1779,7 @@ public abstract class NotificationListenerService extends Service { private ArrayMap<String, Boolean> mNoisy; private ArrayMap<String, ArrayList<Notification.Action>> mSmartActions; private ArrayMap<String, ArrayList<CharSequence>> mSmartReplies; private boolean[] mCanBubble; private RankingMap(NotificationRankingUpdate rankingUpdate) { mRankingUpdate = rankingUpdate; Loading Loading @@ -1796,7 +1810,7 @@ public abstract class NotificationListenerService extends Service { getChannel(key), getOverridePeople(key), getSnoozeCriteria(key), getShowBadge(key), getUserSentiment(key), getHidden(key), getLastAudiblyAlerted(key), getNoisy(key), getSmartActions(key), getSmartReplies(key)); getSmartReplies(key), canBubble(key)); return rank >= 0; } Loading Loading @@ -1972,6 +1986,19 @@ public abstract class NotificationListenerService extends Service { return mSmartReplies.get(key); } private boolean canBubble(String key) { synchronized (this) { if (mRanks == null) { buildRanksLocked(); } if (mCanBubble == null) { mCanBubble = mRankingUpdate.getCanBubble(); } } int keyIndex = mRanks.getOrDefault(key, -1); return keyIndex >= 0 ? mCanBubble[keyIndex] : false; } // Locked by 'this' private void buildRanksLocked() { String[] orderedKeys = mRankingUpdate.getOrderedKeys(); Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -41701,6 +41701,7 @@ package android.service.notification { public static class NotificationListenerService.Ranking { ctor public NotificationListenerService.Ranking(); method public boolean canBubble(); method public boolean canShowBadge(); method public android.app.NotificationChannel getChannel(); method public int getImportance();
api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -1851,6 +1851,7 @@ package android.provider { field @Deprecated public static final String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES = "enabled_notification_policy_access_packages"; field public static final String LOCATION_ACCESS_CHECK_DELAY_MILLIS = "location_access_check_delay_millis"; field public static final String LOCATION_ACCESS_CHECK_INTERVAL_MILLIS = "location_access_check_interval_millis"; field public static final String NOTIFICATION_BUBBLES = "notification_bubbles"; field @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds"; field public static final String USER_SETUP_COMPLETE = "user_setup_complete"; field public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service"; Loading
core/java/android/app/NotificationChannel.java +1 −9 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ public final class NotificationChannel implements Parcelable { private static final String ATT_FG_SERVICE_SHOWN = "fgservice"; private static final String ATT_GROUP = "group"; private static final String ATT_BLOCKABLE_SYSTEM = "blockable_system"; private static final String ATT_ALLOW_BUBBLE = "allow_bubble"; private static final String ATT_ALLOW_BUBBLE = "can_bubble"; private static final String DELIMITER = ","; /** Loading Loading @@ -611,14 +611,6 @@ public final class NotificationChannel implements Parcelable { * shade, in a floating window on top of other apps. */ public boolean canBubble() { return isBubbleAllowed() && getImportance() >= IMPORTANCE_HIGH; } /** * Like {@link #canBubble()}, but only checks the permission, not the importance. * @hide */ public boolean isBubbleAllowed() { return mAllowBubbles; } Loading
core/java/android/provider/Settings.java +12 −0 Original line number Diff line number Diff line Loading @@ -8293,6 +8293,16 @@ public final class Settings { private static final Validator NOTIFICATION_BADGING_VALIDATOR = BOOLEAN_VALIDATOR; /** * Whether the notification bubbles are globally enabled * The value is boolean (1 or 0). * @hide */ @TestApi public static final String NOTIFICATION_BUBBLES = "notification_bubbles"; private static final Validator NOTIFICATION_BUBBLES_VALIDATOR = BOOLEAN_VALIDATOR; /** * Whether notifications are dismissed by a right-to-left swipe (instead of a left-to-right * swipe). Loading Loading @@ -8604,6 +8614,7 @@ public final class Settings { ASSIST_GESTURE_WAKE_ENABLED, VR_DISPLAY_MODE, NOTIFICATION_BADGING, NOTIFICATION_BUBBLES, NOTIFICATION_DISMISS_RTL, QS_AUTO_ADDED_TILES, SCREENSAVER_ENABLED, Loading Loading @@ -8766,6 +8777,7 @@ public final class Settings { VALIDATORS.put(ASSIST_GESTURE_WAKE_ENABLED, ASSIST_GESTURE_WAKE_ENABLED_VALIDATOR); VALIDATORS.put(VR_DISPLAY_MODE, VR_DISPLAY_MODE_VALIDATOR); VALIDATORS.put(NOTIFICATION_BADGING, NOTIFICATION_BADGING_VALIDATOR); VALIDATORS.put(NOTIFICATION_BUBBLES, NOTIFICATION_BUBBLES_VALIDATOR); VALIDATORS.put(NOTIFICATION_DISMISS_RTL, NOTIFICATION_DISMISS_RTL_VALIDATOR); VALIDATORS.put(QS_AUTO_ADDED_TILES, QS_AUTO_ADDED_TILES_VALIDATOR); VALIDATORS.put(SCREENSAVER_ENABLED, SCREENSAVER_ENABLED_VALIDATOR); Loading
core/java/android/service/notification/NotificationListenerService.java +29 −2 Original line number Diff line number Diff line Loading @@ -1503,6 +1503,7 @@ public abstract class NotificationListenerService extends Service { private boolean mNoisy; private ArrayList<Notification.Action> mSmartActions; private ArrayList<CharSequence> mSmartReplies; private boolean mCanBubble; public Ranking() {} Loading Loading @@ -1677,6 +1678,17 @@ public abstract class NotificationListenerService extends Service { return mLastAudiblyAlertedMs; } /** * Returns whether the user has allowed bubbles globally, at the app level, and at the * channel level for this notification. * * <p>This does not take into account the current importance of the notification, the * current DND state, or whether the posting app is foreground.</p> */ public boolean canBubble() { return mCanBubble; } /** @hide */ public boolean isNoisy() { return mNoisy; Loading @@ -1693,7 +1705,7 @@ public abstract class NotificationListenerService extends Service { ArrayList<SnoozeCriterion> snoozeCriteria, boolean showBadge, int userSentiment, boolean hidden, long lastAudiblyAlertedMs, boolean noisy, ArrayList<Notification.Action> smartActions, ArrayList<CharSequence> smartReplies) { ArrayList<CharSequence> smartReplies, boolean canBubble) { mKey = key; mRank = rank; mIsAmbient = importance < NotificationManager.IMPORTANCE_LOW; Loading @@ -1713,6 +1725,7 @@ public abstract class NotificationListenerService extends Service { mNoisy = noisy; mSmartActions = smartActions; mSmartReplies = smartReplies; mCanBubble = canBubble; } /** Loading Loading @@ -1766,6 +1779,7 @@ public abstract class NotificationListenerService extends Service { private ArrayMap<String, Boolean> mNoisy; private ArrayMap<String, ArrayList<Notification.Action>> mSmartActions; private ArrayMap<String, ArrayList<CharSequence>> mSmartReplies; private boolean[] mCanBubble; private RankingMap(NotificationRankingUpdate rankingUpdate) { mRankingUpdate = rankingUpdate; Loading Loading @@ -1796,7 +1810,7 @@ public abstract class NotificationListenerService extends Service { getChannel(key), getOverridePeople(key), getSnoozeCriteria(key), getShowBadge(key), getUserSentiment(key), getHidden(key), getLastAudiblyAlerted(key), getNoisy(key), getSmartActions(key), getSmartReplies(key)); getSmartReplies(key), canBubble(key)); return rank >= 0; } Loading Loading @@ -1972,6 +1986,19 @@ public abstract class NotificationListenerService extends Service { return mSmartReplies.get(key); } private boolean canBubble(String key) { synchronized (this) { if (mRanks == null) { buildRanksLocked(); } if (mCanBubble == null) { mCanBubble = mRankingUpdate.getCanBubble(); } } int keyIndex = mRanks.getOrDefault(key, -1); return keyIndex >= 0 ? mCanBubble[keyIndex] : false; } // Locked by 'this' private void buildRanksLocked() { String[] orderedKeys = mRankingUpdate.getOrderedKeys(); Loading