diff options
3 files changed, 0 insertions, 33 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java index 07e4f2203cf5..2f80b30aed8b 100644 --- a/core/java/android/app/ActivityThread.java +++ b/core/java/android/app/ActivityThread.java @@ -7066,9 +7066,6 @@ public final class ActivityThread extends ClientTransactionHandler && level >= ComponentCallbacks2.TRIM_MEMORY_BACKGROUND) { return; } - if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE) { - PropertyInvalidatedCache.onTrimMemory(); - } final ArrayList<ComponentCallbacks2> callbacks = collectComponentCallbacks(true /* includeUiContexts */); diff --git a/core/java/android/app/PropertyInvalidatedCache.java b/core/java/android/app/PropertyInvalidatedCache.java index 27f9f54d9522..22804a2039d1 100644 --- a/core/java/android/app/PropertyInvalidatedCache.java +++ b/core/java/android/app/PropertyInvalidatedCache.java @@ -1617,18 +1617,4 @@ public class PropertyInvalidatedCache<Query, Result> { Log.e(TAG, "Failed to dump PropertyInvalidatedCache instances"); } } - - /** - * Trim memory by clearing all the caches. - * @hide - */ - public static void onTrimMemory() { - ArrayList<PropertyInvalidatedCache> activeCaches; - synchronized (sGlobalLock) { - activeCaches = getActiveCaches(); - } - for (int i = 0; i < activeCaches.size(); i++) { - activeCaches.get(i).clear(); - } - } } diff --git a/core/tests/coretests/src/android/app/PropertyInvalidatedCacheTests.java b/core/tests/coretests/src/android/app/PropertyInvalidatedCacheTests.java index cd6abddc20a1..b5ee1302fc1d 100644 --- a/core/tests/coretests/src/android/app/PropertyInvalidatedCacheTests.java +++ b/core/tests/coretests/src/android/app/PropertyInvalidatedCacheTests.java @@ -375,20 +375,4 @@ public class PropertyInvalidatedCacheTests { PropertyInvalidatedCache.MODULE_BLUETOOTH, "getState"); assertEquals(n1, "cache_key.bluetooth.get_state"); } - - @Test - public void testOnTrimMemory() { - TestCache cache = new TestCache(MODULE, "trimMemoryTest"); - // The cache is not active until it has been invalidated once. - cache.invalidateCache(); - // Populate the cache with six entries. - for (int i = 0; i < 6; i++) { - cache.query(i); - } - // The maximum number of entries in TestCache is 4, so even though six entries were - // created, only four are retained. - assertEquals(4, cache.size()); - PropertyInvalidatedCache.onTrimMemory(); - assertEquals(0, cache.size()); - } } |