Reduce resource cache size and use LruCache
android.util.LruCache provides least recent used algorithm and has an advantage of not calculating the size every time to find eldest value of LinkedMap. So changed from LinkedMap to LruCache. Size of key configuration, package name, and value Resource are about 300 bytes per one item on average, so even if the cache has 1000 items, it does not use that much heap memory. And the Configuration is logically hard to exceed 1000 types, so it can be considered large enough. Bug: 289045241 Test: atest CtsTelephonyTestCases Test: atest CellBroadcastServiceTests Test: atest GoogleCellBroadcastReceiverUnitTests Test: manually perform telephony tests and validty checks Change-Id: I606013e0a5a69355cdaa9453842ca63fd08d1126
Loading
Please register or sign in to comment