diff options
author | Jim Miller <jaggies@google.com> | 2014-07-10 02:13:11 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-09 14:43:38 +0000 |
commit | 45ece1cf60f5c8de28122c36a168553e63c9855e (patch) | |
tree | d9a8fc1d17c27278c8e4cc8bc942372ef7014b25 /src/com/android | |
parent | ce249fe38ddf8da562a0e92c58a7bb216a23c0bb (diff) | |
parent | 8fd852e7c2f488650095024aca9c51f8c7ddc3b3 (diff) | |
download | packages_apps_Settings-45ece1cf60f5c8de28122c36a168553e63c9855e.tar.gz packages_apps_Settings-45ece1cf60f5c8de28122c36a168553e63c9855e.tar.bz2 packages_apps_Settings-45ece1cf60f5c8de28122c36a168553e63c9855e.zip |
Merge "Add new "pin complex" type to supported keyguard PINs"
Diffstat (limited to 'src/com/android')
4 files changed, 16 insertions, 5 deletions
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java index 30a72ef99..c444dc47e 100644 --- a/src/com/android/settings/ChooseLockGeneric.java +++ b/src/com/android/settings/ChooseLockGeneric.java @@ -278,7 +278,7 @@ public class ChooseLockGeneric extends SettingsActivity { } else if (KEY_UNLOCK_SET_PATTERN.equals(key)) { enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_SOMETHING; } else if (KEY_UNLOCK_SET_PIN.equals(key)) { - enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_NUMERIC; + enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX; } else if (KEY_UNLOCK_SET_PASSWORD.equals(key)) { enabled = quality <= DevicePolicyManager.PASSWORD_QUALITY_COMPLEX; } diff --git a/src/com/android/settings/ChooseLockPassword.java b/src/com/android/settings/ChooseLockPassword.java index 90cd25138..6dfb0f7db 100644 --- a/src/com/android/settings/ChooseLockPassword.java +++ b/src/com/android/settings/ChooseLockPassword.java @@ -329,10 +329,18 @@ public class ChooseLockPassword extends SettingsActivity { } } if (DevicePolicyManager.PASSWORD_QUALITY_NUMERIC == mRequestedQuality - && (letters > 0 || symbols > 0)) { - // This shouldn't be possible unless user finds some way to bring up - // soft keyboard - return getString(R.string.lockpassword_pin_contains_non_digits); + || DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX == mRequestedQuality) { + if (letters > 0 || symbols > 0) { + // This shouldn't be possible unless user finds some way to bring up + // soft keyboard + return getString(R.string.lockpassword_pin_contains_non_digits); + } + // Check for repeated characters or sequences (e.g. '1234', '0000', '2468') + final int sequence = LockPatternUtils.maxLengthSequence(password); + if (DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX == mRequestedQuality + && sequence > LockPatternUtils.MAX_ALLOWED_SEQUENCE) { + return getString(R.string.lockpassword_pin_no_sequential_digits); + } } else if (DevicePolicyManager.PASSWORD_QUALITY_COMPLEX == mRequestedQuality) { if (letters < mPasswordMinLetters) { return String.format(getResources().getQuantityString( @@ -375,6 +383,7 @@ public class ChooseLockPassword extends SettingsActivity { return getString(mIsAlphaMode ? R.string.lockpassword_password_recently_used : R.string.lockpassword_pin_recently_used); } + return null; } diff --git a/src/com/android/settings/ChooseLockSettingsHelper.java b/src/com/android/settings/ChooseLockSettingsHelper.java index 15d1203ca..d59fefbe2 100644 --- a/src/com/android/settings/ChooseLockSettingsHelper.java +++ b/src/com/android/settings/ChooseLockSettingsHelper.java @@ -60,6 +60,7 @@ public final class ChooseLockSettingsHelper { launched = confirmPattern(request, message, details); break; case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC: + case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX: case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC: case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC: case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX: diff --git a/src/com/android/settings/SecuritySettings.java b/src/com/android/settings/SecuritySettings.java index 0af022ac6..6961b2a2e 100644 --- a/src/com/android/settings/SecuritySettings.java +++ b/src/com/android/settings/SecuritySettings.java @@ -151,6 +151,7 @@ public class SecuritySettings extends SettingsPreferenceFragment resid = R.xml.security_settings_pattern; break; case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC: + case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX: resid = R.xml.security_settings_pin; break; case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC: |