Use id-based zen rule APIs.

Also names no longer have to be unique.

Bug: 22977552
Change-Id: I8dbee85c15d12d5380345447047a0d49c903522e
This commit is contained in:
Julia Reynolds
2015-10-07 19:32:22 -04:00
parent 38ee17a4ae
commit 25cb8f0691
4 changed files with 34 additions and 83 deletions

View File

@@ -87,16 +87,23 @@ abstract public class ZenModeSettingsBase extends RestrictedSettingsFragment {
}
}
protected AutomaticZenRule addZenRule(AutomaticZenRule rule) {
final AutomaticZenRule savedRule =
NotificationManager.from(mContext).addAutomaticZenRule(rule);
maybeRefreshRules(savedRule != null, true);
return savedRule;
}
protected boolean setZenRule(AutomaticZenRule rule) {
final boolean success =
NotificationManager.from(mContext).addOrUpdateAutomaticZenRule(rule);
NotificationManager.from(mContext).updateAutomaticZenRule(rule);
maybeRefreshRules(success, true);
return success;
}
protected boolean removeZenRule(String name) {
protected boolean removeZenRule(String id) {
final boolean success =
NotificationManager.from(mContext).removeAutomaticZenRule(name);
NotificationManager.from(mContext).removeAutomaticZenRule(id);
maybeRefreshRules(success, true);
return success;
}