Merge "Revert "Use aapt2 flag --rename-resources-package in soong"" am: 4cb7fc05ae
Change-Id: I27af983e99b57da368da0a53f5d8e9469c938828
This commit is contained in:
commit
b64ac9a99f
2 changed files with 9 additions and 19 deletions
12
java/app.go
12
java/app.go
|
@ -491,16 +491,6 @@ func (a *AndroidApp) shouldEmbedJnis(ctx android.BaseModuleContext) bool {
|
|||
!a.IsForPlatform() || a.appProperties.AlwaysPackageNativeLibs
|
||||
}
|
||||
|
||||
func generateAaptRenamePackageFlags(packageName string) []string {
|
||||
aaptFlags := []string{}
|
||||
aaptFlags = append(aaptFlags, "--rename-manifest-package "+packageName)
|
||||
// --rename-resources-package renames the package within the resources table to packageName.
|
||||
// Note: this will *not* rename the R.java file because the base module .R
|
||||
// package may be directly referenced in code.
|
||||
aaptFlags = append(aaptFlags, "--rename-resources-package "+packageName)
|
||||
return aaptFlags
|
||||
}
|
||||
|
||||
func (a *AndroidApp) OverriddenManifestPackageName() string {
|
||||
return a.overriddenManifestPackageName
|
||||
}
|
||||
|
@ -537,7 +527,7 @@ func (a *AndroidApp) aaptBuildActions(ctx android.ModuleContext) {
|
|||
if !overridden {
|
||||
manifestPackageName = *a.overridableAppProperties.Package_name
|
||||
}
|
||||
aaptLinkFlags = append(aaptLinkFlags, generateAaptRenamePackageFlags(manifestPackageName)...)
|
||||
aaptLinkFlags = append(aaptLinkFlags, "--rename-manifest-package "+manifestPackageName)
|
||||
a.overriddenManifestPackageName = manifestPackageName
|
||||
}
|
||||
|
||||
|
|
|
@ -1688,7 +1688,7 @@ func TestOverrideAndroidApp(t *testing.T) {
|
|||
certFlag string
|
||||
lineageFlag string
|
||||
overrides []string
|
||||
packageFlag string
|
||||
aaptFlag string
|
||||
logging_parent string
|
||||
}{
|
||||
{
|
||||
|
@ -1698,7 +1698,7 @@ func TestOverrideAndroidApp(t *testing.T) {
|
|||
certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
|
||||
lineageFlag: "",
|
||||
overrides: []string{"qux"},
|
||||
packageFlag: "",
|
||||
aaptFlag: "",
|
||||
logging_parent: "",
|
||||
},
|
||||
{
|
||||
|
@ -1708,7 +1708,7 @@ func TestOverrideAndroidApp(t *testing.T) {
|
|||
certFlag: "cert/new_cert.x509.pem cert/new_cert.pk8",
|
||||
lineageFlag: "--lineage lineage.bin",
|
||||
overrides: []string{"qux", "foo"},
|
||||
packageFlag: "",
|
||||
aaptFlag: "",
|
||||
logging_parent: "bah",
|
||||
},
|
||||
{
|
||||
|
@ -1718,7 +1718,7 @@ func TestOverrideAndroidApp(t *testing.T) {
|
|||
certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
|
||||
lineageFlag: "",
|
||||
overrides: []string{"qux", "foo"},
|
||||
packageFlag: "org.dandroid.bp",
|
||||
aaptFlag: "--rename-manifest-package org.dandroid.bp",
|
||||
logging_parent: "",
|
||||
},
|
||||
}
|
||||
|
@ -1766,11 +1766,12 @@ func TestOverrideAndroidApp(t *testing.T) {
|
|||
expected.logging_parent, logging_parent)
|
||||
}
|
||||
|
||||
// Check the package renaming flags, if exists.
|
||||
// Check the package renaming flag, if exists.
|
||||
res := variant.Output("package-res.apk")
|
||||
aapt2Flags := res.Args["flags"]
|
||||
checkAapt2LinkFlag(t, aapt2Flags, "rename-manifest-package", expected.packageFlag)
|
||||
checkAapt2LinkFlag(t, aapt2Flags, "rename-resources-package", expected.packageFlag)
|
||||
if !strings.Contains(aapt2Flags, expected.aaptFlag) {
|
||||
t.Errorf("package renaming flag, %q is missing in aapt2 link flags, %q", expected.aaptFlag, aapt2Flags)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1907,7 +1908,6 @@ func TestOverrideAndroidTest(t *testing.T) {
|
|||
res := variant.Output("package-res.apk")
|
||||
aapt2Flags := res.Args["flags"]
|
||||
checkAapt2LinkFlag(t, aapt2Flags, "rename-manifest-package", expected.packageFlag)
|
||||
checkAapt2LinkFlag(t, aapt2Flags, "rename-resources-package", expected.packageFlag)
|
||||
checkAapt2LinkFlag(t, aapt2Flags, "rename-instrumentation-target-package", expected.targetPackageFlag)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue