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

Commit f0a86984 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Remove EnforceRROExemptedTargets"

parents 272649ce cee5ba97
Loading
Loading
Loading
Loading
+1 −12
Original line number Diff line number Diff line
@@ -946,13 +946,7 @@ func (c *config) ArtUseReadBarrier() bool {
// More info: https://source.android.com/devices/architecture/rros
func (c *config) EnforceRROForModule(name string) bool {
	enforceList := c.productVariables.EnforceRROTargets
	// TODO(b/150820813) Some modules depend on static overlay, remove this after eliminating the dependency.
	exemptedList := c.productVariables.EnforceRROExemptedTargets
	if len(exemptedList) > 0 {
		if InList(name, exemptedList) {
			return false
		}
	}

	if len(enforceList) > 0 {
		if InList("*", enforceList) {
			return true
@@ -961,11 +955,6 @@ func (c *config) EnforceRROForModule(name string) bool {
	}
	return false
}

func (c *config) EnforceRROExemptedForModule(name string) bool {
	return InList(name, c.productVariables.EnforceRROExemptedTargets)
}

func (c *config) EnforceRROExcludedOverlay(path string) bool {
	excluded := c.productVariables.EnforceRROExcludedOverlays
	if len(excluded) > 0 {
+3 −5
Original line number Diff line number Diff line
@@ -202,8 +202,6 @@ type productVariables struct {
	DeviceResourceOverlays     []string `json:",omitempty"`
	ProductResourceOverlays    []string `json:",omitempty"`
	EnforceRROTargets          []string `json:",omitempty"`
	// TODO(b/150820813) Some modules depend on static overlay, remove this after eliminating the dependency.
	EnforceRROExemptedTargets  []string `json:",omitempty"`
	EnforceRROExcludedOverlays []string `json:",omitempty"`

	AAPTCharacteristics *string  `json:",omitempty"`
+8 −10
Original line number Diff line number Diff line
@@ -160,8 +160,8 @@ func (a *aapt) SetRROEnforcedForDependent(enforce bool) {
func (a *aapt) IsRROEnforced(ctx android.BaseModuleContext) bool {
	// True if RRO is enforced for this module or...
	return ctx.Config().EnforceRROForModule(ctx.ModuleName()) ||
		// if RRO is enforced for any of its dependents, and this module is not exempted.
		(a.aaptProperties.RROEnforcedForDependent && !ctx.Config().EnforceRROExemptedForModule(ctx.ModuleName()))
		// if RRO is enforced for any of its dependents.
		a.aaptProperties.RROEnforcedForDependent
}

func (a *aapt) aapt2Flags(ctx android.ModuleContext, sdkContext sdkContext,
@@ -443,7 +443,6 @@ func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext, classLoaderConte
					assets = append(assets, aarDep.ExportedAssets().Path())
				}

				if !ctx.Config().EnforceRROExemptedForModule(ctx.ModuleName()) {
			outer:
				for _, d := range aarDep.ExportedRRODirs() {
					for _, e := range staticRRODirs {
@@ -455,7 +454,6 @@ func aaptLibs(ctx android.ModuleContext, sdkContext sdkContext, classLoaderConte
				}
			}
		}
		}

		addCLCFromDep(ctx, module, classLoaderContexts)
	})
+9 −25
Original line number Diff line number Diff line
@@ -265,13 +265,11 @@ func TestEnforceRRO_propagatesToDependencies(t *testing.T) {
	testCases := []struct {
		name              string
		enforceRROTargets []string
		enforceRROExemptTargets []string
		rroDirs           map[string][]string
	}{
		{
			name:              "no RRO",
			enforceRROTargets: nil,
			enforceRROExemptTargets: nil,
			rroDirs: map[string][]string{
				"foo": nil,
				"bar": nil,
@@ -280,7 +278,6 @@ func TestEnforceRRO_propagatesToDependencies(t *testing.T) {
		{
			name:              "enforce RRO on all",
			enforceRROTargets: []string{"*"},
			enforceRROExemptTargets: nil,
			rroDirs: map[string][]string{
				"foo": {"product/vendor/blah/overlay/lib2/res"},
				"bar": {"product/vendor/blah/overlay/lib2/res"},
@@ -289,21 +286,11 @@ func TestEnforceRRO_propagatesToDependencies(t *testing.T) {
		{
			name:              "enforce RRO on foo",
			enforceRROTargets: []string{"foo"},
			enforceRROExemptTargets: nil,
			rroDirs: map[string][]string{
				"foo": {"product/vendor/blah/overlay/lib2/res"},
				"bar": {"product/vendor/blah/overlay/lib2/res"},
			},
		},
		{
			name:                    "enforce RRO on foo, bar exempted",
			enforceRROTargets:       []string{"foo"},
			enforceRROExemptTargets: []string{"bar"},
			rroDirs: map[string][]string{
				"foo": {"product/vendor/blah/overlay/lib2/res"},
				"bar": nil,
			},
		},
	}

	productResourceOverlays := []string{
@@ -351,9 +338,6 @@ func TestEnforceRRO_propagatesToDependencies(t *testing.T) {
			if testCase.enforceRROTargets != nil {
				config.TestProductVariables.EnforceRROTargets = testCase.enforceRROTargets
			}
			if testCase.enforceRROExemptTargets != nil {
				config.TestProductVariables.EnforceRROExemptedTargets = testCase.enforceRROExemptTargets
			}

			ctx := testContext(config)
			run(t, ctx, config)