Merge "Don\'t allow deactivating DAs when the user is not unlocked" into nyc-dev

am: dafec11e69

* commit 'dafec11e698daf054730cfb04db64f3e31a0c9ff':
  Don't allow deactivating DAs when the user is not unlocked
This commit is contained in:
Makoto Onuki
2016-02-16 20:53:03 +00:00
committed by android-build-merger
3 changed files with 92 additions and 5 deletions

View File

@@ -99,6 +99,20 @@ public class Preconditions {
return reference;
}
/**
* 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
* @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.
@@ -107,9 +121,7 @@ public class Preconditions {
* @throws IllegalStateException if {@code expression} is false
*/
public static void checkState(final boolean expression) {
if (!expression) {
throw new IllegalStateException();
}
checkState(expression, null);
}
/**