From 87c42773602f64d2ebae2631cffed7b88232dfbe Mon Sep 17 00:00:00 2001 From: Julia Reynolds Date: Mon, 16 May 2016 09:52:17 -0400 Subject: [PATCH] Throw exception on rule creation failure. Bug: 28775583 Change-Id: I98cf90afd86e307846970f1ede7f072eb8b70c7f --- .../core/java/com/android/server/notification/ZenModeHelper.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java index 60e00a926ed0..6864ed898ada 100644 --- a/services/core/java/com/android/server/notification/ZenModeHelper.java +++ b/services/core/java/com/android/server/notification/ZenModeHelper.java @@ -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"); } } } -- 2.11.0