Merge "Catch rule creation exceptions." into nyc-dev am: f1c2e62f4e

am: 35dc1899a6

* commit '35dc1899a6ecd55534135d63a58d19160d86af2a':
  Catch rule creation exceptions.

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

View File

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