Enable R8 full mode by default for apps

This provides significant size savings over the default compatibility
mode, roughly ~20MB in aggregate for a recent Pixel build. Targets can opt out using `proguard_compatibility = true`.

Future work will enable for all targets, not just apps, but this
incremental change yields the most benefit.

Bug: 215530220
Test: m + presubmit
Change-Id: I52a9b27ebe71835849e200e23ae2a250eaf1bbe1
This commit is contained in:
Jared Duke
2022-05-02 15:23:53 -07:00
parent fa076a74f8
commit 93d0bffafe
2 changed files with 3 additions and 2 deletions

View File

@@ -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

View File

@@ -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,