Merge "Only check password length for relevant qualities." into nyc-mr1-dev

This commit is contained in:
Andrew Scull
2016-08-25 14:50:27 +00:00
committed by Android (Google) Code Review

View File

@@ -3673,12 +3673,16 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
private boolean isActivePasswordSufficientForUserLocked( private boolean isActivePasswordSufficientForUserLocked(
DevicePolicyData policy, int userHandle, boolean parent) { DevicePolicyData policy, int userHandle, boolean parent) {
if (policy.mActivePasswordQuality < getPasswordQuality(null, userHandle, parent) final int requiredPasswordQuality = getPasswordQuality(null, userHandle, parent);
|| policy.mActivePasswordLength < getPasswordMinimumLength( if (policy.mActivePasswordQuality < requiredPasswordQuality) {
return false;
}
if (requiredPasswordQuality >= DevicePolicyManager.PASSWORD_QUALITY_NUMERIC
&& policy.mActivePasswordLength < getPasswordMinimumLength(
null, userHandle, parent)) { null, userHandle, parent)) {
return false; return false;
} }
if (policy.mActivePasswordQuality != DevicePolicyManager.PASSWORD_QUALITY_COMPLEX) { if (requiredPasswordQuality != DevicePolicyManager.PASSWORD_QUALITY_COMPLEX) {
return true; return true;
} }
return policy.mActivePasswordUpperCase >= getPasswordMinimumUpperCase( return policy.mActivePasswordUpperCase >= getPasswordMinimumUpperCase(