Credential storage: check lock quality for right user

Checking the wrong user can lead to an infinite loop when trying to
install credentials from a managed profile.

Bug: 28043334
Change-Id: I3e1044069f0d5139a47de461996a6d98e0fe5e2f
This commit is contained in:
Robin Lee
2016-04-07 14:55:06 +01:00
parent 2de9313d2c
commit 330c2052ec

View File

@@ -208,9 +208,9 @@ public final class CredentialStorage extends Activity {
* Returns true if the currently set key guard matches our minimum quality requirements.
*/
private boolean checkKeyGuardQuality() {
UserInfo parent = UserManager.get(this).getProfileParent(UserHandle.myUserId());
int quality = new LockPatternUtils(this).getActivePasswordQuality(
parent != null ? parent.id : UserHandle.myUserId());
int credentialOwner =
UserManager.get(this).getCredentialOwnerProfile(UserHandle.myUserId());
int quality = new LockPatternUtils(this).getActivePasswordQuality(credentialOwner);
return (quality >= MIN_PASSWORD_QUALITY);
}