Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6dcde63a authored by Christoffer Adamsen's avatar Christoffer Adamsen
Browse files

Explicitly keep default constructor in rules without members

R8 implicitly keeps the default constructor when no member rules are specified. Future versions of R8 will require apps to explicitly keep the default constructors that are required for the build to work.

This conservatively changes all keep rules that currently keep the default constructor to explicitly keep the default constructor.

Future work will attempt to tighten up the rules that do not require the default constructor to be kept.

Bug: 373579455
Flag: NONE no behavior change
Test: existing
Change-Id: I8e2734d8ee1b14cdf8ed6e3a1b6ebb8432500176
parent 46160a9f
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -8,4 +8,7 @@
-keep interface com.android.systemui.plugins.annotations.** {
    *;
}
-keep,allowshrinking,allowoptimization,allowobfuscation,allowaccessmodification @com.android.systemui.plugins.annotations.** class *
# TODO(b/373579455): Evaluate if <init> needs to be kept.
-keep,allowshrinking,allowoptimization,allowobfuscation,allowaccessmodification @com.android.systemui.plugins.annotations.** class * {
    void <init>();
}
+16 −4
Original line number Diff line number Diff line
@@ -6,8 +6,14 @@
# Note that we restrict this to SysUISingleton classes, as other registering
# classes should either *always* unregister or *never* register from their
# constructor. We also keep callback class names for easier debugging.
-keepnames @com.android.systemui.util.annotations.WeaklyReferencedCallback class *
-keepnames class * extends @com.android.systemui.util.annotations.WeaklyReferencedCallback **
# TODO(b/373579455): Evaluate if <init> needs to be kept.
-keepnames @com.android.systemui.util.annotations.WeaklyReferencedCallback class * {
  void <init>();
}
# TODO(b/373579455): Evaluate if <init> needs to be kept.
-keepnames class * extends @com.android.systemui.util.annotations.WeaklyReferencedCallback ** {
  void <init>();
}
-if @com.android.systemui.util.annotations.WeaklyReferencedCallback class *
-keepclassmembers,allowaccessmodification @com.android.systemui.dagger.SysUISingleton class * {
  <1> *;
@@ -17,10 +23,16 @@
  <1> *;
}

-keep class androidx.core.app.CoreComponentFactory
# TODO(b/373579455): Evaluate if <init> needs to be kept.
-keep class androidx.core.app.CoreComponentFactory {
  void <init>();
}

# Keep the wm shell lib
-keep class com.android.wm.shell.*
# TODO(b/373579455): Evaluate if <init> needs to be kept.
-keep class com.android.wm.shell.* {
  void <init>();
}
# Keep the protolog group methods that are called by the generated code
-keepclassmembers class com.android.wm.shell.protolog.ShellProtoLogGroup {
    *;
+4 −1
Original line number Diff line number Diff line
@@ -15,7 +15,10 @@

# APIs referenced by dependent JAR files and modules
# TODO(b/300514883): Pull @SystemApi keep rules from system-api.pro.
-keep interface android.annotation.SystemApi
# TODO(b/373579455): Evaluate if <init> needs to be kept.
-keep interface android.annotation.SystemApi {
  void <init>();
}
-keep @android.annotation.SystemApi class * {
  public protected *;
}