Merge "Trust: Look at the security unlock method of the right user" into lmp-dev

This commit is contained in:
Adrian Roos
2014-09-01 21:13:11 +00:00
committed by Android (Google) Code Review
2 changed files with 15 additions and 6 deletions

View File

@@ -862,14 +862,23 @@ public class LockPatternUtils {
* @return stored password quality
*/
public int getKeyguardStoredPasswordQuality() {
int quality =
(int) getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
return getKeyguardStoredPasswordQuality(getCurrentOrCallingUserId());
}
/**
* Retrieves the quality mode for {@param userHandle}.
* {@see DevicePolicyManager#getPasswordQuality(android.content.ComponentName)}
*
* @return stored password quality
*/
public int getKeyguardStoredPasswordQuality(int userHandle) {
int quality = (int) getLong(PASSWORD_TYPE_KEY,
DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userHandle);
// If the user has chosen to use weak biometric sensor, then return the backup locking
// method and treat biometric as a special case.
if (quality == DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK) {
quality =
(int) getLong(PASSWORD_TYPE_ALTERNATE_KEY,
DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
quality = (int) getLong(PASSWORD_TYPE_ALTERNATE_KEY,
DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, userHandle);
}
return quality;
}

View File

@@ -168,7 +168,7 @@ public class TrustManagerService extends SystemService {
obsoleteAgents.addAll(mActiveAgents);
for (UserInfo userInfo : userInfos) {
if (lockPatternUtils.getKeyguardStoredPasswordQuality()
if (lockPatternUtils.getKeyguardStoredPasswordQuality(userInfo.id)
== DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) continue;
DevicePolicyManager dpm = lockPatternUtils.getDevicePolicyManager();
int disabledFeatures = dpm.getKeyguardDisabledFeatures(null, userInfo.id);