Merge "Throw exception on rule creation failure." into nyc-dev am: 252a6b125b

am: 2e1c9f1539

* commit '2e1c9f1539b4947fdd9167ae269d6198fc073b9f':
  Throw exception on rule creation failure.

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

View File

@@ -55,6 +55,7 @@ import android.service.notification.ZenModeConfig.EventInfo;
import android.service.notification.ZenModeConfig.ScheduleInfo;
import android.service.notification.ZenModeConfig.ZenRule;
import android.text.TextUtils;
import android.util.AndroidRuntimeException;
import android.util.Log;
import android.util.SparseArray;
@@ -293,7 +294,9 @@ public class ZenModeHelper {
ZenModeConfig newConfig;
synchronized (mConfig) {
if (mConfig == null) return null;
if (mConfig == null) {
throw new AndroidRuntimeException("Could not create rule");
}
if (DEBUG) {
Log.d(TAG, "addAutomaticZenRule rule= " + automaticZenRule + " reason=" + reason);
}
@@ -304,7 +307,7 @@ public class ZenModeHelper {
if (setConfigLocked(newConfig, reason, true)) {
return rule.id;
} else {
return null;
throw new AndroidRuntimeException("Could not create rule");
}
}
}