diff options
author | Jim Miller <jaggies@google.com> | 2010-03-25 18:37:48 -0700 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2010-03-25 19:55:23 -0700 |
commit | f7c5d0e46ced3ec3edb6f656acd82900b9ac988c (patch) | |
tree | aa2e55965518d3b367e316205c651dd109c24ca0 /policy | |
parent | cd8aed8c503ee37fa36b7d14744c9d0271faf12d (diff) | |
download | frameworks_base-f7c5d0e46ced3ec3edb6f656acd82900b9ac988c.zip frameworks_base-f7c5d0e46ced3ec3edb6f656acd82900b9ac988c.tar.gz frameworks_base-f7c5d0e46ced3ec3edb6f656acd82900b9ac988c.tar.bz2 |
Fix 2535700: Add support for enforcing password quality
Change-Id: I945eea1a3869f48d636ed0c1172063f7bc57e889
Diffstat (limited to 'policy')
-rw-r--r-- | policy/com/android/internal/policy/impl/LockPatternKeyguardView.java | 18 | ||||
-rw-r--r-- | policy/com/android/internal/policy/impl/PasswordUnlockScreen.java | 6 |
2 files changed, 15 insertions, 9 deletions
diff --git a/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java index 4005ae6..5a32dc8 100644 --- a/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -27,6 +27,7 @@ import android.accounts.AccountManagerFuture; import android.accounts.AuthenticatorException; import android.accounts.OperationCanceledException; import android.app.AlertDialog; +import android.app.admin.DevicePolicyManager; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; @@ -281,8 +282,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase { if (DEBUG) Log.d(TAG, "reportFailedPatternAttempt: #" + failedAttempts + " (enableFallback=" + mEnableFallback + ")"); - final boolean usingLockPattern = mLockPatternUtils.getPasswordMode() - == LockPatternUtils.MODE_PATTERN; + final boolean usingLockPattern = mLockPatternUtils.getKeyguardStoredPasswordQuality() + == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING; if (usingLockPattern && mEnableFallback && failedAttempts == (LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) { @@ -639,8 +640,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase { final IccCard.State simState = mUpdateMonitor.getSimState(); if (stuckOnLockScreenBecauseSimMissing() || (simState == IccCard.State.PUK_REQUIRED)) { return Mode.LockScreen; - } else if (isSecure() - && mLockPatternUtils.getPasswordMode() == LockPatternUtils.MODE_PATTERN) { + } else if (isSecure()) { return Mode.UnlockScreen; } else { return Mode.LockScreen; @@ -656,13 +656,15 @@ public class LockPatternKeyguardView extends KeyguardViewBase { if (simState == IccCard.State.PIN_REQUIRED || simState == IccCard.State.PUK_REQUIRED) { currentMode = UnlockMode.SimPin; } else { - final int mode = mLockPatternUtils.getPasswordMode(); + final int mode = mLockPatternUtils.getKeyguardStoredPasswordQuality(); switch (mode) { - case LockPatternUtils.MODE_PIN: - case LockPatternUtils.MODE_PASSWORD: + case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC: + case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC: + case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC: currentMode = UnlockMode.Password; break; - case LockPatternUtils.MODE_PATTERN: + case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING: + case DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED: // "forgot pattern" button is only available in the pattern mode... if (mForgotPattern || mLockPatternUtils.isPermanentlyLocked()) { currentMode = UnlockMode.Account; diff --git a/policy/com/android/internal/policy/impl/PasswordUnlockScreen.java b/policy/com/android/internal/policy/impl/PasswordUnlockScreen.java index 07eaf93..a0e4f93 100644 --- a/policy/com/android/internal/policy/impl/PasswordUnlockScreen.java +++ b/policy/com/android/internal/policy/impl/PasswordUnlockScreen.java @@ -16,6 +16,7 @@ package com.android.internal.policy.impl; +import android.app.admin.DevicePolicyManager; import android.content.Context; import android.content.res.Configuration; import android.graphics.Rect; @@ -85,7 +86,10 @@ public class PasswordUnlockScreen extends LinearLayout implements KeyguardScreen layoutInflater.inflate(R.layout.keyguard_screen_password_landscape, this, true); } - boolean isAlpha = lockPatternUtils.getPasswordMode() == LockPatternUtils.MODE_PASSWORD; + final int quality = lockPatternUtils.getKeyguardStoredPasswordQuality(); + final boolean isAlpha = DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC == quality + || DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC == quality; + mKeyboardView = (PasswordEntryKeyboardView) findViewById(R.id.keyboard); mPasswordEntry = (EditText) findViewById(R.id.passwordEntry); mPasswordEntry.setOnEditorActionListener(this); |