Allow users to set notification topic importance.

In the absence of mocks, the silder is shown in the
'normal' position if the user hasn't yet
chosen an importance value.

Bug: 22854014
Change-Id: I51594959412775fe89b29af66ddcb13bafa67255
This commit is contained in:
Julia Reynolds
2015-11-23 08:58:49 -05:00
parent 0501728c03
commit 9dbb20f638
7 changed files with 252 additions and 3 deletions

View File

@@ -62,6 +62,7 @@ public class NotificationBackend {
row.priority = getBypassZenMode(row.pkg, row.uid, row.topic);
row.sensitive = getSensitive(row.pkg, row.uid, row.topic);
row.banned = getNotificationsBanned(row.pkg, row.uid);
row.importance = getImportance(row.pkg, row.uid, row.topic);
return row;
}
@@ -128,6 +129,25 @@ public class NotificationBackend {
}
}
public boolean setImportance(String pkg, int uid, Notification.Topic topic, int importance) {
try {
sINM.setTopicImportance(pkg, uid, topic, importance);
return true;
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
return false;
}
}
public int getImportance(String pkg, int uid, Notification.Topic topic) {
try {
return sINM.getTopicImportance(pkg, uid, topic);
} catch (Exception e) {
Log.w(TAG, "Error calling NoMan", e);
return NotificationListenerService.Ranking.IMPORTANCE_DEFAULT;
}
}
public List<Notification.Topic> getTopics(String pkg, int uid) {
try {
final ParceledListSlice<Notification.Topic> parceledList = sINM.getTopics(pkg, uid);
@@ -156,6 +176,7 @@ public class NotificationBackend {
public Notification.Topic topic;
public boolean priority;
public boolean sensitive;
public int importance;
}
}