diff options
| author | 2022-10-14 17:11:48 +0000 | |
|---|---|---|
| committer | 2022-10-14 17:11:48 +0000 | |
| commit | c91a3beb6ae79cc7742136b4b04cbe4973edc7b8 (patch) | |
| tree | d1bc9199eb967455fc3f1b541e9cdc58bb28b589 | |
| parent | 423848fe8a358dcf77ba218cf79c1d5c53d33dcd (diff) | |
Revert "Fix concurrency issue in PropertyInvalidatedCache"
This reverts commit 423848fe8a358dcf77ba218cf79c1d5c53d33dcd.
Reason for revert: http://b/253636168 Broken test: FrameworksCoreTests(module-abi=x86_64) on git_master on cf_x86_64_phone-userdebug at 9173922
Change-Id: Ica6736b5192b1a70d4a4d9509736ea0268fb2286
| -rw-r--r-- | core/java/android/app/PropertyInvalidatedCache.java | 19 | ||||
| -rw-r--r-- | core/java/android/app/TEST_MAPPING | 17 | ||||
| -rw-r--r-- | core/tests/coretests/src/android/app/PropertyInvalidatedCacheTests.java | 16 |
3 files changed, 2 insertions, 50 deletions
diff --git a/core/java/android/app/PropertyInvalidatedCache.java b/core/java/android/app/PropertyInvalidatedCache.java index 27f9f54d9522..a51b9d3956df 100644 --- a/core/java/android/app/PropertyInvalidatedCache.java +++ b/core/java/android/app/PropertyInvalidatedCache.java @@ -1406,17 +1406,6 @@ public class PropertyInvalidatedCache<Query, Result> { } /** - * Return the number of entries in the cache. This is used for testing and has package-only - * visibility. - * @hide - */ - public int size() { - synchronized (mLock) { - return mCache.size(); - } - } - - /** * Returns a list of caches alive at the current time. */ @GuardedBy("sGlobalLock") @@ -1623,12 +1612,8 @@ public class PropertyInvalidatedCache<Query, Result> { * @hide */ public static void onTrimMemory() { - ArrayList<PropertyInvalidatedCache> activeCaches; - synchronized (sGlobalLock) { - activeCaches = getActiveCaches(); - } - for (int i = 0; i < activeCaches.size(); i++) { - activeCaches.get(i).clear(); + for (PropertyInvalidatedCache pic : getActiveCaches()) { + pic.clear(); } } } diff --git a/core/java/android/app/TEST_MAPPING b/core/java/android/app/TEST_MAPPING index 0af96c227d6a..5b0bd9614f83 100644 --- a/core/java/android/app/TEST_MAPPING +++ b/core/java/android/app/TEST_MAPPING @@ -175,23 +175,6 @@ "file_patterns": [ "(/|^)KeyguardManager.java" ] - }, - { - "name": "FrameworksCoreTests", - "options": [ - { - "exclude-annotation": "androidx.test.filters.FlakyTest" - }, - { - "exclude-annotation": "org.junit.Ignore" - }, - { - "include-filter": "android.app.PropertyInvalidatedCacheTest" - } - ], - "file_patterns": [ - "(/|^)PropertyInvalidatedCache.java" - ] } ], "presubmit-large": [ diff --git a/core/tests/coretests/src/android/app/PropertyInvalidatedCacheTests.java b/core/tests/coretests/src/android/app/PropertyInvalidatedCacheTests.java index 3768063f2a91..ed2b10117308 100644 --- a/core/tests/coretests/src/android/app/PropertyInvalidatedCacheTests.java +++ b/core/tests/coretests/src/android/app/PropertyInvalidatedCacheTests.java @@ -368,20 +368,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()); - } } |