Enable R8 shrinking of standalone system server jar service-connectivity
This change enables R8 shrinking, and R8 full mode of standalone system
server jar service-connectivity. Keep rules are specified based on the entries in
frameworks/base/services/java/com/android/server/SystemServer.java. Keep rules of classes extending SystemServer is inherited from "standalone-system-server-module-optimize-defaults", https://cs.android.com/android/platform/superproject/+/master:packages/modules/common/proguard/Android.bp, which is a set of common rules for standalone system server jar. Keep rules of proto is inherited from "proguard_basic_keeps", https://cs.android.com/android/platform/superproject/+/master:build/make/core/proguard_basic_keeps.flags, which is the common set of keep rules for all dex target.
The
size of service-connectivity will be reduced by 31% from 2094301B to 1426485B.
Test: Presubmit and MTS. Run MTS locally with command `mts-tradefed run` with `mts-tethering`, `mts-network`, `mts-cellbroadcast` on Pixel 4 with sunfish-userdebug image.
Bug: 233746531
Change-Id: I291c9d880a1ffc7dc87f932f9d27ce3740b9dc36
diff --git a/service/Android.bp b/service/Android.bp
index 7d3b39a..0a00362 100644
--- a/service/Android.bp
+++ b/service/Android.bp
@@ -223,6 +223,9 @@
name: "service-connectivity-defaults",
sdk_version: "system_server_current",
min_sdk_version: "30",
+ defaults: [
+ "standalone-system-server-module-optimize-defaults",
+ ],
// This library combines system server jars that have access to different bootclasspath jars.
// Lower SDK service jars must not depend on higher SDK jars as that would let them
// transitively depend on the wrong bootclasspath jars. Sources also cannot be added here as
@@ -252,8 +255,6 @@
"com.android.tethering",
],
optimize: {
- enabled: true,
- shrink: true,
proguard_flags_files: ["proguard.flags"],
},
lint: { strict_updatability_linting: true },