summaryrefslogtreecommitdiffstats
path: root/core/java/com/android/internal/widget/LockPatternUtils.java
diff options
context:
space:
mode:
authorAndrei Kapishnikov <kapishnikov@google.com>2015-04-02 15:21:20 -0400
committerAndrei Kapishnikov <kapishnikov@google.com>2015-04-21 11:07:09 -0400
commit4eb6a36922f5e98fe181c0326cc5721f0e7589ca (patch)
tree8f56b25a90c4512c096be5126b8890e90b101a66 /core/java/com/android/internal/widget/LockPatternUtils.java
parent225d06624a86bdfdd7ced5c9f04b2ac834878727 (diff)
downloadframeworks_base-4eb6a36922f5e98fe181c0326cc5721f0e7589ca.zip
frameworks_base-4eb6a36922f5e98fe181c0326cc5721f0e7589ca.tar.gz
frameworks_base-4eb6a36922f5e98fe181c0326cc5721f0e7589ca.tar.bz2
Introduced DO_NOT_ASK_CREDENTIALS_ON_BOOT flag
A new flag for DPM.resetPassword() method that specifies that the device should be decrypted without asking for the password or pattern. Bug 19250601 Related CL in Settings App: https://googleplex-android-review.git.corp.google.com/#/c/670206 Change-Id: I9ca3472dc18e66e618ff772dee16ca4a450e9997
Diffstat (limited to 'core/java/com/android/internal/widget/LockPatternUtils.java')
-rw-r--r--core/java/com/android/internal/widget/LockPatternUtils.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index aa60eba..1096e34 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -24,7 +24,6 @@ import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageManager;
-import android.content.pm.UserInfo;
import android.os.AsyncTask;
import android.os.IBinder;
import android.os.RemoteException;
@@ -32,7 +31,6 @@ import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.UserHandle;
-import android.os.UserManager;
import android.os.storage.IMountService;
import android.os.storage.StorageManager;
import android.provider.Settings;
@@ -544,8 +542,7 @@ public class LockPatternUtils {
// Update the device encryption password.
if (userId == UserHandle.USER_OWNER
&& LockPatternUtils.isDeviceEncryptionEnabled()) {
- final boolean required = isCredentialRequiredToDecrypt(true);
- if (!required) {
+ if (!shouldEncryptWithCredentials(true)) {
clearEncryptionPassword();
} else {
String stringPattern = patternToString(pattern);
@@ -759,7 +756,7 @@ public class LockPatternUtils {
// Update the device encryption password.
if (userHandle == UserHandle.USER_OWNER
&& LockPatternUtils.isDeviceEncryptionEnabled()) {
- if (!isCredentialRequiredToDecrypt(true)) {
+ if (!shouldEncryptWithCredentials(true)) {
clearEncryptionPassword();
} else {
boolean numeric = computedQuality
@@ -1238,4 +1235,12 @@ public class LockPatternUtils {
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.REQUIRE_PASSWORD_TO_DECRYPT, required ? 1 : 0);
}
+
+ private boolean isDoNotAskCredentialsOnBootSet() {
+ return mDevicePolicyManager.getDoNotAskCredentialsOnBoot();
+ }
+
+ private boolean shouldEncryptWithCredentials(boolean defaultValue) {
+ return isCredentialRequiredToDecrypt(defaultValue) && !isDoNotAskCredentialsOnBootSet();
+ }
}