diff options
author | Vairavan Srinivasan <vairav@codeaurora.org> | 2012-08-15 23:37:45 -0700 |
---|---|---|
committer | Vairavan Srinivasan <vairav@codeaurora.org> | 2012-08-15 23:37:45 -0700 |
commit | 8809004bc5125d48a1bbfc292509514374cc4fce (patch) | |
tree | 82f84e9650498c7b016e28044d31ea485abca69c /services | |
parent | 98853623bcb27155e9b030301a0cb2a987cfc612 (diff) | |
download | frameworks_base-8809004bc5125d48a1bbfc292509514374cc4fce.zip frameworks_base-8809004bc5125d48a1bbfc292509514374cc4fce.tar.gz frameworks_base-8809004bc5125d48a1bbfc292509514374cc4fce.tar.bz2 |
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
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/am/ProviderMap.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/services/java/com/android/server/am/ProviderMap.java b/services/java/com/android/server/am/ProviderMap.java index d148ec3..e4608a2 100644 --- a/services/java/com/android/server/am/ProviderMap.java +++ b/services/java/com/android/server/am/ProviderMap.java @@ -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); + } } } |