From 28f3934a2575a4be8f6ece1e113b99958a5ced20 Mon Sep 17 00:00:00 2001 From: Lee Shombert Date: Wed, 6 Jul 2022 07:58:25 -0700 Subject: [PATCH] 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 --- core/java/android/app/compat/ChangeIdStateCache.java | 2 +- core/java/android/content/pm/PackageManager.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/java/android/app/compat/ChangeIdStateCache.java b/core/java/android/app/compat/ChangeIdStateCache.java index acd404b7d4757..dea4e9c82f563 100644 --- a/core/java/android/app/compat/ChangeIdStateCache.java +++ b/core/java/android/app/compat/ChangeIdStateCache.java @@ -32,7 +32,7 @@ import com.android.internal.compat.IPlatformCompat; public final class ChangeIdStateCache extends PropertyInvalidatedCache { 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 53c23f3fffa76..38a376a6bcf25 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -10416,7 +10416,7 @@ public abstract class PackageManager { private static final PropertyInvalidatedCache sApplicationInfoCache = new PropertyInvalidatedCache( - 16, PermissionManager.CACHE_KEY_PACKAGE_INFO, + 32, PermissionManager.CACHE_KEY_PACKAGE_INFO, "getApplicationInfo") { @Override public ApplicationInfo recompute(ApplicationInfoQuery query) { @@ -10517,7 +10517,7 @@ public abstract class PackageManager { private static final PropertyInvalidatedCache sPackageInfoCache = new PropertyInvalidatedCache( - 32, PermissionManager.CACHE_KEY_PACKAGE_INFO, + 64, PermissionManager.CACHE_KEY_PACKAGE_INFO, "getPackageInfo") { @Override public PackageInfo recompute(PackageInfoQuery query) {