From edb1339a3293c7cacaf824d9e13a9b08f96d355d Mon Sep 17 00:00:00 2001 From: Jared Duke Date: Tue, 14 Dec 2021 11:10:20 -0800 Subject: [PATCH] Refine (optional) system_server Proguard config Allow removal of synthetic members, as well as access modifications, improving both inlining performance and low-risk size reduction. Bug: 203088572,210510433 Test: SYSTEM_OPTIMIZE_JAVA=true m (validate services.jar/odex change) Change-Id: I17fd15623351b985d49034f4de13425b31a93758 --- services/proguard.flags | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/services/proguard.flags b/services/proguard.flags index 30dd6cf545b97..5d01d3e7f85c9 100644 --- a/services/proguard.flags +++ b/services/proguard.flags @@ -1,11 +1,21 @@ # TODO(b/196084106): Refine and optimize this configuration. Note that this # configuration is only used when `SOONG_CONFIG_ANDROID_SYSTEM_OPTIMIZE_JAVA=true`. -keep,allowoptimization,allowaccessmodification class ** { - *; + !synthetic *; } # Various classes subclassed in ethernet-service (avoid marking final). -keep public class android.net.** { *; } # Referenced via CarServiceHelperService in car-frameworks-service (avoid removing). --keep public class com.android.server.utils.Slogf { *; } \ No newline at end of file +-keep public class com.android.server.utils.Slogf { *; } + +# Allows making private and protected methods/fields public as part of +# optimization. This enables inlining of trivial getter/setter methods. +-allowaccessmodification + +# Disallow accessmodification for soundtrigger classes. Logging via reflective +# public member traversal can cause infinite loops. See b/210901706. +-keep,allowoptimization class com.android.server.soundtrigger_middleware.** { + !synthetic *; +}