Notification settings updates

- Add 'show badge' for apps
- disable deleted channel rows
- Add an importance reset for pre-O apps

Test: manual
Change-Id: Ic32415497fe48a17f6cdb9aace37e35f9388195a
This commit is contained in:
Julia Reynolds
2017-01-19 09:49:23 -05:00
parent 37d64387a3
commit 1f178a9ed1
8 changed files with 120 additions and 55 deletions

View File

@@ -26,6 +26,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ParceledListSlice;
import android.graphics.drawable.Drawable;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.util.Log;
import com.android.settingslib.Utils;
@@ -48,6 +49,8 @@ public class NotificationBackend {
}
row.icon = app.loadIcon(pm);
row.banned = getNotificationsBanned(row.pkg, row.uid);
row.showBadge = canShowBadge(row.pkg, row.uid);
row.userId = UserHandle.getUserId(row.uid);
return row;
}
@@ -87,6 +90,25 @@ public class NotificationBackend {
}
}
public boolean canShowBadge(String pkg, int uid) {
try {
return sINM.canShowBadge(pkg, uid);
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
return false;
}
}
public boolean setShowBadge(String pkg, int uid, boolean showBadge) {
try {
sINM.setShowBadge(pkg, uid, showBadge);
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;
@@ -129,6 +151,8 @@ public class NotificationBackend {
public boolean banned;
public boolean first; // first app in section
public boolean systemApp;
public boolean showBadge;
public int userId;
}
public static class ChannelRow extends AppRow {