summaryrefslogtreecommitdiff
path: root/packages/SystemUI/proguard.flags
blob: 10bb00cad1a026f785b5d97ced1e1ecac45ef994 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# Preserve line number information for debugging stack traces.
-keepattributes SourceFile,LineNumberTable

# Preserve relationship information that can impact simple class naming.
-keepattributes EnclosingMethod,InnerClasses

-keep class com.android.systemui.recents.OverviewProxyRecentsImpl
-keep class com.android.systemui.statusbar.car.CarStatusBar
-keep class com.android.systemui.statusbar.phone.CentralSurfaces
-keep class com.android.systemui.statusbar.tv.TvStatusBar
-keep class ** extends com.android.systemui.SystemUIInitializer {
    *;
}
-keep class * extends com.android.systemui.CoreStartable
-keep class * implements com.android.systemui.CoreStartable$Injector

# Needed for builds to properly initialize KeyFrames from xml scene
-keepclassmembers class * extends androidx.constraintlayout.motion.widget.Key {
  public <init>();
}

# Needed to ensure callback field references are kept in their respective
# owning classes when the downstream callback registrars only store weak refs.
# TODO(b/264686688): Handle these cases with more targeted annotations.
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
  private com.android.keyguard.KeyguardUpdateMonitorCallback *;
  private com.android.systemui.privacy.PrivacyConfig$Callback *;
  private com.android.systemui.privacy.PrivacyItemController$Callback *;
  private com.android.systemui.settings.UserTracker$Callback *;
  private com.android.systemui.statusbar.phone.StatusBarWindowCallback *;
  private com.android.systemui.util.service.Observer$Callback *;
  private com.android.systemui.util.service.ObservableServiceConnection$Callback *;
}
# Note that these rules are temporary companions to the above rules, required
# for cases like Kotlin where fields with anonymous types use the anonymous type
# rather than the supertype.
-if class * extends com.android.keyguard.KeyguardUpdateMonitorCallback
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
  <1> *;
}
-if class * extends com.android.systemui.privacy.PrivacyConfig$Callback
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
  <1> *;
}
-if class * extends com.android.systemui.privacy.PrivacyItemController$Callback
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
  <1> *;
}
-if class * extends com.android.systemui.settings.UserTracker$Callback
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
  <1> *;
}
-if class * extends com.android.systemui.statusbar.phone.StatusBarWindowCallback
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
  <1> *;
}
-if class * extends com.android.systemui.util.service.Observer$Callback
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
  <1> *;
}
-if class * extends com.android.systemui.util.service.ObservableServiceConnection$Callback
-keepclassmembers,allowaccessmodification class com.android.systemui.**, com.android.keyguard.** {
  <1> *;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keep class ** extends androidx.preference.PreferenceFragment
-keep class com.android.systemui.tuner.*

# The plugins subpackage acts as a shared library that might be referenced in
# dynamically-loaded plugin APKs.
-keep class com.android.systemui.plugins.** {
    *;
}
-keep class com.android.systemui.fragments.FragmentService$FragmentCreator {
    *;
}
-keep class androidx.core.app.CoreComponentFactory

-keep public class * extends com.android.systemui.CoreStartable {
    public <init>(android.content.Context);
}

# Keep the wm shell lib
-keep class com.android.wm.shell.*
# Keep the protolog group methods that are called by the generated code
-keepclassmembers class com.android.wm.shell.protolog.ShellProtoLogGroup {
    *;
}

-keep,allowoptimization,allowaccessmodification class com.android.systemui.dagger.GlobalRootComponent { !synthetic *; }
-keep,allowoptimization,allowaccessmodification class com.android.systemui.dagger.GlobalRootComponent$SysUIComponentImpl { !synthetic *; }
-keep,allowoptimization,allowaccessmodification class com.android.systemui.dagger.Dagger** { !synthetic *; }
-keep,allowoptimization,allowaccessmodification class com.android.systemui.tv.Dagger** { !synthetic *; }

# Prevent optimization or access modification of any referenced code that may
# conflict with code in the bootclasspath.
# TODO(b/222468116): Resolve such collisions in the build system.
-keepnames class android.**.nano.** { *; }
-keepnames class com.android.**.nano.** { *; }
-keepnames class com.android.internal.protolog.** { *; }
-keepnames class android.hardware.common.** { *; }

# Allows proguard to make private and protected methods and fields public as
# part of optimization. This lets proguard inline trivial getter/setter methods.
-allowaccessmodification

# Removes runtime checks added through Kotlin to JVM code genereration to
# avoid linear growth as more Kotlin code is converted / added to the codebase.
# These checks are generally applied to Java platform types (values returned
# from Java code that don't have nullness annotations), but we remove them to
# avoid code size increases.
#
# See also https://kotlinlang.org/docs/reference/java-interop.html
#
# TODO(b/199941987): Consider standardizing these rules in a central place as
# Kotlin gains adoption with other platform targets.
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
    # Remove check for method parameters being null
    static void checkParameterIsNotNull(java.lang.Object, java.lang.String);

    # When a Java platform type is returned and passed to Kotlin NonNull method,
    # remove the null check
    static void checkExpressionValueIsNotNull(java.lang.Object, java.lang.String);
    static void checkNotNullExpressionValue(java.lang.Object, java.lang.String);

    # Remove check that final value returned from method is null, if passing
    # back Java platform type.
    static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String, java.lang.String);
    static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String);

    # Null check for accessing a field from a parent class written in Java.
    static void checkFieldIsNotNull(java.lang.Object, java.lang.String, java.lang.String);
    static void checkFieldIsNotNull(java.lang.Object, java.lang.String);

    # Removes code generated from !! operator which converts Nullable type to
    # NonNull type. These would throw an NPE immediate after on access.
    static void checkNotNull(java.lang.Object, java.lang.String);
    static void checkNotNullParameter(java.lang.Object, java.lang.String);

    # Removes lateinit var check being used before being set. Check is applied
    # on every field access without this.
    static void throwUninitializedPropertyAccessException(java.lang.String);
}
# Strip verbose logs.
-assumenosideeffects class android.util.Log {
  static *** v(...);
  static *** isLoggable(...);
}
-assumenosideeffects class android.util.Slog {
  static *** v(...);
}
-maximumremovedandroidloglevel 2