diff --git a/apex/apex.go b/apex/apex.go index d15b6c990..eafc186c4 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -2094,12 +2094,12 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { } filesInfo = append(filesInfo, af) - pf, _ := sdkLib.OutputFiles(".xml") - if len(pf) != 1 { + pf := sdkLib.XmlPermissionsFile() + if pf == nil { ctx.PropertyErrorf("java_libs", "%q failed to generate permission XML", depName) return false } - filesInfo = append(filesInfo, newApexFile(ctx, pf[0], pf[0].Base(), "etc/permissions", etc, nil)) + filesInfo = append(filesInfo, newApexFile(ctx, pf, pf.Base(), "etc/permissions", etc, nil)) return true // track transitive dependencies } else { ctx.PropertyErrorf("java_libs", "%q of type %q is not supported", depName, ctx.OtherModuleType(child)) diff --git a/apex/apex_test.go b/apex/apex_test.go index c5b89e6de..508bde600 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -3488,8 +3488,9 @@ func TestJavaSDKLibrary(t *testing.T) { "etc/permissions/foo.xml", }) // Permission XML should point to the activated path of impl jar of java_sdk_library - xml := ctx.ModuleForTests("foo", "android_common_myapex").Output("foo.xml") - ensureContains(t, xml.Args["content"], ` '$(out)'"), + Out: []string{module.xmlFileName()}, + } + + mctx.CreateModule(genrule.GenRuleFactory, &genRuleProps) + // creates a prebuilt_etc module to actually place the xml file under // /etc/permissions etcProps := struct { @@ -628,7 +653,7 @@ func (module *SdkLibrary) createXmlFile(mctx android.LoadHookContext) { System_ext_specific *bool }{} etcProps.Name = proptools.StringPtr(module.xmlFileName()) - etcProps.Src = proptools.StringPtr(":" + module.BaseModuleName() + "{.xml}") + etcProps.Src = proptools.StringPtr(":" + genRuleName) etcProps.Sub_dir = proptools.StringPtr("permissions") if module.SocSpecific() { etcProps.Soc_specific = proptools.BoolPtr(true)