Bubble settings: feature, notification, app

* Removed setting from developer options
* Removed bubble settings from normal notifications /
  channels

* Feature available via notification setting
* Feature screen with educational gif

* App level is now a tri-state choice of all / selected /
  none
* App level bubble controls are accessible top-level in
  app notifications

Test: make -j40 RunSettingsRoboTests ROBOTEST_FILTER="Bubble"
Bug: 138116133
Change-Id: Id103e9d3717fdc9b86a916be40c43cda9c35ac34
This commit is contained in:
Mady Mellor
2020-03-05 18:31:39 -08:00
parent 23040a3b2b
commit 409c3dfe68
29 changed files with 1183 additions and 411 deletions

View File

@@ -24,6 +24,7 @@ import android.app.INotificationManager;
import android.app.NotificationChannel;
import android.app.NotificationChannelGroup;
import android.app.NotificationHistory;
import android.app.NotificationManager;
import android.app.role.RoleManager;
import android.app.usage.IUsageStatsManager;
import android.app.usage.UsageEvents;
@@ -81,7 +82,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.bubblePreference = getBubblePreference(row.pkg, row.uid);
row.userId = UserHandle.getUserId(row.uid);
row.blockedChannelCount = getBlockedChannelCount(row.pkg, row.uid);
row.channelCount = getChannelCount(row.pkg, row.uid);
@@ -192,18 +193,18 @@ public class NotificationBackend {
}
}
public boolean canBubble(String pkg, int uid) {
public int getBubblePreference(String pkg, int uid) {
try {
return sINM.areBubblesAllowedForPackage(pkg, uid);
return sINM.getBubblePreferenceForPackage(pkg, uid);
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
return false;
return -1;
}
}
public boolean setAllowBubbles(String pkg, int uid, boolean allow) {
public boolean setAllowBubbles(String pkg, int uid, int preference) {
try {
sINM.setBubblesAllowed(pkg, uid, allow);
sINM.setBubblesAllowed(pkg, uid, preference);
return true;
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
@@ -563,7 +564,7 @@ public class NotificationBackend {
public boolean systemApp;
public boolean lockedImportance;
public boolean showBadge;
public boolean allowBubbles;
public int bubblePreference = NotificationManager.BUBBLE_PREFERENCE_NONE;
public int userId;
public int blockedChannelCount;
public int channelCount;