Increase the size of selected binder caches
Bug: 237309566
The maximum size of selected binder caches is increased to avoid
overflow. The overflow was found in a partner bug report.
The maximum size does not affect memory consumption until the cache
hits the limit, so caches that were not overflowing before will not
see increased memory consumption. Also, the caches that are affected
by this change are either static (one per process) or exist in just a
few intances per process, so the total memory impact is small.
Note that most of the overflows occurred in vendor processes.
Test: atest
* android.app.ApplicationPackageManagerTest
* com.android.server.pm.PackageManagerTests
* com.android.server.pm.PackageManagerServiceTest
* com.android.server.compat.PlatformCompatTest
* com.android.server.compat.CompatConfigTest
* android.app.compat.CompatChangesTest
* PlatformCompatGating
Change-Id: I7f60ad9008bf894d6cb967ce1a54ab33af650efc
diff --git a/core/java/android/app/compat/ChangeIdStateCache.java b/core/java/android/app/compat/ChangeIdStateCache.java
index acd404b..dea4e9c8 100644
--- a/core/java/android/app/compat/ChangeIdStateCache.java
+++ b/core/java/android/app/compat/ChangeIdStateCache.java
@@ -32,7 +32,7 @@
public final class ChangeIdStateCache
extends PropertyInvalidatedCache<ChangeIdStateQuery, Boolean> {
private static final String CACHE_KEY = "cache_key.is_compat_change_enabled";
- private static final int MAX_ENTRIES = 20;
+ private static final int MAX_ENTRIES = 64;
private static boolean sDisabled = false;
private volatile IPlatformCompat mPlatformCompat;
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index f224f8a..48c0aa0 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -10401,7 +10401,7 @@
private static final PropertyInvalidatedCache<ApplicationInfoQuery, ApplicationInfo>
sApplicationInfoCache =
new PropertyInvalidatedCache<ApplicationInfoQuery, ApplicationInfo>(
- 16, PermissionManager.CACHE_KEY_PACKAGE_INFO,
+ 32, PermissionManager.CACHE_KEY_PACKAGE_INFO,
"getApplicationInfo") {
@Override
public ApplicationInfo recompute(ApplicationInfoQuery query) {
@@ -10502,7 +10502,7 @@
private static final PropertyInvalidatedCache<PackageInfoQuery, PackageInfo>
sPackageInfoCache =
new PropertyInvalidatedCache<PackageInfoQuery, PackageInfo>(
- 32, PermissionManager.CACHE_KEY_PACKAGE_INFO,
+ 64, PermissionManager.CACHE_KEY_PACKAGE_INFO,
"getPackageInfo") {
@Override
public PackageInfo recompute(PackageInfoQuery query) {