Jared Duke | 629526d | 2022-02-08 11:28:34 -0800 | [diff] [blame] | 1 | # Preserve line number information for debugging stack traces. |
| 2 | -keepattributes SourceFile,LineNumberTable |
| 3 | |
Jared Duke | 08468554 | 2022-06-03 11:14:24 -0700 | [diff] [blame] | 4 | # Preserve relationship information that can impact simple class naming. |
| 5 | -keepattributes EnclosingMethod,InnerClasses |
| 6 | |
Yohei Yukawa | 25c61e4 | 2022-02-14 22:30:49 +0000 | [diff] [blame] | 7 | -keep class com.android.systemui.recents.OverviewProxyRecentsImpl |
| 8 | -keep class com.android.systemui.statusbar.car.CarStatusBar |
Caitlin Cassidy | a3bcac5 | 2022-02-25 16:17:55 +0000 | [diff] [blame] | 9 | -keep class com.android.systemui.statusbar.phone.CentralSurfaces |
Yohei Yukawa | 25c61e4 | 2022-02-14 22:30:49 +0000 | [diff] [blame] | 10 | -keep class com.android.systemui.statusbar.tv.TvStatusBar |
Dave Mankoff | 3745983 | 2022-07-08 18:20:20 +0000 | [diff] [blame] | 11 | -keep class ** extends com.android.systemui.SystemUIInitializer { |
| 12 | *; |
| 13 | } |
Yohei Yukawa | 25c61e4 | 2022-02-14 22:30:49 +0000 | [diff] [blame] | 14 | -keep class * extends com.android.systemui.CoreStartable |
| 15 | -keep class * implements com.android.systemui.CoreStartable$Injector |
Winson | e6c9073 | 2015-09-24 16:06:29 -0700 | [diff] [blame] | 16 | |
Fabian Kozynski | 31ea98c0 | 2022-08-01 12:35:31 -0400 | [diff] [blame] | 17 | # Needed for builds to properly initialize KeyFrames from xml scene |
| 18 | -keepclassmembers class * extends androidx.constraintlayout.motion.widget.Key { |
| 19 | public <init>(); |
| 20 | } |
| 21 | |
Jared Duke | 1b05e74 | 2023-01-06 21:53:58 +0000 | [diff] [blame] | 22 | # Needed to ensure callback field references are kept in their respective |
| 23 | # owning classes when the downstream callback registrars only store weak refs. |
| 24 | # TODO(b/264686688): Handle these cases with more targeted annotations. |
| 25 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 26 | private com.android.keyguard.KeyguardUpdateMonitorCallback *; |
Jared Duke | 1935a2f | 2023-01-12 13:56:51 -0800 | [diff] [blame] | 27 | private com.android.systemui.privacy.PrivacyConfig$Callback *; |
Jared Duke | 1b05e74 | 2023-01-06 21:53:58 +0000 | [diff] [blame] | 28 | private com.android.systemui.privacy.PrivacyItemController$Callback *; |
| 29 | private com.android.systemui.settings.UserTracker$Callback *; |
| 30 | private com.android.systemui.statusbar.phone.StatusBarWindowCallback *; |
| 31 | private com.android.systemui.util.service.Observer$Callback *; |
| 32 | private com.android.systemui.util.service.ObservableServiceConnection$Callback *; |
| 33 | } |
Jared Duke | 1935a2f | 2023-01-12 13:56:51 -0800 | [diff] [blame] | 34 | # Note that these rules are temporary companions to the above rules, required |
| 35 | # for cases like Kotlin where fields with anonymous types use the anonymous type |
| 36 | # rather than the supertype. |
| 37 | -if class * extends com.android.keyguard.KeyguardUpdateMonitorCallback |
| 38 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 39 | <1> *; |
| 40 | } |
| 41 | -if class * extends com.android.systemui.privacy.PrivacyConfig$Callback |
| 42 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 43 | <1> *; |
| 44 | } |
| 45 | -if class * extends com.android.systemui.privacy.PrivacyItemController$Callback |
| 46 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 47 | <1> *; |
| 48 | } |
| 49 | -if class * extends com.android.systemui.settings.UserTracker$Callback |
| 50 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 51 | <1> *; |
| 52 | } |
| 53 | -if class * extends com.android.systemui.statusbar.phone.StatusBarWindowCallback |
| 54 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 55 | <1> *; |
| 56 | } |
| 57 | -if class * extends com.android.systemui.util.service.Observer$Callback |
| 58 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 59 | <1> *; |
| 60 | } |
| 61 | -if class * extends com.android.systemui.util.service.ObservableServiceConnection$Callback |
| 62 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 63 | <1> *; |
| 64 | } |
Jared Duke | 1b05e74 | 2023-01-06 21:53:58 +0000 | [diff] [blame] | 65 | |
Jason Monk | 87ccd55 | 2015-12-11 21:39:54 -0500 | [diff] [blame] | 66 | -keepclasseswithmembers class * { |
| 67 | public <init>(android.content.Context, android.util.AttributeSet); |
| 68 | } |
| 69 | |
Aurimas Liutikas | fd52c14 | 2018-04-17 09:50:46 -0700 | [diff] [blame] | 70 | -keep class ** extends androidx.preference.PreferenceFragment |
Yohei Yukawa | 25c61e4 | 2022-02-14 22:30:49 +0000 | [diff] [blame] | 71 | -keep class com.android.systemui.tuner.* |
Kevin Jeon | 4c39453 | 2022-11-15 19:00:12 +0000 | [diff] [blame] | 72 | |
Jared Duke | 548aa37 | 2022-11-30 13:38:17 -0800 | [diff] [blame] | 73 | # The plugins subpackage acts as a shared library that might be referenced in |
Kevin Jeon | 4c39453 | 2022-11-15 19:00:12 +0000 | [diff] [blame] | 74 | # dynamically-loaded plugin APKs. |
Jason Monk | 86bc331 | 2016-08-16 13:17:56 -0400 | [diff] [blame] | 75 | -keep class com.android.systemui.plugins.** { |
Jason Monk | e6089af | 2018-07-31 14:38:11 -0400 | [diff] [blame] | 76 | *; |
Jason Monk | 86bc331 | 2016-08-16 13:17:56 -0400 | [diff] [blame] | 77 | } |
Jason Monk | 9424af7 | 2018-12-19 14:17:26 -0500 | [diff] [blame] | 78 | -keep class com.android.systemui.fragments.FragmentService$FragmentCreator { |
| 79 | *; |
| 80 | } |
Aurimas Liutikas | fd52c14 | 2018-04-17 09:50:46 -0700 | [diff] [blame] | 81 | -keep class androidx.core.app.CoreComponentFactory |
Dave Mankoff | a5d8a39 | 2019-10-10 12:21:09 -0400 | [diff] [blame] | 82 | |
Yohei Yukawa | 25c61e4 | 2022-02-14 22:30:49 +0000 | [diff] [blame] | 83 | -keep public class * extends com.android.systemui.CoreStartable { |
| 84 | public <init>(android.content.Context); |
| 85 | } |
| 86 | |
Winson Chung | b754f52 | 2020-08-03 22:17:08 -0700 | [diff] [blame] | 87 | # Keep the wm shell lib |
Dave Mankoff | 8552807 | 2020-08-06 10:32:25 -0400 | [diff] [blame] | 88 | -keep class com.android.wm.shell.* |
Winson Chung | b754f52 | 2020-08-03 22:17:08 -0700 | [diff] [blame] | 89 | # Keep the protolog group methods that are called by the generated code |
| 90 | -keepclassmembers class com.android.wm.shell.protolog.ShellProtoLogGroup { |
| 91 | *; |
| 92 | } |
Dave Mankoff | 8552807 | 2020-08-06 10:32:25 -0400 | [diff] [blame] | 93 | |
Yohei Yukawa | 25c61e4 | 2022-02-14 22:30:49 +0000 | [diff] [blame] | 94 | -keep,allowoptimization,allowaccessmodification class com.android.systemui.dagger.GlobalRootComponent { !synthetic *; } |
| 95 | -keep,allowoptimization,allowaccessmodification class com.android.systemui.dagger.GlobalRootComponent$SysUIComponentImpl { !synthetic *; } |
| 96 | -keep,allowoptimization,allowaccessmodification class com.android.systemui.dagger.Dagger** { !synthetic *; } |
| 97 | -keep,allowoptimization,allowaccessmodification class com.android.systemui.tv.Dagger** { !synthetic *; } |
| 98 | |
Jared Duke | 83a28e6 | 2022-03-03 13:11:46 -0800 | [diff] [blame] | 99 | # Prevent optimization or access modification of any referenced code that may |
| 100 | # conflict with code in the bootclasspath. |
| 101 | # TODO(b/222468116): Resolve such collisions in the build system. |
| 102 | -keepnames class android.**.nano.** { *; } |
| 103 | -keepnames class com.android.**.nano.** { *; } |
| 104 | -keepnames class com.android.internal.protolog.** { *; } |
| 105 | -keepnames class android.hardware.common.** { *; } |
| 106 | |
Jared Duke | 2fee740 | 2021-10-18 14:35:04 -0700 | [diff] [blame] | 107 | # Allows proguard to make private and protected methods and fields public as |
| 108 | # part of optimization. This lets proguard inline trivial getter/setter methods. |
| 109 | -allowaccessmodification |
Jared Duke | dc1646f | 2021-11-30 12:35:45 -0800 | [diff] [blame] | 110 | |
| 111 | # Removes runtime checks added through Kotlin to JVM code genereration to |
| 112 | # avoid linear growth as more Kotlin code is converted / added to the codebase. |
| 113 | # These checks are generally applied to Java platform types (values returned |
| 114 | # from Java code that don't have nullness annotations), but we remove them to |
| 115 | # avoid code size increases. |
| 116 | # |
| 117 | # See also https://kotlinlang.org/docs/reference/java-interop.html |
| 118 | # |
| 119 | # TODO(b/199941987): Consider standardizing these rules in a central place as |
| 120 | # Kotlin gains adoption with other platform targets. |
| 121 | -assumenosideeffects class kotlin.jvm.internal.Intrinsics { |
| 122 | # Remove check for method parameters being null |
| 123 | static void checkParameterIsNotNull(java.lang.Object, java.lang.String); |
| 124 | |
| 125 | # When a Java platform type is returned and passed to Kotlin NonNull method, |
| 126 | # remove the null check |
| 127 | static void checkExpressionValueIsNotNull(java.lang.Object, java.lang.String); |
| 128 | static void checkNotNullExpressionValue(java.lang.Object, java.lang.String); |
| 129 | |
| 130 | # Remove check that final value returned from method is null, if passing |
| 131 | # back Java platform type. |
| 132 | static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String, java.lang.String); |
| 133 | static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String); |
| 134 | |
| 135 | # Null check for accessing a field from a parent class written in Java. |
| 136 | static void checkFieldIsNotNull(java.lang.Object, java.lang.String, java.lang.String); |
| 137 | static void checkFieldIsNotNull(java.lang.Object, java.lang.String); |
| 138 | |
| 139 | # Removes code generated from !! operator which converts Nullable type to |
| 140 | # NonNull type. These would throw an NPE immediate after on access. |
| 141 | static void checkNotNull(java.lang.Object, java.lang.String); |
| 142 | static void checkNotNullParameter(java.lang.Object, java.lang.String); |
| 143 | |
| 144 | # Removes lateinit var check being used before being set. Check is applied |
| 145 | # on every field access without this. |
| 146 | static void throwUninitializedPropertyAccessException(java.lang.String); |
| 147 | } |
Kevin Jeon | a4a104a | 2022-06-13 17:49:45 +0000 | [diff] [blame] | 148 | # Strip verbose logs. |
| 149 | -assumenosideeffects class android.util.Log { |
| 150 | static *** v(...); |
| 151 | static *** isLoggable(...); |
| 152 | } |
| 153 | -assumenosideeffects class android.util.Slog { |
| 154 | static *** v(...); |
| 155 | } |
| 156 | -maximumremovedandroidloglevel 2 |