summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorDanielle Millett <dmillett@google.com>2011-12-21 17:02:32 -0500
committerDanielle Millett <dmillett@google.com>2012-01-10 11:40:41 -0500
commitde7a2f30548ac64d67e9ce8ac08090eb5458449d (patch)
treeb60aa8928c0fe09ea5fe1363d4e5805ca6f046df /core
parent7944704e6c4cc10105838b78d3d8403bf66a066b (diff)
downloadframeworks_base-de7a2f30548ac64d67e9ce8ac08090eb5458449d.zip
frameworks_base-de7a2f30548ac64d67e9ce8ac08090eb5458449d.tar.gz
frameworks_base-de7a2f30548ac64d67e9ce8ac08090eb5458449d.tar.bz2
DO NOT MERGE - Cherry picking from master to MR1
Fix 5783857: Device Policy Manager doesn't allow Face Unlock This makes it so that if face unlock is enabled and then a device policy manager that requires something more secure than face unlock is installed, the user will be forced to choose a new acceptable lock type. This was previously fixed for the case where the device had been reset, or the shell was restarted after setting face unlock, but not for the case where the device remained on between setting face unlock and setting up a device policy manager. Also changed the function ordering of saveLockPattern() so that the overloaded wrapper function is next to the main function. Change-Id: Ibed8c4ab137ebbc07fb143faef6f047bc6dc4474
Diffstat (limited to 'core')
-rw-r--r--core/java/com/android/internal/widget/LockPatternUtils.java87
1 files changed, 47 insertions, 40 deletions
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index 89f9d4e..adb0ac9 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -427,14 +427,6 @@ public class LockPatternUtils {
}
/**
- * Save a lock pattern.
- * @param pattern The new pattern to save.
- */
- public void saveLockPattern(List<LockPatternView.Cell> pattern) {
- this.saveLockPattern(pattern, false);
- }
-
- /**
* Calls back SetupFaceLock to delete the temporary gallery file
*/
public void deleteTempGallery() {
@@ -459,6 +451,14 @@ public class LockPatternUtils {
/**
* Save a lock pattern.
* @param pattern The new pattern to save.
+ */
+ public void saveLockPattern(List<LockPatternView.Cell> pattern) {
+ this.saveLockPattern(pattern, false);
+ }
+
+ /**
+ * Save a lock pattern.
+ * @param pattern The new pattern to save.
* @param isFallback Specifies if this is a fallback to biometric weak
*/
public void saveLockPattern(List<LockPatternView.Cell> pattern, boolean isFallback) {
@@ -482,14 +482,16 @@ public class LockPatternUtils {
if (!isFallback) {
deleteGallery();
setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
+ dpm.setActivePasswordState(DevicePolicyManager.PASSWORD_QUALITY_SOMETHING,
+ pattern.size(), 0, 0, 0, 0, 0, 0);
} else {
setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK);
setLong(PASSWORD_TYPE_ALTERNATE_KEY,
DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
finishBiometricWeak();
+ dpm.setActivePasswordState(DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK,
+ 0, 0, 0, 0, 0, 0, 0);
}
- dpm.setActivePasswordState(DevicePolicyManager.PASSWORD_QUALITY_SOMETHING, pattern
- .size(), 0, 0, 0, 0, 0, 0);
} else {
if (keyStore.isEmpty()) {
keyStore.reset();
@@ -600,40 +602,45 @@ public class LockPatternUtils {
if (!isFallback) {
deleteGallery();
setLong(PASSWORD_TYPE_KEY, Math.max(quality, computedQuality));
+ if (computedQuality != DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
+ int letters = 0;
+ int uppercase = 0;
+ int lowercase = 0;
+ int numbers = 0;
+ int symbols = 0;
+ int nonletter = 0;
+ for (int i = 0; i < password.length(); i++) {
+ char c = password.charAt(i);
+ if (c >= 'A' && c <= 'Z') {
+ letters++;
+ uppercase++;
+ } else if (c >= 'a' && c <= 'z') {
+ letters++;
+ lowercase++;
+ } else if (c >= '0' && c <= '9') {
+ numbers++;
+ nonletter++;
+ } else {
+ symbols++;
+ nonletter++;
+ }
+ }
+ dpm.setActivePasswordState(Math.max(quality, computedQuality),
+ password.length(), letters, uppercase, lowercase,
+ numbers, symbols, nonletter);
+ } else {
+ // The password is not anything.
+ dpm.setActivePasswordState(
+ DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED,
+ 0, 0, 0, 0, 0, 0, 0);
+ }
} else {
+ // Case where it's a fallback for biometric weak
setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK);
setLong(PASSWORD_TYPE_ALTERNATE_KEY, Math.max(quality, computedQuality));
finishBiometricWeak();
- }
- if (computedQuality != DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
- int letters = 0;
- int uppercase = 0;
- int lowercase = 0;
- int numbers = 0;
- int symbols = 0;
- int nonletter = 0;
- for (int i = 0; i < password.length(); i++) {
- char c = password.charAt(i);
- if (c >= 'A' && c <= 'Z') {
- letters++;
- uppercase++;
- } else if (c >= 'a' && c <= 'z') {
- letters++;
- lowercase++;
- } else if (c >= '0' && c <= '9') {
- numbers++;
- nonletter++;
- } else {
- symbols++;
- nonletter++;
- }
- }
- dpm.setActivePasswordState(Math.max(quality, computedQuality), password
- .length(), letters, uppercase, lowercase, numbers, symbols, nonletter);
- } else {
- // The password is not anything.
- dpm.setActivePasswordState(
- DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, 0, 0, 0, 0, 0, 0, 0);
+ dpm.setActivePasswordState(DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK,
+ 0, 0, 0, 0, 0, 0, 0);
}
// Add the password to the password history. We assume all
// password