Merge "Catch rule creation exceptions." into nyc-dev

am: f1c2e62f4e

* commit 'f1c2e62f4ec00205dc1e78ff66e77d8380d9a6f2':
  Catch rule creation exceptions.

Change-Id: Ia0aa67e7aa968b18dc54a4a171780fb283b3bee8
This commit is contained in:
Julia Reynolds
2016-05-16 18:29:16 +00:00
committed by android-build-merger

View File

@@ -96,11 +96,15 @@ abstract public class ZenModeSettingsBase extends RestrictedSettingsFragment {
} }
protected String addZenRule(AutomaticZenRule rule) { protected String addZenRule(AutomaticZenRule rule) {
String id = NotificationManager.from(mContext).addAutomaticZenRule(rule); try {
final AutomaticZenRule savedRule = String id = NotificationManager.from(mContext).addAutomaticZenRule(rule);
NotificationManager.from(mContext).getAutomaticZenRule(id); final AutomaticZenRule savedRule =
maybeRefreshRules(savedRule != null, true); NotificationManager.from(mContext).getAutomaticZenRule(id);
return id; maybeRefreshRules(savedRule != null, true);
return id;
} catch (Exception e) {
return null;
}
} }
protected boolean setZenRule(String id, AutomaticZenRule rule) { protected boolean setZenRule(String id, AutomaticZenRule rule) {