This CL yields a basic, if unoptimized, set of Proguard rules for
shrinking system_server. These fall largely into three categories:
* Code referenced via JNI
* Code referenced via explicit reflection (runtime .jar loading)
* Code referenced via implicit reflection (binder/services/etc...)
Follow-up work will tackle specific areas to make the rules more
maintainable and compact as we work to enable shrinking by default
for system_server.
Bug: 210510433
Test: SYSTEM_OPTIMIZE_JAVA=true m + manual testing
Change-Id: Iea3182c0536dbf7597e452f96cc33b4ab71dce96
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
Introduce a set of optional Java optimization and shrinking settings for
system server, based on the Soong variable added in aosp/1896612.
Opting in to optimizations can be achieved with either:
* Env:
export SYSTEM_OPTIMIZE_JAVA=true
* Make:
$(call add_soong_config_var_value,ANDROID,SYSTEM_OPTIMIZE_JAVA,true)
Note that the initial Proguard configuration is extremely conservative.
Follow-up work will refine the rules to both allow additional shrinking
while avoiding developer friction and overhead when adding services and
dynamically loaded jars.
As these optimiations can change the resulting stack traces, a parallel
effort is working to simplify retracing of stack traces for more
accurate debugging and diagnostics. Additional stabiliation and testing
will occur before any effort to enable these optimizations by default
for specific targets. Also note that there are no plans to enable
obfuscation for any of these targets.
Preliminary results:
* Conservative keep rules (this CL w/ opt-in flag):
* services.jar (19MB -> 15MB)
* services.odex (52MB -> 54MB) (mostly from increased inlining)
* Refined keep rules (follow-up CL):
* services.jar (19MB -> 12MB)
* services.odex (52MB -> 45MB)
Bug: 203088572
Test: SYSTEM_OPTIMIZE_JAVA=true m (validate services.jar/odex change)
Change-Id: I4130233310323611f63cd9bfcc0646080cf95875