blob: a01e7dc16147020179371e03b208232d39eaa0a4 [file] [log] [blame]
Jared Duke0504e562022-02-02 15:25:22 -08001# TODO(b/210510433): Refine and optimize this configuration. Note that this
Jared Duke4514bdf2021-11-18 13:18:21 -08002# configuration is only used when `SOONG_CONFIG_ANDROID_SYSTEM_OPTIMIZE_JAVA=true`.
Jared Duke4514bdf2021-11-18 13:18:21 -08003
Jared Duke0504e562022-02-02 15:25:22 -08004# Preserve line number information for debugging stack traces.
5-keepattributes SourceFile,LineNumberTable
Jared Dukeedb13392021-12-14 11:10:20 -08006
7# Allows making private and protected methods/fields public as part of
8# optimization. This enables inlining of trivial getter/setter methods.
9-allowaccessmodification
10
Jared Duke0504e562022-02-02 15:25:22 -080011# Process entrypoint
12-keep class com.android.server.SystemServer {
13 public static void main(java.lang.String[]);
Jared Dukeedb13392021-12-14 11:10:20 -080014}
Jared Duke0504e562022-02-02 15:25:22 -080015
16# APIs referenced by dependent JAR files and modules
Jared Duked7769ef2023-11-03 02:02:49 +000017# TODO(b/300514883): Pull @SystemApi keep rules from system-api.pro.
18-keep interface android.annotation.SystemApi
Jared Duke0504e562022-02-02 15:25:22 -080019-keep @android.annotation.SystemApi class * {
20 public protected *;
21}
22-keepclasseswithmembers class * {
23 @android.annotation.SystemApi *;
24}
Jared Duked7769ef2023-11-03 02:02:49 +000025# Also ensure nested classes are kept. This is overly conservative, but handles
26# cases where such classes aren't explicitly marked @SystemApi.
27-if @android.annotation.SystemApi class *
28-keep public class <1>$** {
29 public protected *;
30}
Jared Duke0504e562022-02-02 15:25:22 -080031
32# Derivatives of SystemService and other services created via reflection
33-keep,allowoptimization,allowaccessmodification class * extends com.android.server.SystemService {
34 public <methods>;
35}
36-keep,allowoptimization,allowaccessmodification class * extends com.android.server.devicepolicy.BaseIDevicePolicyManager {
37 public <init>(...);
38}
39-keep,allowoptimization,allowaccessmodification class com.android.server.wallpaper.WallpaperManagerService {
40 public <init>(...);
41}
42
Alan Stokes8c9302c2022-05-06 18:35:12 +010043# Accessed from com.android.compos APEX
44-keep,allowoptimization,allowaccessmodification class com.android.internal.art.ArtStatsLog {
45 public static void write(...);
46}
47
Jared Duke0504e562022-02-02 15:25:22 -080048# Various classes subclassed in or referenced via JNI in ethernet-service
49-keep public class android.net.** { *; }
50-keep,allowoptimization,allowaccessmodification class com.android.net.module.util.* { *; }
51-keep,allowoptimization,allowaccessmodification public class com.android.server.net.IpConfigStore { *; }
52-keep,allowoptimization,allowaccessmodification public class com.android.server.net.BaseNetworkObserver { *; }
tyiud5dd07c2023-10-27 00:08:37 +000053-keep,allowoptimization,allowaccessmodification class com.android.server.display.feature.DisplayManagerFlags { *; }
54-keep,allowoptimization,allowaccessmodification class android.app.admin.flags.FeatureFlagsImpl { *; }
55-keep,allowoptimization,allowaccessmodification class com.android.server.input.NativeInputManagerService$NativeImpl { *; }
56-keep,allowoptimization,allowaccessmodification class com.android.server.ThreadPriorityBooster { *; }
Timothy Yiu1149dbb2024-03-19 02:56:06 +000057
58# Keep all aconfig Flag class as they might be statically referenced by other packages
59# An merge or inlining could lead to missing dependencies that cause run time errors
60-keepclassmembernames class android.**.Flags, com.android.**.Flags { public *; }
Jared Duke0504e562022-02-02 15:25:22 -080061
62# Referenced via CarServiceHelperService in car-frameworks-service (avoid removing)
63-keep public class com.android.server.utils.Slogf { *; }
64
Xin Guanee58f492022-08-02 02:56:54 +000065# Referenced in wear-service
66# HIDL interfaces
67-keep public class android.hidl.base.** { *; }
68-keep public class android.hidl.manager.** { *; }
69-keep public class com.android.server.wm.WindowManagerInternal { *; }
70
Jared Duke0504e562022-02-02 15:25:22 -080071# Notification extractors
72# TODO(b/210510433): Revisit and consider generating from frameworks/base/core/res/res/values/config.xml.
73-keep,allowoptimization,allowaccessmodification public class com.android.server.notification.** implements com.android.server.notification.NotificationSignalExtractor
74
Chris Li61339d82022-06-15 12:07:39 +080075# OEM provided DisplayAreaPolicy.Provider defined in frameworks/base/core/res/res/values/config.xml.
76-keep,allowoptimization,allowaccessmodification class com.android.server.wm.** implements com.android.server.wm.DisplayAreaPolicy$Provider
77
Jared Duke0504e562022-02-02 15:25:22 -080078# JNI keep rules
Jared Duke3027b4d2022-12-14 12:30:14 -080079# The global keep rule for native methods allows stripping of such methods if they're unreferenced
80# in Java. However, because system_server explicitly registers these methods from native code,
81# stripping them in Java can cause runtime issues. As such, conservatively keep all such methods in
82# system_server subpackages as long as the containing class is also kept or referenced.
83-keepclassmembers class com.android.server.** {
84 native <methods>;
85}
Jared Duke0504e562022-02-02 15:25:22 -080086# TODO(b/210510433): Revisit and fix with @Keep, or consider auto-generating from
87# frameworks/base/services/core/jni/onload.cpp.
88-keep,allowoptimization,allowaccessmodification class com.android.server.broadcastradio.hal1.BroadcastRadioService { *; }
89-keep,allowoptimization,allowaccessmodification class com.android.server.broadcastradio.hal1.Convert { *; }
90-keep,allowoptimization,allowaccessmodification class com.android.server.broadcastradio.hal1.Tuner { *; }
91-keep,allowoptimization,allowaccessmodification class com.android.server.broadcastradio.hal1.TunerCallback { *; }
92-keep,allowoptimization,allowaccessmodification class com.android.server.location.gnss.GnssConfiguration$HalInterfaceVersion { *; }
93-keep,allowoptimization,allowaccessmodification class com.android.server.location.gnss.GnssPowerStats { *; }
94-keep,allowoptimization,allowaccessmodification class com.android.server.location.gnss.hal.GnssNative { *; }
Jared Dukedc50c852022-02-25 13:50:58 -080095-keep,allowoptimization,allowaccessmodification class com.android.server.pm.PackageManagerShellCommandDataLoader { *; }
Vladimir Komsiyski9d5084d2023-02-10 09:54:19 +010096-keep,allowoptimization,allowaccessmodification class com.android.server.sensors.SensorManagerInternal$RuntimeSensorCallback { *; }
Jared Duke0504e562022-02-02 15:25:22 -080097-keep,allowoptimization,allowaccessmodification class com.android.server.sensors.SensorManagerInternal$ProximityActiveListener { *; }
98-keep,allowoptimization,allowaccessmodification class com.android.server.sensors.SensorService { *; }
99-keep,allowoptimization,allowaccessmodification class com.android.server.soundtrigger_middleware.SoundTriggerMiddlewareImpl$AudioSessionProvider$AudioSession { *; }
100-keep,allowoptimization,allowaccessmodification class com.android.server.soundtrigger_middleware.ExternalCaptureStateTracker { *; }
101-keep,allowoptimization,allowaccessmodification class com.android.server.storage.AppFuseBridge { *; }
102-keep,allowoptimization,allowaccessmodification class com.android.server.tv.TvInputHal { *; }
103-keep,allowoptimization,allowaccessmodification class com.android.server.usb.UsbAlsaJackDetector { *; }
Robert Wu8e7bf0f2023-01-26 01:44:07 +0000104-keep,allowoptimization,allowaccessmodification class com.android.server.usb.UsbAlsaMidiDevice { *; }
Jared Duke0504e562022-02-02 15:25:22 -0800105-keep,allowoptimization,allowaccessmodification class com.android.server.vibrator.VibratorController$OnVibrationCompleteListener { *; }
106-keep,allowoptimization,allowaccessmodification class com.android.server.vibrator.VibratorManagerService$OnSyncedVibrationCompleteListener { *; }
107-keepclasseswithmembers,allowoptimization,allowaccessmodification class com.android.server.** {
108 *** *FromNative(...);
109}
110-keep,allowoptimization,allowaccessmodification class com.android.server.input.InputManagerService {
111 <methods>;
112}
113-keep,allowoptimization,allowaccessmodification class com.android.server.usb.UsbHostManager {
114 *** usbDeviceRemoved(...);
115 *** usbDeviceAdded(...);
116}
117-keep,allowoptimization,allowaccessmodification class **.*NativeWrapper* { *; }
118
119# Miscellaneous reflection keep rules
120# TODO(b/210510433): Revisit and fix with @Keep.
121-keep,allowoptimization,allowaccessmodification class com.android.server.usage.AppStandbyController {
122 public <init>(...);
123}
124-keep,allowoptimization,allowaccessmodification class android.hardware.usb.gadget.** { *; }
125
126# Needed when optimizations enabled
127# TODO(b/210510433): Revisit and fix with @Keep.
128-keep,allowoptimization,allowaccessmodification class com.android.server.SystemService { *; }
129-keep,allowoptimization,allowaccessmodification class com.android.server.SystemService$TargetUser { *; }
130-keep,allowoptimization,allowaccessmodification class com.android.server.usage.StorageStatsManagerLocal { *; }
131-keep,allowoptimization,allowaccessmodification class com.android.internal.util.** { *; }
132-keep,allowoptimization,allowaccessmodification class android.os.** { *; }
Jared Duke06689ad2022-09-07 12:24:36 -0700133
134# CoverageService guards optional jacoco class references with a runtime guard, so we can safely
135# suppress build-time warnings.
136-dontwarn org.jacoco.agent.rt.*