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

Commit 8809004b authored by Vairavan Srinivasan's avatar Vairavan Srinivasan
Browse files

ProviderMap: remove hashmap when entire user specific entries are removed

User specific entries in  mProvidersByNamePerUser and mProvidersByClassPerUser
isn't cleared when entire user specific providers are removed. Fix is to remove
the user specific hashmap in such cases.

Change-Id: I6edf211ced873e59f3b89ffceb9eceec13ea8f3f
parent 98853623
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -127,7 +127,12 @@ public class ProviderMap {
                Slog.i(TAG,
                        "Removing from providersByName name=" + name + " user="
                        + (optionalUserId == -1 ? Binder.getOrigCallingUser() : optionalUserId));
            getProvidersByName(optionalUserId).remove(name);
            HashMap<String, ContentProviderRecord> map = getProvidersByName(optionalUserId);
            // map returned by getProvidersByName wouldn't be null
            map.remove(name);
            if (map.size() == 0) {
                mProvidersByNamePerUser.remove(optionalUserId);
            }
        }
    }

@@ -141,7 +146,12 @@ public class ProviderMap {
                Slog.i(TAG,
                        "Removing from providersByClass name=" + name + " user="
                        + (optionalUserId == -1 ? Binder.getOrigCallingUser() : optionalUserId));
            getProvidersByClass(optionalUserId).remove(name);
            HashMap<ComponentName, ContentProviderRecord> map = getProvidersByClass(optionalUserId);
            // map returned by getProvidersByClass wouldn't be null
            map.remove(name);
            if (map.size() == 0) {
                mProvidersByClassPerUser.remove(optionalUserId);
            }
        }
    }