Merge "isPasswordEnabled and isPatternEnabled return true if used as backup method"
This commit is contained in:
committed by
Android (Google) Code Review
commit
247d8b08b2
@@ -756,24 +756,36 @@ public class LockPatternUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Whether the lock password is enabled.
|
* @return Whether the lock password is enabled, or if it is set as a backup for biometric weak
|
||||||
*/
|
*/
|
||||||
public boolean isLockPasswordEnabled() {
|
public boolean isLockPasswordEnabled() {
|
||||||
long mode = getLong(PASSWORD_TYPE_KEY, 0);
|
long mode = getLong(PASSWORD_TYPE_KEY, 0);
|
||||||
return savedPasswordExists() &&
|
long backupMode = getLong(PASSWORD_TYPE_ALTERNATE_KEY, 0);
|
||||||
(mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC
|
final boolean passwordEnabled = mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC
|
||||||
|| mode == DevicePolicyManager.PASSWORD_QUALITY_NUMERIC
|
|| mode == DevicePolicyManager.PASSWORD_QUALITY_NUMERIC
|
||||||
|| mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC
|
|| mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC
|
||||||
|| mode == DevicePolicyManager.PASSWORD_QUALITY_COMPLEX);
|
|| mode == DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
|
||||||
|
final boolean backupEnabled = backupMode == DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC
|
||||||
|
|| backupMode == DevicePolicyManager.PASSWORD_QUALITY_NUMERIC
|
||||||
|
|| backupMode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC
|
||||||
|
|| backupMode == DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
|
||||||
|
|
||||||
|
return savedPasswordExists() && (passwordEnabled ||
|
||||||
|
(isBiometricEnabled() && backupEnabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Whether the lock pattern is enabled.
|
* @return Whether the lock pattern is enabled, or if it is set as a backup for biometric weak
|
||||||
*/
|
*/
|
||||||
public boolean isLockPatternEnabled() {
|
public boolean isLockPatternEnabled() {
|
||||||
|
final boolean backupEnabled =
|
||||||
|
getLong(PASSWORD_TYPE_ALTERNATE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING)
|
||||||
|
== DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
|
||||||
|
|
||||||
return getBoolean(Settings.Secure.LOCK_PATTERN_ENABLED)
|
return getBoolean(Settings.Secure.LOCK_PATTERN_ENABLED)
|
||||||
&& getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING)
|
&& (getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING)
|
||||||
== DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
|
== DevicePolicyManager.PASSWORD_QUALITY_SOMETHING ||
|
||||||
|
(isBiometricEnabled() && backupEnabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -923,8 +935,7 @@ public class LockPatternUtils {
|
|||||||
|| mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC
|
|| mode == DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC
|
||||||
|| mode == DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
|
|| mode == DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
|
||||||
final boolean secure = isPattern && isLockPatternEnabled() && savedPatternExists()
|
final boolean secure = isPattern && isLockPatternEnabled() && savedPatternExists()
|
||||||
|| isPassword && savedPasswordExists()
|
|| isPassword && savedPasswordExists();
|
||||||
|| usingBiometricWeak() && isBiometricEnabled();
|
|
||||||
return secure;
|
return secure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -593,10 +593,6 @@ public class LockPatternKeyguardView extends KeyguardViewBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSecure() {
|
private boolean isSecure() {
|
||||||
// TODO: make this work with SIM and Account cases below.
|
|
||||||
boolean usingBiometric = mLockPatternUtils.usingBiometricWeak();
|
|
||||||
if (usingBiometric && mLockPatternUtils.isBiometricEnabled())
|
|
||||||
return true;
|
|
||||||
UnlockMode unlockMode = getUnlockMode();
|
UnlockMode unlockMode = getUnlockMode();
|
||||||
boolean secure = false;
|
boolean secure = false;
|
||||||
switch (unlockMode) {
|
switch (unlockMode) {
|
||||||
|
|||||||
Reference in New Issue
Block a user