Remove special handling of prebuilt_framework-res

prebuilt_framework-res doesn't appear to exist anymore.

Bug: 185811447
Test: m nothing
Change-Id: Ib1aa929fbe007f87d03bdc85e4d54c6fae4e510b
This commit is contained in:
Cole Faust
2023-04-13 15:43:53 -07:00
parent 01add2893c
commit d580613a0e
2 changed files with 9 additions and 94 deletions

View File

@@ -17,9 +17,10 @@ package java
// This file contains the module implementations for android_app_import and android_test_import. // This file contains the module implementations for android_app_import and android_test_import.
import ( import (
"github.com/google/blueprint"
"reflect" "reflect"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools" "github.com/google/blueprint/proptools"
"android/soong/android" "android/soong/android"
@@ -177,10 +178,6 @@ func MergePropertiesFromVariant(ctx android.EarlyModuleContext,
} }
} }
func (a *AndroidAppImport) isPrebuiltFrameworkRes() bool {
return a.Name() == "prebuilt_framework-res"
}
func (a *AndroidAppImport) DepsMutator(ctx android.BottomUpMutatorContext) { func (a *AndroidAppImport) DepsMutator(ctx android.BottomUpMutatorContext) {
cert := android.SrcIsModule(String(a.properties.Certificate)) cert := android.SrcIsModule(String(a.properties.Certificate))
if cert != "" { if cert != "" {
@@ -197,7 +194,7 @@ func (a *AndroidAppImport) DepsMutator(ctx android.BottomUpMutatorContext) {
} }
} }
a.usesLibrary.deps(ctx, !a.isPrebuiltFrameworkRes()) a.usesLibrary.deps(ctx, true)
} }
func (a *AndroidAppImport) uncompressEmbeddedJniLibs( func (a *AndroidAppImport) uncompressEmbeddedJniLibs(
@@ -243,6 +240,10 @@ func (a *AndroidAppImport) InstallApkName() string {
} }
func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext) { 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) apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
if !apexInfo.IsForPlatform() { if !apexInfo.IsForPlatform() {
a.hideApexVariantFromMake = true a.hideApexVariantFromMake = true
@@ -278,14 +279,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
var pathFragments []string var pathFragments []string
relInstallPath := String(a.properties.Relative_install_path) relInstallPath := String(a.properties.Relative_install_path)
if a.isPrebuiltFrameworkRes() { if Bool(a.properties.Privileged) {
// 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) {
pathFragments = []string{"priv-app", relInstallPath, a.BaseModuleName()} pathFragments = []string{"priv-app", relInstallPath, a.BaseModuleName()}
} else if ctx.InstallInTestcases() { } else if ctx.InstallInTestcases() {
pathFragments = []string{relInstallPath, a.BaseModuleName(), ctx.DeviceConfig().DeviceArch()} pathFragments = []string{relInstallPath, a.BaseModuleName(), ctx.DeviceConfig().DeviceArch()}
@@ -323,13 +317,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
// Sign or align the package if package has not been preprocessed // Sign or align the package if package has not been preprocessed
if a.isPrebuiltFrameworkRes() { if a.preprocessed {
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 {
a.outputFile = srcApk a.outputFile = srcApk
a.certificate = PresignedCertificate a.certificate = PresignedCertificate
} else if !Bool(a.properties.Presigned) { } else if !Bool(a.properties.Presigned) {

View File

@@ -505,67 +505,6 @@ func TestAndroidAppImport_overridesDisabledAndroidApp(t *testing.T) {
} }
} }
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) { func TestAndroidAppImport_relativeInstallPath(t *testing.T) {
bp := ` bp := `
android_app_import { android_app_import {
@@ -581,13 +520,6 @@ func TestAndroidAppImport_relativeInstallPath(t *testing.T) {
relative_install_path: "my/path", relative_install_path: "my/path",
} }
android_app_import {
name: "framework-res",
apk: "prebuilts/apk/app.apk",
presigned: true,
prefer: true,
}
android_app_import { android_app_import {
name: "privileged_relative_install_path", name: "privileged_relative_install_path",
apk: "prebuilts/apk/app.apk", apk: "prebuilts/apk/app.apk",
@@ -611,11 +543,6 @@ func TestAndroidAppImport_relativeInstallPath(t *testing.T) {
expectedInstallPath: "out/soong/target/product/test_device/system/app/my/path/relative_install_path/relative_install_path.apk", expectedInstallPath: "out/soong/target/product/test_device/system/app/my/path/relative_install_path/relative_install_path.apk",
errorMessage: "Install path is not correct for app when relative_install_path is present", 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", 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", expectedInstallPath: "out/soong/target/product/test_device/system/priv-app/my/path/privileged_relative_install_path/privileged_relative_install_path.apk",