summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorMady Mellor <madym@google.com>2020-03-09 17:25:08 -0700
committerMady Mellor <madym@google.com>2020-04-09 14:49:29 -0700
commita92268cd01aeaf66c4126f9197fed423fdbe9202 (patch)
treee723c015872f72aaf411f60ca32369d6d9bd2ae8 /core/java/android
parent4cbb22353a857c31bd3413da6ca8d3de0e2fe59f (diff)
Make bubble settings a pref with an int rather than a bool
This will allow us to do all/selected/none preferences for bubbles in settings. - Feature is on by default - App is none by default - Channel is off by default Test: atest NotificationManagerServiceTest BubbleExtractorTest Bug: 138116133 Change-Id: Ifad1c22525123354f76959c2d44392a25d56347d
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/INotificationManager.aidl5
-rw-r--r--core/java/android/app/NotificationChannel.java21
-rw-r--r--core/java/android/app/NotificationManager.java15
3 files changed, 24 insertions, 17 deletions
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index 78d3581a7012..9d0364eba39f 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -78,10 +78,9 @@ interface INotificationManager
boolean shouldHideSilentStatusIcons(String callingPkg);
void setHideSilentStatusIcons(boolean hide);
- void setBubblesAllowed(String pkg, int uid, boolean allowed);
+ void setBubblesAllowed(String pkg, int uid, int bubblePreference);
boolean areBubblesAllowed(String pkg);
- boolean areBubblesAllowedForPackage(String pkg, int uid);
- boolean hasUserApprovedBubblesForPackage(String pkg, int uid);
+ int getBubblePreferenceForPackage(String pkg, int uid);
void createNotificationChannelGroups(String pkg, in ParceledListSlice channelGroupList);
void createNotificationChannels(String pkg, in ParceledListSlice channelsList);
diff --git a/core/java/android/app/NotificationChannel.java b/core/java/android/app/NotificationChannel.java
index d1d67f0d81d8..2feb9277775c 100644
--- a/core/java/android/app/NotificationChannel.java
+++ b/core/java/android/app/NotificationChannel.java
@@ -102,7 +102,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 = "can_bubble";
+ private static final String ATT_ALLOW_BUBBLE = "allow_bubble";
private static final String ATT_ORIG_IMP = "orig_imp";
private static final String ATT_PARENT_CHANNEL = "parent";
private static final String ATT_CONVERSATION_ID = "conv_id";
@@ -168,7 +168,7 @@ public final class NotificationChannel implements Parcelable {
NotificationManager.IMPORTANCE_UNSPECIFIED;
private static final boolean DEFAULT_DELETED = false;
private static final boolean DEFAULT_SHOW_BADGE = true;
- private static final boolean DEFAULT_ALLOW_BUBBLE = true;
+ private static final boolean DEFAULT_ALLOW_BUBBLE = false;
@UnsupportedAppUsage
private String mId;
@@ -545,15 +545,8 @@ public final class NotificationChannel implements Parcelable {
}
/**
- * Sets whether notifications posted to this channel can appear outside of the notification
- * shade, floating over other apps' content as a bubble.
- *
- * <p>This value will be ignored for channels that aren't allowed to pop on screen (that is,
- * channels whose {@link #getImportance() importance} is <
- * {@link NotificationManager#IMPORTANCE_HIGH}.</p>
- *
- * <p>Only modifiable before the channel is submitted to
- * * {@link NotificationManager#createNotificationChannel(NotificationChannel)}.</p>
+ * As of Android 11 this value is no longer respected.
+ * @see #canBubble()
* @see Notification#getBubbleMetadata()
*/
public void setAllowBubbles(boolean allowBubbles) {
@@ -702,8 +695,10 @@ public final class NotificationChannel implements Parcelable {
}
/**
- * Returns whether notifications posted to this channel can display outside of the notification
- * shade, in a floating window on top of other apps.
+ * Returns whether notifications posted to this channel are allowed to display outside of the
+ * notification shade, in a floating window on top of other apps.
+ *
+ * @see Notification#getBubbleMetadata()
*/
public boolean canBubble() {
return mAllowBubbles;
diff --git a/core/java/android/app/NotificationManager.java b/core/java/android/app/NotificationManager.java
index 0e97e3fe06ce..d6df400f86b6 100644
--- a/core/java/android/app/NotificationManager.java
+++ b/core/java/android/app/NotificationManager.java
@@ -452,6 +452,19 @@ public class NotificationManager {
*/
public static final int IMPORTANCE_MAX = 5;
+ /**
+ * @hide
+ */
+ public static final int BUBBLE_PREFERENCE_NONE = 0;
+ /**
+ * @hide
+ */
+ public static final int BUBBLE_PREFERENCE_ALL = 1;
+ /**
+ * @hide
+ */
+ public static final int BUBBLE_PREFERENCE_SELECTED = 2;
+
@UnsupportedAppUsage
private static INotificationManager sService;
@@ -1213,7 +1226,7 @@ public class NotificationManager {
/**
- * Sets whether notifications posted by this app can appear outside of the
+ * Gets whether all notifications posted by this app can appear outside of the
* notification shade, floating over other apps' content.
*
* <p>This value will be ignored for notifications that are posted to channels that do not