From 00d7786f61be533bfa7f3d1dc65ddd1dc63ee193 Mon Sep 17 00:00:00 2001 From: Jared Duke Date: Mon, 20 Oct 2025 16:25:06 +0545 Subject: [PATCH] lineage: Enable R8 code shrinking and optimizations Squashed commit of the following: commit b11f60fd9b601caa10f8caec5c9f3a10c5082d68 Author: Jared Duke Date: Wed Feb 16 15:43:55 2022 -0800 Enable R8 code shrinking for system_server on Pixel Opt in to whole-program Java optimizations via R8 for Pixel devices. This can be explicitly disabled during builds via `SYSTEM_OPTIMIZE_JAVA=false m`. Note that this change only enables code shrinking for system_server, and should not impact stack traces. Additional R8 optimizations will be enabled after broader improvements to retracing infrastructure. See go/aperf-system-r8-faq for additional details and guidance. Also note that R8 shrinking optimizations are implicitly disabled in ENG builds. Enabling for non-Pixel devices will proceed in stages as we flesh out infrastructure and validate with test populations. Results: services.jar (20MB -> 17MB) Bug: 210510433 Test: m + atest FrameworksServicesTests + manual testing on Raven Change-Id: I13c0674105aa2cab7722f52344486e86e3bde26b commit ecc5901ee57253edb0fdde5d5099c4e1078f7b6f Author: Jared Duke Date: Tue Jan 4 15:21:39 2022 -0800 Enable SystemUI R8 optimizations for Pixel Opt in to whole-program Java optimizations via R8 for Pixel devices. This can be explicitly disabled during builds via `SYSTEMUI_OPTIMIZE_JAVA=false m`. Note that this change does introduce changes to stack traces that may require retracing for fully accurate debugging and diagonstics. See go/aperf-system-r8-faq for additional details and guidance. Also note that optimizations are implicitly disabled in ENG builds. Enabling for non-Pixel devices will proceed in stages as we flesh out infrastructure and validate with test populations. Results: * SystemUIGoogle.apk (40MB -> 35MB) * SystemUIGoogle.odex (32MB -> 25MB) Test: m + atest SystemUITests + presubmit + manual testing on Raven Bug: 203472868 Change-Id: I67ff2c06885b21164a3034e9922163337e8787f3 Change-Id: Ib89500d70780fdf8485aaf04976d4cc607b4ccf7 --- config/common.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/common.mk b/config/common.mk index 2fce0985..4a9091b0 100644 --- a/config/common.mk +++ b/config/common.mk @@ -114,6 +114,11 @@ PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD := false # leave less information available via JDWP. PRODUCT_MINIMIZE_JAVA_DEBUG_INFO := true +# Enable whole-program R8 Java optimizations for SystemUI and system_server, +# but also allow explicit overriding for testing and development. +SYSTEM_OPTIMIZE_JAVA ?= true +SYSTEMUI_OPTIMIZE_JAVA ?= true + # Disable vendor restrictions PRODUCT_RESTRICT_VENDOR_FILES := false