Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c727fb1f authored by Adrian Roos's avatar Adrian Roos Committed by Android (Google) Code Review
Browse files

Merge "Only unbind agents of the user that is being refreshed" into lmp-dev

parents f950641e e681c27d
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -164,6 +164,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;
@@ -223,12 +228,14 @@ public class TrustManagerService extends SystemService {
        boolean trustMayHaveChanged = false;
        for (int i = 0; i < obsoleteAgents.size(); i++) {
            AgentInfo info = obsoleteAgents.valueAt(i);
            if (userId == UserHandle.USER_ALL || userId == info.userId) {
                if (info.agent.isManagingTrust()) {
                    trustMayHaveChanged = true;
                }
                info.agent.unbind();
                mActiveAgents.remove(info);
            }
        }

        if (trustMayHaveChanged) {
            updateTrustAll();