Jared Duke | 0504e56 | 2022-02-02 15:25:22 -0800 | [diff] [blame] | 1 | # TODO(b/210510433): Refine and optimize this configuration. Note that this |
Jared Duke | 4514bdf | 2021-11-18 13:18:21 -0800 | [diff] [blame] | 2 | # configuration is only used when `SOONG_CONFIG_ANDROID_SYSTEM_OPTIMIZE_JAVA=true`. |
Jared Duke | 4514bdf | 2021-11-18 13:18:21 -0800 | [diff] [blame] | 3 | |
Jared Duke | 0504e56 | 2022-02-02 15:25:22 -0800 | [diff] [blame] | 4 | # Preserve line number information for debugging stack traces. |
| 5 | -keepattributes SourceFile,LineNumberTable |
Jared Duke | edb1339 | 2021-12-14 11:10:20 -0800 | [diff] [blame] | 6 | |
| 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 Duke | 0504e56 | 2022-02-02 15:25:22 -0800 | [diff] [blame] | 11 | # Process entrypoint |
| 12 | -keep class com.android.server.SystemServer { |
| 13 | public static void main(java.lang.String[]); |
Jared Duke | edb1339 | 2021-12-14 11:10:20 -0800 | [diff] [blame] | 14 | } |
Jared Duke | 0504e56 | 2022-02-02 15:25:22 -0800 | [diff] [blame] | 15 | |
| 16 | # APIs referenced by dependent JAR files and modules |
| 17 | -keep @interface android.annotation.SystemApi |
| 18 | -keep @android.annotation.SystemApi class * { |
| 19 | public protected *; |
| 20 | } |
| 21 | -keepclasseswithmembers class * { |
| 22 | @android.annotation.SystemApi *; |
| 23 | } |
| 24 | |
| 25 | # Derivatives of SystemService and other services created via reflection |
| 26 | -keep,allowoptimization,allowaccessmodification class * extends com.android.server.SystemService { |
| 27 | public <methods>; |
| 28 | } |
| 29 | -keep,allowoptimization,allowaccessmodification class * extends com.android.server.devicepolicy.BaseIDevicePolicyManager { |
| 30 | public <init>(...); |
| 31 | } |
| 32 | -keep,allowoptimization,allowaccessmodification class com.android.server.wallpaper.WallpaperManagerService { |
| 33 | public <init>(...); |
| 34 | } |
| 35 | |
Alan Stokes | 8c9302c | 2022-05-06 18:35:12 +0100 | [diff] [blame] | 36 | # Accessed from com.android.compos APEX |
| 37 | -keep,allowoptimization,allowaccessmodification class com.android.internal.art.ArtStatsLog { |
| 38 | public static void write(...); |
| 39 | } |
| 40 | |
Jared Duke | 0504e56 | 2022-02-02 15:25:22 -0800 | [diff] [blame] | 41 | # Binder interfaces |
| 42 | -keep,allowoptimization,allowaccessmodification class * extends android.os.IInterface |
| 43 | -keep,allowoptimization,allowaccessmodification class * extends android.os.IHwInterface |
| 44 | |
| 45 | # Global entities normally kept through explicit Manifest entries |
| 46 | # TODO(b/210510433): Revisit and consider generating from frameworks/base/core/res/AndroidManifest.xml, |
| 47 | # by including that manifest with the library rule that triggers optimization. |
Jared Duke | dc50c85 | 2022-02-25 13:50:58 -0800 | [diff] [blame] | 48 | -keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.app.Activity |
| 49 | -keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.app.Service |
| 50 | -keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.app.backup.BackupAgent |
| 51 | -keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.content.BroadcastReceiver |
| 52 | -keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.content.ContentProvider |
| 53 | -keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.preference.Preference |
| 54 | -keep,allowoptimization,allowaccessmodification class com.android.server.** extends android.view.View { |
| 55 | public <init>(...); |
| 56 | } |
Jared Duke | 0504e56 | 2022-02-02 15:25:22 -0800 | [diff] [blame] | 57 | |
| 58 | # Various classes subclassed in or referenced via JNI in ethernet-service |
| 59 | -keep public class android.net.** { *; } |
| 60 | -keep,allowoptimization,allowaccessmodification class com.android.net.module.util.* { *; } |
| 61 | -keep,allowoptimization,allowaccessmodification public class com.android.server.net.IpConfigStore { *; } |
| 62 | -keep,allowoptimization,allowaccessmodification public class com.android.server.net.BaseNetworkObserver { *; } |
| 63 | |
| 64 | # Referenced via CarServiceHelperService in car-frameworks-service (avoid removing) |
| 65 | -keep public class com.android.server.utils.Slogf { *; } |
| 66 | |
| 67 | # Notification extractors |
| 68 | # TODO(b/210510433): Revisit and consider generating from frameworks/base/core/res/res/values/config.xml. |
| 69 | -keep,allowoptimization,allowaccessmodification public class com.android.server.notification.** implements com.android.server.notification.NotificationSignalExtractor |
| 70 | |
Chris Li | 61339d8 | 2022-06-15 12:07:39 +0800 | [diff] [blame] | 71 | # OEM provided DisplayAreaPolicy.Provider defined in frameworks/base/core/res/res/values/config.xml. |
| 72 | -keep,allowoptimization,allowaccessmodification class com.android.server.wm.** implements com.android.server.wm.DisplayAreaPolicy$Provider |
| 73 | |
Jared Duke | 0504e56 | 2022-02-02 15:25:22 -0800 | [diff] [blame] | 74 | # JNI keep rules |
| 75 | # TODO(b/210510433): Revisit and fix with @Keep, or consider auto-generating from |
| 76 | # frameworks/base/services/core/jni/onload.cpp. |
| 77 | -keep,allowoptimization,allowaccessmodification class com.android.server.broadcastradio.hal1.BroadcastRadioService { *; } |
| 78 | -keep,allowoptimization,allowaccessmodification class com.android.server.broadcastradio.hal1.Convert { *; } |
| 79 | -keep,allowoptimization,allowaccessmodification class com.android.server.broadcastradio.hal1.Tuner { *; } |
| 80 | -keep,allowoptimization,allowaccessmodification class com.android.server.broadcastradio.hal1.TunerCallback { *; } |
| 81 | -keep,allowoptimization,allowaccessmodification class com.android.server.location.gnss.GnssConfiguration$HalInterfaceVersion { *; } |
| 82 | -keep,allowoptimization,allowaccessmodification class com.android.server.location.gnss.GnssPowerStats { *; } |
| 83 | -keep,allowoptimization,allowaccessmodification class com.android.server.location.gnss.hal.GnssNative { *; } |
Jared Duke | dc50c85 | 2022-02-25 13:50:58 -0800 | [diff] [blame] | 84 | -keep,allowoptimization,allowaccessmodification class com.android.server.pm.PackageManagerShellCommandDataLoader { *; } |
Jared Duke | 0504e56 | 2022-02-02 15:25:22 -0800 | [diff] [blame] | 85 | -keep,allowoptimization,allowaccessmodification class com.android.server.sensors.SensorManagerInternal$ProximityActiveListener { *; } |
| 86 | -keep,allowoptimization,allowaccessmodification class com.android.server.sensors.SensorService { *; } |
| 87 | -keep,allowoptimization,allowaccessmodification class com.android.server.soundtrigger_middleware.SoundTriggerMiddlewareImpl$AudioSessionProvider$AudioSession { *; } |
| 88 | -keep,allowoptimization,allowaccessmodification class com.android.server.soundtrigger_middleware.ExternalCaptureStateTracker { *; } |
| 89 | -keep,allowoptimization,allowaccessmodification class com.android.server.storage.AppFuseBridge { *; } |
| 90 | -keep,allowoptimization,allowaccessmodification class com.android.server.tv.TvInputHal { *; } |
| 91 | -keep,allowoptimization,allowaccessmodification class com.android.server.usb.UsbAlsaJackDetector { *; } |
| 92 | -keep,allowoptimization,allowaccessmodification class com.android.server.usb.UsbMidiDevice { *; } |
| 93 | -keep,allowoptimization,allowaccessmodification class com.android.server.vibrator.VibratorController$OnVibrationCompleteListener { *; } |
| 94 | -keep,allowoptimization,allowaccessmodification class com.android.server.vibrator.VibratorManagerService$OnSyncedVibrationCompleteListener { *; } |
| 95 | -keepclasseswithmembers,allowoptimization,allowaccessmodification class com.android.server.** { |
| 96 | *** *FromNative(...); |
| 97 | } |
| 98 | -keep,allowoptimization,allowaccessmodification class com.android.server.input.InputManagerService { |
| 99 | <methods>; |
| 100 | } |
| 101 | -keep,allowoptimization,allowaccessmodification class com.android.server.usb.UsbHostManager { |
| 102 | *** usbDeviceRemoved(...); |
| 103 | *** usbDeviceAdded(...); |
| 104 | } |
| 105 | -keep,allowoptimization,allowaccessmodification class **.*NativeWrapper* { *; } |
| 106 | |
| 107 | # Miscellaneous reflection keep rules |
| 108 | # TODO(b/210510433): Revisit and fix with @Keep. |
| 109 | -keep,allowoptimization,allowaccessmodification class com.android.server.usage.AppStandbyController { |
| 110 | public <init>(...); |
| 111 | } |
| 112 | -keep,allowoptimization,allowaccessmodification class android.hardware.usb.gadget.** { *; } |
| 113 | |
| 114 | # Needed when optimizations enabled |
| 115 | # TODO(b/210510433): Revisit and fix with @Keep. |
| 116 | -keep,allowoptimization,allowaccessmodification class com.android.server.SystemService { *; } |
| 117 | -keep,allowoptimization,allowaccessmodification class com.android.server.SystemService$TargetUser { *; } |
| 118 | -keep,allowoptimization,allowaccessmodification class com.android.server.usage.StorageStatsManagerLocal { *; } |
| 119 | -keep,allowoptimization,allowaccessmodification class com.android.internal.util.** { *; } |
| 120 | -keep,allowoptimization,allowaccessmodification class android.os.** { *; } |
Michael Bestas | 81f5442 | 2022-08-25 05:10:15 +0300 | [diff] [blame] | 121 | |
| 122 | # SDK |
| 123 | -keep,allowoptimization,allowaccessmodification class lineageos.** { *; } |
| 124 | -keep,allowoptimization,allowaccessmodification class org.lineageos.** { *; } |
Michael Bestas | b1f18c6 | 2023-05-21 20:16:09 +0300 | [diff] [blame] | 125 | -keep,allowoptimization,allowaccessmodification class vendor.lineage.** { *; } |