Only unbind agents of the user that is being refreshed

Follow-up to I470261f659a573400b2eb1421eeb953c87e58b66.

Bug: 17416492
Change-Id: If0da5f163049540476d84d147c0e733fab1ae6d5
This commit is contained in:
Adrian Roos
2014-09-08 14:03:47 +02:00
parent e51d6a3aec
commit e681c27dc6

View File

@@ -159,6 +159,11 @@ public class TrustManagerService extends SystemService {
void refreshAgentList(int userId) {
if (DEBUG) Slog.d(TAG, "refreshAgentList()");
if (userId != UserHandle.USER_ALL && userId < UserHandle.USER_OWNER) {
Log.e(TAG, "refreshAgentList(userId=" + userId + "): Invalid user handle,"
+ " must be USER_ALL or a specific user.", new Throwable("here"));
userId = UserHandle.USER_ALL;
}
PackageManager pm = mContext.getPackageManager();
List<UserInfo> userInfos;
@@ -228,11 +233,13 @@ public class TrustManagerService extends SystemService {
boolean trustMayHaveChanged = false;
for (int i = 0; i < obsoleteAgents.size(); i++) {
AgentInfo info = obsoleteAgents.valueAt(i);
if (info.agent.isManagingTrust()) {
trustMayHaveChanged = true;
if (userId == UserHandle.USER_ALL || userId == info.userId) {
if (info.agent.isManagingTrust()) {
trustMayHaveChanged = true;
}
info.agent.unbind();
mActiveAgents.remove(info);
}
info.agent.unbind();
mActiveAgents.remove(info);
}
if (trustMayHaveChanged) {