From 0cece3898b0f26b0fb026415d4c8f928d16296a3 Mon Sep 17 00:00:00 2001 From: Lee Shombert Date: Tue, 4 Jan 2022 08:10:15 -0800 Subject: Prepare PropertyInvalidatedCache for SystemApi Bug: 152453213 Tag: #refactor This commit prepares PropertyInvalidatedCache to function as a system api. Specifically, the methods recompute() and bypass() which may be overridden by clients are now public (instead of protected). This forces an update to all existing clients, to accommodate the change in method visibility. Two small changes have been made as cleanup: 1. The awkwardly named debugCompareQueryResults() is now resultEquals(), which is more or less consistent with how other equality tests are named in Android. This name change affects two clients. 2. PackageManager has changed to use resultEquals() instead of maybeCheckConsistency(). This provides a simpler and more consistent use of the APIs. maybeCheckConsistency() has been made private. Test: atest PropertyInvalidatedCacheTests Change-Id: I4110f8e887a4fd8c784141e8892557a9d1b80a94 --- core/java/android/app/ApplicationPackageManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'core/java/android/app/ApplicationPackageManager.java') diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java index 44fb5db02f5d..49c75c49b2d7 100644 --- a/core/java/android/app/ApplicationPackageManager.java +++ b/core/java/android/app/ApplicationPackageManager.java @@ -802,7 +802,7 @@ public class ApplicationPackageManager extends PackageManager { new PropertyInvalidatedCache( 256, "cache_key.has_system_feature") { @Override - protected Boolean recompute(HasSystemFeatureQuery query) { + public Boolean recompute(HasSystemFeatureQuery query) { try { return ActivityThread.currentActivityThread().getPackageManager(). hasSystemFeature(query.name, query.version); @@ -1098,7 +1098,7 @@ public class ApplicationPackageManager extends PackageManager { new PropertyInvalidatedCache( 32, CACHE_KEY_PACKAGES_FOR_UID_PROPERTY) { @Override - protected GetPackagesForUidResult recompute(Integer uid) { + public GetPackagesForUidResult recompute(Integer uid) { try { return new GetPackagesForUidResult( ActivityThread.currentActivityThread(). -- cgit v1.2.3