Merge "DPM: Fix regression from I54376f60ac53451ace22965d331b47cd8c2e614e" into oc-mr1-dev
This commit is contained in:
@@ -4346,16 +4346,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
private boolean resetPasswordInternal(String password, long tokenHandle, byte[] token,
|
private boolean resetPasswordInternal(String password, long tokenHandle, byte[] token,
|
||||||
int flags, int callingUid, int userHandle) {
|
int flags, int callingUid, int userHandle) {
|
||||||
int quality;
|
int quality;
|
||||||
final int realQuality;
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
quality = getPasswordQuality(null, userHandle, /* parent */ false);
|
quality = getPasswordQuality(null, userHandle, /* parent */ false);
|
||||||
if (quality == DevicePolicyManager.PASSWORD_QUALITY_MANAGED) {
|
if (quality == DevicePolicyManager.PASSWORD_QUALITY_MANAGED) {
|
||||||
quality = DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
|
quality = DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
final PasswordMetrics metrics = PasswordMetrics.computeForPassword(password);
|
final PasswordMetrics metrics = PasswordMetrics.computeForPassword(password);
|
||||||
realQuality = metrics.quality;
|
final int realQuality = metrics.quality;
|
||||||
if (quality != DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
|
||||||
|
|
||||||
if (realQuality < quality
|
if (realQuality < quality
|
||||||
&& quality != DevicePolicyManager.PASSWORD_QUALITY_COMPLEX) {
|
&& quality != DevicePolicyManager.PASSWORD_QUALITY_COMPLEX) {
|
||||||
Slog.w(LOG_TAG, "resetPassword: password quality 0x"
|
Slog.w(LOG_TAG, "resetPassword: password quality 0x"
|
||||||
@@ -4365,7 +4362,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
quality = Math.max(realQuality, quality);
|
quality = Math.max(realQuality, quality);
|
||||||
}
|
|
||||||
int length = getPasswordMinimumLength(null, userHandle, /* parent */ false);
|
int length = getPasswordMinimumLength(null, userHandle, /* parent */ false);
|
||||||
if (password.length() < length) {
|
if (password.length() < length) {
|
||||||
Slog.w(LOG_TAG, "resetPassword: password length " + password.length()
|
Slog.w(LOG_TAG, "resetPassword: password length " + password.length()
|
||||||
@@ -4442,7 +4438,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
try {
|
try {
|
||||||
if (token == null) {
|
if (token == null) {
|
||||||
if (!TextUtils.isEmpty(password)) {
|
if (!TextUtils.isEmpty(password)) {
|
||||||
mLockPatternUtils.saveLockPassword(password, null, realQuality, userHandle);
|
mLockPatternUtils.saveLockPassword(password, null, quality, userHandle);
|
||||||
} else {
|
} else {
|
||||||
mLockPatternUtils.clearLock(null, userHandle);
|
mLockPatternUtils.clearLock(null, userHandle);
|
||||||
}
|
}
|
||||||
@@ -4451,7 +4447,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
|||||||
result = mLockPatternUtils.setLockCredentialWithToken(password,
|
result = mLockPatternUtils.setLockCredentialWithToken(password,
|
||||||
TextUtils.isEmpty(password) ? LockPatternUtils.CREDENTIAL_TYPE_NONE
|
TextUtils.isEmpty(password) ? LockPatternUtils.CREDENTIAL_TYPE_NONE
|
||||||
: LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
|
: LockPatternUtils.CREDENTIAL_TYPE_PASSWORD,
|
||||||
realQuality, tokenHandle, token, userHandle);
|
quality, tokenHandle, token, userHandle);
|
||||||
}
|
}
|
||||||
boolean requireEntry = (flags & DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY) != 0;
|
boolean requireEntry = (flags & DevicePolicyManager.RESET_PASSWORD_REQUIRE_ENTRY) != 0;
|
||||||
if (requireEntry) {
|
if (requireEntry) {
|
||||||
|
|||||||
Reference in New Issue
Block a user