Further refine system_server Proguard rules
Ensure Activity+View instances are properly kept, and fix JNI interop
for PackageManager shell commands.
Note: Normally Activity/View references are implicitly kept through
manifest and resource entries bundled in the target. system_server is
somewhat unique in that its manifest/resource entries are stored
separately with the framework. Follow-up work will route such references
explicitly to the R8 invocation.
Bug: 221332315,221322925,221346618,221349887
Test: SYSTEM_OPTIMIZE_JAVA=true + atest
CtsInstalledLoadingProgressHostTests
CtsAutoFillServiceTestCases
CtsAppSecurityHostTestCases
CtsAppTestCases
Change-Id: I347d2264f5ee41931edbd37c62be0a46a834b4c2
diff --git a/services/proguard.flags b/services/proguard.flags
index 0e081f1..425da6c 100644
--- a/services/proguard.flags
+++ b/services/proguard.flags
@@ -40,9 +40,15 @@
# Global entities normally kept through explicit Manifest entries
# TODO(b/210510433): Revisit and consider generating from frameworks/base/core/res/AndroidManifest.xml,
# by including that manifest with the library rule that triggers optimization.
--keep,allowoptimization,allowaccessmodification class * extends android.app.backup.BackupAgent
--keep,allowoptimization,allowaccessmodification class * extends android.content.BroadcastReceiver
--keep,allowoptimization,allowaccessmodification class * extends android.content.ContentProvider
+-keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.app.Activity
+-keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.app.Service
+-keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.app.backup.BackupAgent
+-keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.content.BroadcastReceiver
+-keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.content.ContentProvider
+-keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.preference.Preference
+-keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.view.View {
+ public <init>(...);
+}
# Various classes subclassed in or referenced via JNI in ethernet-service
-keep public class android.net.** { *; }
@@ -67,6 +73,7 @@
-keep,allowoptimization,allowaccessmodification class com.android.server.location.gnss.GnssConfiguration$HalInterfaceVersion { *; }
-keep,allowoptimization,allowaccessmodification class com.android.server.location.gnss.GnssPowerStats { *; }
-keep,allowoptimization,allowaccessmodification class com.android.server.location.gnss.hal.GnssNative { *; }
+-keep,allowoptimization,allowaccessmodification class com.android.server.pm.PackageManagerShellCommandDataLoader { *; }
-keep,allowoptimization,allowaccessmodification class com.android.server.sensors.SensorManagerInternal$ProximityActiveListener { *; }
-keep,allowoptimization,allowaccessmodification class com.android.server.sensors.SensorService { *; }
-keep,allowoptimization,allowaccessmodification class com.android.server.soundtrigger_middleware.SoundTriggerMiddlewareImpl$AudioSessionProvider$AudioSession { *; }