Ensure SystemFeaturesMetadata is initialized in the boot image
While the overhead of recomputing the feature lookup cache is relatively
cheap, we should avoid it by computing it just once with the boot image.
Note that this manual addition should only be necessary as we ramp the
feature, after that we can likely remove it and rely on the usual boot
image profiling pipeline to ensure one-time init.
Bug: 400597432
Test: m + check boot-framework.art/oat
Flag: android.content.pm.cache_sdk_system_features
Change-Id: I1f4e881c94a3a4c1b7c1bedda0d3968ce47a71d2
diff --git a/boot/boot-image-profile-extra.txt b/boot/boot-image-profile-extra.txt
index ce99bfe..cc02c8ae3 100644
--- a/boot/boot-image-profile-extra.txt
+++ b/boot/boot-image-profile-extra.txt
@@ -70,3 +70,10 @@
HSPLandroid/os/PerfettoTrackEventExtra$FieldNested;->*
HSPLandroid/os/PerfettoTrackEventExtra$Pool;->*
HSPLandroid/os/PerfettoTrackEventExtra$RingBuffer;->*
+
+# While the SystemFeaturesMetadata static cache isn't heavyweight, ensure it's
+# pre-initialized in the boot image to avoid redundant per-process overhead.
+# TODO(b/326623529): Consider removing this after the feature has fully ramped
+# and is captured with the boot image profiling pipeline.
+HSPLcom/android/internal/pm/SystemFeaturesMetadata;->*
+Lcom/android/internal/pm/SystemFeaturesMetadata;
diff --git a/boot/preloaded-classes b/boot/preloaded-classes
index f87828e..7f4b324 100644
--- a/boot/preloaded-classes
+++ b/boot/preloaded-classes
@@ -11885,6 +11885,7 @@
com.android.internal.os.ZygoteServer
com.android.internal.os.logging.MetricsLoggerWrapper
com.android.internal.pm.RoSystemFeatures
+com.android.internal.pm.SystemFeaturesMetadata
com.android.internal.pm.parsing.PackageParser2$Callback
com.android.internal.pm.parsing.PackageParserException
com.android.internal.pm.pkg.component.flags.FeatureFlags