Add settings for notification bubbling

Globally, as well as at the app and channel level

Test: atest
Bug: 123543052
Change-Id: I1668b592c5d175d77d6a38f35e7576d641175d44
This commit is contained in:
Julia Reynolds
2019-01-31 13:13:30 -05:00
parent 12cec79889
commit 0c45775a5d
12 changed files with 713 additions and 4 deletions

View File

@@ -71,6 +71,7 @@ public class NotificationBackend {
row.icon = IconDrawableFactory.newInstance(context).getBadgedIcon(app);
row.banned = getNotificationsBanned(row.pkg, row.uid);
row.showBadge = canShowBadge(row.pkg, row.uid);
row.allowBubbles = canBubble(row.pkg, row.uid);
row.userId = UserHandle.getUserId(row.uid);
row.blockedChannelCount = getBlockedChannelCount(row.pkg, row.uid);
row.channelCount = getChannelCount(row.pkg, row.uid);
@@ -175,6 +176,26 @@ public class NotificationBackend {
}
}
public boolean canBubble(String pkg, int uid) {
try {
return sINM.areBubblesAllowedForPackage(pkg, uid);
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
return false;
}
}
public boolean setAllowBubbles(String pkg, int uid, boolean allow) {
try {
sINM.setBubblesAllowed(pkg, uid, allow);
return true;
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
return false;
}
}
public NotificationChannel getChannel(String pkg, int uid, String channelId) {
if (channelId == null) {
return null;
@@ -416,6 +437,7 @@ public class NotificationBackend {
public boolean lockedImportance;
public String lockedChannelId;
public boolean showBadge;
public boolean allowBubbles;
public int userId;
public int blockedChannelCount;
public int channelCount;