From aa88b3d020a24cebbc9a300342403e8316da1271 Mon Sep 17 00:00:00 2001 From: Jared Duke Date: Tue, 29 Aug 2023 17:07:20 +0000 Subject: [PATCH] Reland "Enable R8 full mode by default for apps" This is attempt 4 at landing this change. Prior attempts were reverted due to downstream test breakages not in presubmit. Those issues have been resolved, and additional manual heavy presubmit tests were run to ensure stability. Observed APK savings: ~24MB This reverts commit 74a5c2ec76139917e4123ccab65df6f5ff5a7c0e. Reason for revert: Fixed ManagedProvisioningTests Bug: 215530220 Change-Id: I223228a345fa1a3bad52fb3e91c744107e04fc07 --- java/app.go | 1 + java/dex.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/java/app.go b/java/app.go index 25909ec9d..a7f894a45 100755 --- a/java/app.go +++ b/java/app.go @@ -1030,6 +1030,7 @@ func AndroidAppFactory() android.Module { module.Module.dexProperties.Optimize.EnabledByDefault = true module.Module.dexProperties.Optimize.Shrink = proptools.BoolPtr(true) + module.Module.dexProperties.Optimize.Proguard_compatibility = proptools.BoolPtr(false) module.Module.properties.Instrument = true module.Module.properties.Supports_static_instrumentation = true diff --git a/java/dex.go b/java/dex.go index 7e7da00fd..7dd14bded 100644 --- a/java/dex.go +++ b/java/dex.go @@ -45,8 +45,8 @@ type DexProperties struct { // Whether to continue building even if warnings are emitted. Defaults to true. Ignore_warnings *bool - // If true, runs R8 in Proguard compatibility mode (default). - // Otherwise, runs R8 in full mode. + // If true, runs R8 in Proguard compatibility mode, otherwise runs R8 in full mode. + // Defaults to false for apps, true for libraries and tests. Proguard_compatibility *bool // If true, optimize for size by removing unused code. Defaults to true for apps,