From 77c12e0fbd8d7f1eb0976a52f7d8f4849fb87d44 Mon Sep 17 00:00:00 2001 From: Lee Shombert Date: Wed, 30 Oct 2024 16:06:06 -0700 Subject: Exclude the PIC key package_info from shared memory The PIC key package_info is being sniffed as a sysprop outside of the cache infrastructure, so it cannot be moved into shared memory yet. This change excludes that one key from shared memory (when the feature flag is enabled). This is expected to be temporary until a mechanism is provided to clients to sniff nonce changes in controlled way. This change also corrects the bug numbers in the trunk stable flags related to this effort. Tested by booting an image with the flag enabled and verifying that the package_info cache key exists as a system property, but other system_server cache keys are not properties. Flag: android.app.pic_uses_shared_memory Bug: 360897450 Test: atest * FrameworksCoreTests:PropertyInvalidatedCacheTests * FrameworksCoreTests:IpcDataCacheTest * CtsOsTestCases:IpcDataCacheTest * CtsAppOpsTestCases * CtsMediaAudioTestCases * CtsVirtualDevicesAudioTestCases Change-Id: I0250beac5b8e1d85c1a2ff21de8408f07f074a45 --- core/java/android/app/PropertyInvalidatedCache.java | 12 +++++++++++- core/java/android/app/performance.aconfig | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/java/android/app/PropertyInvalidatedCache.java b/core/java/android/app/PropertyInvalidatedCache.java index 26bfec348a6f..a39cf84a4ebe 100644 --- a/core/java/android/app/PropertyInvalidatedCache.java +++ b/core/java/android/app/PropertyInvalidatedCache.java @@ -811,10 +811,20 @@ public class PropertyInvalidatedCache { return false; // Always disable shared memory on Ravenwood. (for now) } + /** + * Keys that cannot be put in shared memory yet. + */ + private static boolean inSharedMemoryDenyList(@NonNull String name) { + final String pkginfo = PREFIX_SYSTEM + "package_info"; + return name.equals(pkginfo); + }; + // Return true if this cache can use shared memory for its nonce. Shared memory may be used // if the module is the system. private static boolean sharedMemoryOkay(@NonNull String name) { - return sSharedMemoryAvailable && name.startsWith(PREFIX_SYSTEM); + return sSharedMemoryAvailable + && name.startsWith(PREFIX_SYSTEM) + && !inSharedMemoryDenyList(name); } /** diff --git a/core/java/android/app/performance.aconfig b/core/java/android/app/performance.aconfig index 7484a8558841..f51f748bc71f 100644 --- a/core/java/android/app/performance.aconfig +++ b/core/java/android/app/performance.aconfig @@ -7,7 +7,7 @@ flag { is_exported: true is_fixed_read_only: true description: "PropertyInvalidatedCache uses shared memory for nonces." - bug: "366552454" + bug: "360897450" } flag { @@ -16,5 +16,5 @@ flag { is_exported: true is_fixed_read_only: true description: "Enforce PropertyInvalidatedCache.setTestMode() protocol" - bug: "366552454" + bug: "360897450" } -- cgit v1.2.3-59-g8ed1b