Enable shrinking optimization of service-art
This change enables R8 code shrinking with R8 full mode of system server
jar service-art. The optimization settings
are set through inheriting
"framework-system-server-module-optimize-defaults", which is the common
optimization settings for all mainline module system server jar.
All classes extending SystemServer, and classes/methods/fileds annotated
with @SystemApi and @Keep will be considered as optimization entries.
entries unreachable code will be removed.
Ignore-AOSP-First: Submit this change internal first to merge the optimization settings.
Test: presubmit
Bug: 247779319
Change-Id: I10cdf5067ff600c23601ce01d1c821887959191a
diff --git a/libartservice/service/Android.bp b/libartservice/service/Android.bp
index f11d902..cd43853 100644
--- a/libartservice/service/Android.bp
+++ b/libartservice/service/Android.bp
@@ -66,7 +66,10 @@
// This target is named 'service-art' to conform to the naming conventions
// for JAR files in the System Server.
name: "service-art",
- defaults: ["framework-system-server-module-defaults"],
+ defaults: [
+ "framework-system-server-module-defaults",
+ "framework-system-server-module-optimize-defaults",
+ ],
permitted_packages: ["com.android.server.art"],
visibility: [
"//art:__subpackages__",
@@ -95,10 +98,6 @@
],
jarjar_rules: "jarjar-rules.txt",
optimize: {
- enabled: true,
- optimize: true,
- shrink: true,
- proguard_compatibility: false,
proguard_flags_files: ["proguard.flags"],
},
}
diff --git a/libartservice/service/proguard.flags b/libartservice/service/proguard.flags
index 3589496..8315cf2 100644
--- a/libartservice/service/proguard.flags
+++ b/libartservice/service/proguard.flags
@@ -1,8 +1,3 @@
-# Only keep APIs.
--keep @android.annotation.SystemApi class * {
- public *;
-}
-
# Proto field names are used by MessageLiteToString.toString through reflection.
-keepclassmembers class * extends
com.android.server.art.jarjar.com.google.protobuf.GeneratedMessageLite {