Notification settings updates

- Hide channels when a group is blocked
- Update importance strings
- Allow app blocking from 'recently seen'

Test: RoboSettingsTests
Fixes: 72879584
Fixes: 72882969
Fixes: 72831483
Change-Id: I99e001d3eb9eef52251cd50da191d33923335fcf
This commit is contained in:
Julia Reynolds
2018-02-05 12:49:44 -05:00
parent 7262d37c53
commit 18f14f10cf
10 changed files with 489 additions and 50 deletions

View File

@@ -15,6 +15,9 @@
*/
package com.android.settings.notification;
import static android.app.NotificationManager.IMPORTANCE_NONE;
import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;
import android.app.INotificationManager;
import android.app.NotificationChannel;
import android.app.NotificationChannelGroup;
@@ -101,6 +104,12 @@ public class NotificationBackend {
public boolean setNotificationsEnabledForPackage(String pkg, int uid, boolean enabled) {
try {
if (onlyHasDefaultChannel(pkg, uid)) {
NotificationChannel defaultChannel =
getChannel(pkg, uid, NotificationChannel.DEFAULT_CHANNEL_ID);
defaultChannel.setImportance(enabled ? IMPORTANCE_UNSPECIFIED : IMPORTANCE_NONE);
updateChannel(pkg, uid, defaultChannel);
}
sINM.setNotificationsEnabledForPackage(pkg, uid, enabled);
return true;
} catch (Exception e) {