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

Commit a7b38592 authored by Rico Wind's avatar Rico Wind
Browse files

Launch flag guarded always on optimized resource shrinking

This will use the RELEASE_USE_OPTIMIZED_RESOURCE_SHRINKING_BY_DEFAULT flag - default enabling in trunk staging will be done in a follow up cl

To disable optimized resource shrinking on an app basis one can opt out with
  optimized_shrink_resources: false
bug please file a bug for us to find out why (so that we can remove legacy mode)

Bug: 325905703
Test: Existing
Change-Id: Idb57b8e6bba26f06c044657492ff4ae89ec81254
parent 8996dbc9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1965,6 +1965,10 @@ func (c *config) GetBuildFlag(name string) (string, bool) {
	return val, ok
}

func (c *config) UseOptimizedResourceShrinkingByDefault() bool {
	return c.productVariables.GetBuildFlagBool("RELEASE_USE_OPTIMIZED_RESOURCE_SHRINKING_BY_DEFAULT")
}

func (c *config) UseResourceProcessorByDefault() bool {
	return c.productVariables.GetBuildFlagBool("RELEASE_USE_RESOURCE_PROCESSOR_BY_DEFAULT")
}
+2 −2
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ func (d *DexProperties) resourceShrinkingEnabled(ctx android.ModuleContext) bool
}

func (d *DexProperties) optimizedResourceShrinkingEnabled(ctx android.ModuleContext) bool {
	return d.resourceShrinkingEnabled(ctx) && Bool(d.Optimize.Optimized_shrink_resources)
	return d.resourceShrinkingEnabled(ctx) && BoolDefault(d.Optimize.Optimized_shrink_resources, ctx.Config().UseOptimizedResourceShrinkingByDefault())
}

func (d *dexer) optimizeOrObfuscateEnabled() bool {
@@ -390,7 +390,7 @@ func (d *dexer) r8Flags(ctx android.ModuleContext, dexParams *compileDexParams)
		r8Flags = append(r8Flags, "--resource-input", d.resourcesInput.Path().String())
		r8Deps = append(r8Deps, d.resourcesInput.Path())
		r8Flags = append(r8Flags, "--resource-output", d.resourcesOutput.Path().String())
		if Bool(opt.Optimized_shrink_resources) {
		if d.dexProperties.optimizedResourceShrinkingEnabled(ctx) {
			r8Flags = append(r8Flags, "--optimized-resource-shrinking")
		}
	}