Don't allow deactivating DAs when the user is not unlocked

Bug 27149570

Change-Id: I772d9cbd6edc822c8f7b1988905b702e05e674cd
diff --git a/core/java/com/android/internal/util/Preconditions.java b/core/java/com/android/internal/util/Preconditions.java
index 2f26e92..53cb56e 100644
--- a/core/java/com/android/internal/util/Preconditions.java
+++ b/core/java/com/android/internal/util/Preconditions.java
@@ -104,12 +104,24 @@
      * instance, but not involving any parameters to the calling method.
      *
      * @param expression a boolean expression
+     * @param message exception message
+     * @throws IllegalStateException if {@code expression} is false
+     */
+    public static void checkState(final boolean expression, String message) {
+        if (!expression) {
+            throw new IllegalStateException(message);
+        }
+    }
+
+    /**
+     * Ensures the truth of an expression involving the state of the calling
+     * instance, but not involving any parameters to the calling method.
+     *
+     * @param expression a boolean expression
      * @throws IllegalStateException if {@code expression} is false
      */
     public static void checkState(final boolean expression) {
-        if (!expression) {
-            throw new IllegalStateException();
-        }
+        checkState(expression, null);
     }
 
     /**