Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b11b1d24 authored by Jared Duke's avatar Jared Duke
Browse files

Enable R8 code shrinking for system_server by default

Flip the setting that controls R8 shrinking for system_server from
opt-in to opt-out. This can be controlled by vendor makefiles and from
the command-line using the `SYSTEM_OPTIMIZE_JAVA` boolean build flag.

Note that this change only enables code shrinking for system_server,
and should not impact stack traces except for certain stack frames
involving synthetics.

Additional (vendor) code that is loaded dynamically into
system_server, that references system_server code, should use
system_server APIs that are expicitly annotated with
`@android.annotation.SystemApi`.

Additional (vendor) code added directly to services.jar,
which doesn't fall into existing keep patterns in the services
proguard.flags configuration and would otherwise be stripped, should be
annotated with `@com.android.internal.annotations.Keep`.

Results: services.jar (20MB -> 17MB)

Bug: 210510433
Test: atest
  CtsInstalledLoadingProgressHostTests
  CtsAutoFillServiceTestCases
  CtsAppSecurityHostTestCases
  CtsAppTestCases
Change-Id: Icc77c9451d9a4a83e02cb591693354988f8d0ec4
parent 1b89a427
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ endif
# TODO(b/203088572): Remove when Java optimizations enabled by default for
# SystemUI.
$(call add_soong_config_var,ANDROID,SYSTEMUI_OPTIMIZE_JAVA)
# TODO(b/196084106): Remove when Java optimizations enabled by default for
# system packages.
# Enable by default unless explicitly set or overridden.
# See frameworks/base/services/Android.bp for additional notes on side effects.
SYSTEM_OPTIMIZE_JAVA ?= true
$(call add_soong_config_var,ANDROID,SYSTEM_OPTIMIZE_JAVA)