Only run TrustAgentServices for users with secure keyguards

Bug: 17107213
Change-Id: Ic9e93862c722ebc529f5b2010b9cea941f569ce7
This commit is contained in:
Adrian Roos
2014-08-20 23:36:25 +02:00
parent e2527bc206
commit 4b9e324b6f
2 changed files with 9 additions and 0 deletions

View File

@@ -479,6 +479,7 @@ public class LockPatternUtils {
saveLockPattern(null);
setLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
setLong(PASSWORD_TYPE_ALTERNATE_KEY, DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
onAfterChangingPassword();
}
/**
@@ -565,6 +566,7 @@ public class LockPatternUtils {
dpm.setActivePasswordState(DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, 0, 0,
0, 0, 0, 0, 0, userId);
}
onAfterChangingPassword();
} catch (RemoteException re) {
Log.e(TAG, "Couldn't save lock pattern " + re);
}
@@ -844,6 +846,7 @@ public class LockPatternUtils {
DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED, 0, 0, 0, 0, 0, 0, 0,
userHandle);
}
onAfterChangingPassword();
} catch (RemoteException re) {
// Cant do much
Log.e(TAG, "Unable to save lock password " + re);
@@ -1542,4 +1545,8 @@ public class LockPatternUtils {
public void requireCredentialEntry(int userId) {
getTrustManager().reportRequireCredentialEntry(userId);
}
private void onAfterChangingPassword() {
getTrustManager().reportEnabledTrustAgentsChanged(getCurrentOrCallingUserId());
}
}

View File

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