Dave Mankoff | 9941659 | 2022-11-10 22:57:43 +0000 | [diff] [blame] | 1 | # Preserve line number information for debugging stack traces. |
| 2 | -keepattributes SourceFile,LineNumberTable |
| 3 | |
| 4 | -keep class com.android.systemui.VendorServices |
| 5 | |
| 6 | # the `#inject` methods are accessed via reflection to work on ContentProviders |
| 7 | -keepclassmembers class * extends com.android.systemui.dagger.SysUIComponent { void inject(***); } |
| 8 | |
| 9 | # Needed for builds to properly initialize KeyFrames from xml scene |
| 10 | -keepclassmembers class * extends androidx.constraintlayout.motion.widget.Key { |
| 11 | public <init>(); |
| 12 | } |
| 13 | |
| 14 | # Needed to ensure callback field references are kept in their respective |
| 15 | # owning classes when the downstream callback registrars only store weak refs. |
| 16 | # TODO(b/264686688): Handle these cases with more targeted annotations. |
| 17 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 18 | private com.android.keyguard.KeyguardUpdateMonitorCallback *; |
| 19 | private com.android.systemui.privacy.PrivacyConfig$Callback *; |
| 20 | private com.android.systemui.privacy.PrivacyItemController$Callback *; |
| 21 | private com.android.systemui.settings.UserTracker$Callback *; |
| 22 | private com.android.systemui.statusbar.phone.StatusBarWindowCallback *; |
| 23 | private com.android.systemui.util.service.Observer$Callback *; |
| 24 | private com.android.systemui.util.service.ObservableServiceConnection$Callback *; |
| 25 | } |
| 26 | # Note that these rules are temporary companions to the above rules, required |
| 27 | # for cases like Kotlin where fields with anonymous types use the anonymous type |
| 28 | # rather than the supertype. |
| 29 | -if class * extends com.android.keyguard.KeyguardUpdateMonitorCallback |
| 30 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 31 | <1> *; |
| 32 | } |
| 33 | -if class * extends com.android.systemui.privacy.PrivacyConfig$Callback |
| 34 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 35 | <1> *; |
| 36 | } |
| 37 | -if class * extends com.android.systemui.privacy.PrivacyItemController$Callback |
| 38 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 39 | <1> *; |
| 40 | } |
| 41 | -if class * extends com.android.systemui.settings.UserTracker$Callback |
| 42 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 43 | <1> *; |
| 44 | } |
| 45 | -if class * extends com.android.systemui.statusbar.phone.StatusBarWindowCallback |
| 46 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 47 | <1> *; |
| 48 | } |
| 49 | -if class * extends com.android.systemui.util.service.Observer$Callback |
| 50 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 51 | <1> *; |
| 52 | } |
| 53 | -if class * extends com.android.systemui.util.service.ObservableServiceConnection$Callback |
| 54 | -keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** { |
| 55 | <1> *; |
| 56 | } |
| 57 | |
| 58 | -keepclasseswithmembers class * { |
| 59 | public <init>(android.content.Context, android.util.AttributeSet); |
| 60 | } |
| 61 | |
| 62 | -keep class ** extends androidx.preference.PreferenceFragment |
| 63 | -keep class com.android.systemui.tuner.* |
| 64 | |
Hawkwood Glazier | a3ebc6b | 2023-05-03 18:49:40 +0000 | [diff] [blame^] | 65 | # The plugins, log & common subpackages act as shared libraries that might be referenced in |
Dave Mankoff | 9941659 | 2022-11-10 22:57:43 +0000 | [diff] [blame] | 66 | # dynamically-loaded plugin APKs. |
| 67 | -keep class com.android.systemui.plugins.** { |
| 68 | *; |
| 69 | } |
Hawkwood Glazier | a3ebc6b | 2023-05-03 18:49:40 +0000 | [diff] [blame^] | 70 | -keep class com.android.systemui.log.** { |
| 71 | *; |
| 72 | } |
| 73 | -keep class com.android.systemui.common.** { |
| 74 | *; |
| 75 | } |
Dave Mankoff | 9941659 | 2022-11-10 22:57:43 +0000 | [diff] [blame] | 76 | -keep class com.android.systemui.fragments.FragmentService$FragmentCreator { |
| 77 | *; |
| 78 | } |
| 79 | -keep class androidx.core.app.CoreComponentFactory |
| 80 | |
| 81 | # Keep the wm shell lib |
| 82 | -keep class com.android.wm.shell.* |
| 83 | # Keep the protolog group methods that are called by the generated code |
| 84 | -keepclassmembers class com.android.wm.shell.protolog.ShellProtoLogGroup { |
| 85 | *; |
| 86 | } |
| 87 | |
| 88 | # Prevent optimization or access modification of any referenced code that may |
| 89 | # conflict with code in the bootclasspath. |
| 90 | # TODO(b/222468116): Resolve such collisions in the build system. |
| 91 | -keepnames class android.**.nano.** { *; } |
| 92 | -keepnames class com.android.**.nano.** { *; } |
| 93 | -keepnames class com.android.internal.protolog.** { *; } |
| 94 | -keepnames class android.hardware.common.** { *; } |
| 95 | |
| 96 | # Allows proguard to make private and protected methods and fields public as |
| 97 | # part of optimization. This lets proguard inline trivial getter/setter methods. |
| 98 | -allowaccessmodification |
| 99 | |
| 100 | # Removes runtime checks added through Kotlin to JVM code genereration to |
| 101 | # avoid linear growth as more Kotlin code is converted / added to the codebase. |
| 102 | # These checks are generally applied to Java platform types (values returned |
| 103 | # from Java code that don't have nullness annotations), but we remove them to |
| 104 | # avoid code size increases. |
| 105 | # |
| 106 | # See also https://kotlinlang.org/docs/reference/java-interop.html |
| 107 | # |
| 108 | # TODO(b/199941987): Consider standardizing these rules in a central place as |
| 109 | # Kotlin gains adoption with other platform targets. |
| 110 | -assumenosideeffects class kotlin.jvm.internal.Intrinsics { |
| 111 | # Remove check for method parameters being null |
| 112 | static void checkParameterIsNotNull(java.lang.Object, java.lang.String); |
| 113 | |
| 114 | # When a Java platform type is returned and passed to Kotlin NonNull method, |
| 115 | # remove the null check |
| 116 | static void checkExpressionValueIsNotNull(java.lang.Object, java.lang.String); |
| 117 | static void checkNotNullExpressionValue(java.lang.Object, java.lang.String); |
| 118 | |
| 119 | # Remove check that final value returned from method is null, if passing |
| 120 | # back Java platform type. |
| 121 | static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String, java.lang.String); |
| 122 | static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String); |
| 123 | |
| 124 | # Null check for accessing a field from a parent class written in Java. |
| 125 | static void checkFieldIsNotNull(java.lang.Object, java.lang.String, java.lang.String); |
| 126 | static void checkFieldIsNotNull(java.lang.Object, java.lang.String); |
| 127 | |
| 128 | # Removes code generated from !! operator which converts Nullable type to |
| 129 | # NonNull type. These would throw an NPE immediate after on access. |
| 130 | static void checkNotNull(java.lang.Object, java.lang.String); |
| 131 | static void checkNotNullParameter(java.lang.Object, java.lang.String); |
| 132 | |
| 133 | # Removes lateinit var check being used before being set. Check is applied |
| 134 | # on every field access without this. |
| 135 | static void throwUninitializedPropertyAccessException(java.lang.String); |
| 136 | } |
| 137 | |
| 138 | |
| 139 | # Strip verbose logs. |
| 140 | -assumenosideeffects class android.util.Log { |
| 141 | static *** v(...); |
| 142 | static *** isLoggable(...); |
| 143 | } |
| 144 | -assumenosideeffects class android.util.Slog { |
| 145 | static *** v(...); |
| 146 | } |
| 147 | -maximumremovedandroidloglevel 2 |