Skip to content
Commit 4514bdf1 authored by Jared Duke's avatar Jared Duke
Browse files

Allow flag-guarded Java optimizations for services

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
parent bd0a86f9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment