Merge "Remove special handling of prebuilt_framework-res"
diff --git a/java/app_import.go b/java/app_import.go
index c1de667..85b35eb 100644
--- a/java/app_import.go
+++ b/java/app_import.go
@@ -17,9 +17,10 @@
// This file contains the module implementations for android_app_import and android_test_import.
import (
- "github.com/google/blueprint"
"reflect"
+ "github.com/google/blueprint"
+
"github.com/google/blueprint/proptools"
"android/soong/android"
@@ -177,10 +178,6 @@
}
}
-func (a *AndroidAppImport) isPrebuiltFrameworkRes() bool {
- return a.Name() == "prebuilt_framework-res"
-}
-
func (a *AndroidAppImport) DepsMutator(ctx android.BottomUpMutatorContext) {
cert := android.SrcIsModule(String(a.properties.Certificate))
if cert != "" {
@@ -197,7 +194,7 @@
}
}
- a.usesLibrary.deps(ctx, !a.isPrebuiltFrameworkRes())
+ a.usesLibrary.deps(ctx, true)
}
func (a *AndroidAppImport) uncompressEmbeddedJniLibs(
@@ -243,6 +240,10 @@
}
func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext) {
+ if a.Name() == "prebuilt_framework-res" {
+ ctx.ModuleErrorf("prebuilt_framework-res found. This used to have special handling in soong, but was removed due to prebuilt_framework-res no longer existing. This check is to ensure it doesn't come back without readding the special handling.")
+ }
+
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
if !apexInfo.IsForPlatform() {
a.hideApexVariantFromMake = true
@@ -278,14 +279,7 @@
var pathFragments []string
relInstallPath := String(a.properties.Relative_install_path)
- if a.isPrebuiltFrameworkRes() {
- // framework-res.apk is installed as system/framework/framework-res.apk
- if relInstallPath != "" {
- ctx.PropertyErrorf("relative_install_path", "Relative_install_path cannot be set for framework-res")
- }
- pathFragments = []string{"framework"}
- a.preprocessed = true
- } else if Bool(a.properties.Privileged) {
+ if Bool(a.properties.Privileged) {
pathFragments = []string{"priv-app", relInstallPath, a.BaseModuleName()}
} else if ctx.InstallInTestcases() {
pathFragments = []string{relInstallPath, a.BaseModuleName(), ctx.DeviceConfig().DeviceArch()}
@@ -323,13 +317,7 @@
// Sign or align the package if package has not been preprocessed
- if a.isPrebuiltFrameworkRes() {
- a.outputFile = srcApk
- a.certificate, certificates = processMainCert(a.ModuleBase, String(a.properties.Certificate), certificates, ctx)
- if len(certificates) != 1 {
- ctx.ModuleErrorf("Unexpected number of certificates were extracted: %q", certificates)
- }
- } else if a.preprocessed {
+ if a.preprocessed {
a.outputFile = srcApk
a.certificate = PresignedCertificate
} else if !Bool(a.properties.Presigned) {
diff --git a/java/app_import_test.go b/java/app_import_test.go
index 528fffe..8093024 100644
--- a/java/app_import_test.go
+++ b/java/app_import_test.go
@@ -505,67 +505,6 @@
}
}
-func TestAndroidAppImport_frameworkRes(t *testing.T) {
- ctx, _ := testJava(t, `
- android_app_import {
- name: "framework-res",
- certificate: "platform",
- apk: "package-res.apk",
- prefer: true,
- export_package_resources: true,
- // Disable dexpreopt and verify_uses_libraries check as the app
- // contains no Java code to be dexpreopted.
- enforce_uses_libs: false,
- dex_preopt: {
- enabled: false,
- },
- }
- `)
-
- mod := ctx.ModuleForTests("prebuilt_framework-res", "android_common").Module()
- a := mod.(*AndroidAppImport)
-
- if !a.preprocessed {
- t.Errorf("prebuilt framework-res is not preprocessed")
- }
-
- expectedInstallPath := "out/soong/target/product/test_device/system/framework/framework-res.apk"
-
- android.AssertPathRelativeToTopEquals(t, "prebuilt framework-res install location", expectedInstallPath, a.dexpreopter.installPath)
-
- entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
-
- expectedPath := "."
- // From apk property above, in the root of the source tree.
- expectedPrebuiltModuleFile := "package-res.apk"
- // Verify that the apk is preprocessed: The export package is the same
- // as the prebuilt.
- expectedSoongResourceExportPackage := expectedPrebuiltModuleFile
-
- actualPath := entries.EntryMap["LOCAL_PATH"]
- actualPrebuiltModuleFile := entries.EntryMap["LOCAL_PREBUILT_MODULE_FILE"]
- actualSoongResourceExportPackage := entries.EntryMap["LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE"]
-
- if len(actualPath) != 1 {
- t.Errorf("LOCAL_PATH incorrect len %d", len(actualPath))
- } else if actualPath[0] != expectedPath {
- t.Errorf("LOCAL_PATH mismatch, actual: %s, expected: %s", actualPath[0], expectedPath)
- }
-
- if len(actualPrebuiltModuleFile) != 1 {
- t.Errorf("LOCAL_PREBUILT_MODULE_FILE incorrect len %d", len(actualPrebuiltModuleFile))
- } else if actualPrebuiltModuleFile[0] != expectedPrebuiltModuleFile {
- t.Errorf("LOCAL_PREBUILT_MODULE_FILE mismatch, actual: %s, expected: %s", actualPrebuiltModuleFile[0], expectedPrebuiltModuleFile)
- }
-
- if len(actualSoongResourceExportPackage) != 1 {
- t.Errorf("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE incorrect len %d", len(actualSoongResourceExportPackage))
- } else if actualSoongResourceExportPackage[0] != expectedSoongResourceExportPackage {
- t.Errorf("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE mismatch, actual: %s, expected: %s", actualSoongResourceExportPackage[0], expectedSoongResourceExportPackage)
- }
- android.AssertStringEquals(t, "unexpected LOCAL_SOONG_MODULE_TYPE", "android_app_import", entries.EntryMap["LOCAL_SOONG_MODULE_TYPE"][0])
-}
-
func TestAndroidAppImport_relativeInstallPath(t *testing.T) {
bp := `
android_app_import {
@@ -582,13 +521,6 @@
}
android_app_import {
- name: "framework-res",
- apk: "prebuilts/apk/app.apk",
- presigned: true,
- prefer: true,
- }
-
- android_app_import {
name: "privileged_relative_install_path",
apk: "prebuilts/apk/app.apk",
presigned: true,
@@ -612,11 +544,6 @@
errorMessage: "Install path is not correct for app when relative_install_path is present",
},
{
- name: "prebuilt_framework-res",
- expectedInstallPath: "out/soong/target/product/test_device/system/framework/framework-res.apk",
- errorMessage: "Install path is not correct for framework-res",
- },
- {
name: "privileged_relative_install_path",
expectedInstallPath: "out/soong/target/product/test_device/system/priv-app/my/path/privileged_relative_install_path/privileged_relative_install_path.apk",
errorMessage: "Install path is not correct for privileged app when relative_install_path is present",