diff options
author | Hui Wang <huiwang@google.com> | 2022-02-12 03:55:14 +0000 |
---|---|---|
committer | Hui Wang <huiwang@google.com> | 2022-02-14 20:36:56 +0000 |
commit | 46011e24805e2d608caa7eab56ad7dcf2ef1a4c5 (patch) | |
tree | c20ed3932fd291b6d84ede8029fe609c1d0b47f8 /src/com/android/cellbroadcastreceiver | |
parent | 0dc1b227eb03a43867543ad01a13b7b7f84ebd5b (diff) | |
download | CellBroadcastReceiver-46011e24805e2d608caa7eab56ad7dcf2ef1a4c5.tar.gz |
Remove the redundant cache of resources
From R, SubscriptionManager#getResourcesForSubId has cached
the resources per sub id. The cache per sub id is redundant
in CellBroadcastSettings. On the other hand, if mnc is 0, it
will be updated to 0xFFFF in SubscriptionManager.
Bug: 219549062
Test: atest CellBroadcastReceiverUnitTests
Change-Id: I0fe0a4453e711b5d60e3b68e0e126a1344b53799
Diffstat (limited to 'src/com/android/cellbroadcastreceiver')
-rw-r--r-- | src/com/android/cellbroadcastreceiver/CellBroadcastSettings.java | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastSettings.java b/src/com/android/cellbroadcastreceiver/CellBroadcastSettings.java index f4fe98d17..026390cb3 100644 --- a/src/com/android/cellbroadcastreceiver/CellBroadcastSettings.java +++ b/src/com/android/cellbroadcastreceiver/CellBroadcastSettings.java @@ -159,9 +159,6 @@ public class CellBroadcastSettings extends CollapsingToolbarBaseActivity { /* End of user preferences keys section. */ - // Resource cache - private static final Map<Integer, Resources> sResourcesCache = new HashMap<>(); - // Resource cache per operator private static final Map<String, Resources> sResourcesCacheByOperator = new HashMap<>(); private static final Object sCacheLock = new Object(); @@ -885,21 +882,7 @@ public class CellBroadcastSettings extends CollapsingToolbarBaseActivity { return context.getResources(); } - synchronized (sCacheLock) { - if (sResourcesCache.containsKey(subId)) { - return sResourcesCache.get(subId); - } - - Resources res = SubscriptionManager.getResourcesForSubId(context, subId); - - if (res.getConfiguration().mnc != 0) { - Log.d(TAG, "Cache resource for sub: " + subId + ", mcc: " - + res.getConfiguration().mcc + ", mnc:" + res.getConfiguration().mnc); - sResourcesCache.put(subId, res); - } - - return res; - } + return SubscriptionManager.getResourcesForSubId(context, subId); } /** @@ -1000,7 +983,6 @@ public class CellBroadcastSettings extends CollapsingToolbarBaseActivity { public static void resetResourcesCache() { synchronized (sCacheLock) { sResourcesCacheByOperator.clear(); - sResourcesCache.clear(); } } } |