Abstract prebuilt_etc into prebuilt_file am: b81f77ed24 am: c0fa5fb34e am: 30136e83d5
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2002752
Change-Id: Ic7909cc9aa5d32c1eb4f9fb4e28b86885ce442df
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/android/api_levels.go b/android/api_levels.go
index 8163894..2013730 100644
--- a/android/api_levels.go
+++ b/android/api_levels.go
@@ -307,24 +307,25 @@
func getFinalCodenamesMap(config Config) map[string]int {
return config.Once(finalCodenamesMapKey, func() interface{} {
apiLevelsMap := map[string]int{
- "G": 9,
- "I": 14,
- "J": 16,
- "J-MR1": 17,
- "J-MR2": 18,
- "K": 19,
- "L": 21,
- "L-MR1": 22,
- "M": 23,
- "N": 24,
- "N-MR1": 25,
- "O": 26,
- "O-MR1": 27,
- "P": 28,
- "Q": 29,
- "R": 30,
- "S": 31,
- "S-V2": 32,
+ "G": 9,
+ "I": 14,
+ "J": 16,
+ "J-MR1": 17,
+ "J-MR2": 18,
+ "K": 19,
+ "L": 21,
+ "L-MR1": 22,
+ "M": 23,
+ "N": 24,
+ "N-MR1": 25,
+ "O": 26,
+ "O-MR1": 27,
+ "P": 28,
+ "Q": 29,
+ "R": 30,
+ "S": 31,
+ "S-V2": 32,
+ "Tiramisu": 33,
}
// TODO: Differentiate "current" and "future".
@@ -351,24 +352,25 @@
func GetApiLevelsMap(config Config) map[string]int {
return config.Once(apiLevelsMapKey, func() interface{} {
apiLevelsMap := map[string]int{
- "G": 9,
- "I": 14,
- "J": 16,
- "J-MR1": 17,
- "J-MR2": 18,
- "K": 19,
- "L": 21,
- "L-MR1": 22,
- "M": 23,
- "N": 24,
- "N-MR1": 25,
- "O": 26,
- "O-MR1": 27,
- "P": 28,
- "Q": 29,
- "R": 30,
- "S": 31,
- "S-V2": 32,
+ "G": 9,
+ "I": 14,
+ "J": 16,
+ "J-MR1": 17,
+ "J-MR2": 18,
+ "K": 19,
+ "L": 21,
+ "L-MR1": 22,
+ "M": 23,
+ "N": 24,
+ "N-MR1": 25,
+ "O": 26,
+ "O-MR1": 27,
+ "P": 28,
+ "Q": 29,
+ "R": 30,
+ "S": 31,
+ "S-V2": 32,
+ "Tiramisu": 33,
}
for i, codename := range config.PlatformVersionActiveCodenames() {
apiLevelsMap[codename] = previewAPILevelBase + i
diff --git a/apex/apex.go b/apex/apex.go
index 62013cf..ef1eb84 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -2779,33 +2779,8 @@
// Module separator
//
m["com.android.bluetooth"] = []string{
- "android.hardware.audio.common@5.0",
- "android.hardware.bluetooth.a2dp@1.0",
- "android.hardware.bluetooth.audio@2.0",
- "android.hardware.bluetooth@1.0",
- "android.hardware.bluetooth@1.1",
- "android.hardware.graphics.bufferqueue@1.0",
- "android.hardware.graphics.bufferqueue@2.0",
- "android.hardware.graphics.common@1.0",
- "android.hardware.graphics.common@1.1",
- "android.hardware.graphics.common@1.2",
- "android.hardware.media@1.0",
- "android.hidl.safe_union@1.0",
- "android.hidl.token@1.0",
- "android.hidl.token@1.0-utils",
- "avrcp-target-service",
- "avrcp_headers",
"bluetooth-protos-lite",
- "bluetooth.mapsapi",
- "com.android.vcard",
- "dnsresolver_aidl_interface-V2-java",
- "ipmemorystore-aidl-interfaces-V5-java",
- "ipmemorystore-aidl-interfaces-java",
"internal_include_headers",
- "lib-bt-packets",
- "lib-bt-packets-avrcp",
- "lib-bt-packets-base",
- "libFraunhoferAAC",
"libaudio-a2dp-hw-utils",
"libaudio-hearing-aid-hw-utils",
"libbluetooth",
@@ -2829,28 +2804,6 @@
"libbte",
"libbtif",
"libchrome",
- "libevent",
- "libfmq",
- "libg722codec",
- "libgui_headers",
- "libmedia_headers",
- "libmodpb64",
- "libosi",
- "libstagefright_foundation_headers",
- "libstagefright_headers",
- "libstatslog",
- "libstatssocket",
- "libtinyxml2",
- "libudrv-uipc",
- "libz",
- "media_plugin_headers",
- "net-utils-services-common",
- "netd_aidl_interface-unstable-java",
- "netd_event_listener_interface-java",
- "netlink-client",
- "networkstack-client",
- "sap-api-java-static",
- "services.net",
}
//
// Module separator
@@ -2890,258 +2843,13 @@
// Module separator
//
m["com.android.media"] = []string{
- "android.frameworks.bufferhub@1.0",
- "android.hardware.cas.native@1.0",
- "android.hardware.cas@1.0",
- "android.hardware.configstore-utils",
- "android.hardware.configstore@1.0",
- "android.hardware.configstore@1.1",
- "android.hardware.graphics.allocator@2.0",
- "android.hardware.graphics.allocator@3.0",
- "android.hardware.graphics.bufferqueue@1.0",
- "android.hardware.graphics.bufferqueue@2.0",
- "android.hardware.graphics.common@1.0",
- "android.hardware.graphics.common@1.1",
- "android.hardware.graphics.common@1.2",
- "android.hardware.graphics.mapper@2.0",
- "android.hardware.graphics.mapper@2.1",
- "android.hardware.graphics.mapper@3.0",
- "android.hardware.media.omx@1.0",
- "android.hardware.media@1.0",
- "android.hidl.allocator@1.0",
- "android.hidl.memory.token@1.0",
- "android.hidl.memory@1.0",
- "android.hidl.token@1.0",
- "android.hidl.token@1.0-utils",
- "bionic_libc_platform_headers",
- "exoplayer2-extractor",
- "exoplayer2-extractor-annotation-stubs",
- "gl_headers",
- "jsr305",
- "libEGL",
- "libEGL_blobCache",
- "libEGL_getProcAddress",
- "libFLAC",
- "libFLAC-config",
- "libFLAC-headers",
- "libGLESv2",
- "libaacextractor",
- "libamrextractor",
- "libarect",
- "libaudio_system_headers",
- "libaudioclient",
- "libaudioclient_headers",
- "libaudiofoundation",
- "libaudiofoundation_headers",
- "libaudiomanager",
- "libaudiopolicy",
- "libaudioutils",
- "libaudioutils_fixedfft",
- "libbluetooth-types-header",
- "libbufferhub",
- "libbufferhub_headers",
- "libbufferhubqueue",
- "libc_malloc_debug_backtrace",
- "libcamera_client",
- "libcamera_metadata",
- "libdvr_headers",
- "libexpat",
- "libfifo",
- "libflacextractor",
- "libgrallocusage",
- "libgraphicsenv",
- "libgui",
- "libgui_headers",
- "libhardware_headers",
- "libinput",
- "liblzma",
- "libmath",
- "libmedia",
- "libmedia_codeclist",
- "libmedia_headers",
- "libmedia_helper",
- "libmedia_helper_headers",
- "libmedia_midiiowrapper",
- "libmedia_omx",
- "libmediautils",
- "libmidiextractor",
- "libmkvextractor",
- "libmp3extractor",
- "libmp4extractor",
- "libmpeg2extractor",
- "libnativebase_headers",
- "libnativewindow_headers",
- "libnblog",
- "liboggextractor",
- "libpackagelistparser",
- "libpdx",
- "libpdx_default_transport",
- "libpdx_headers",
- "libpdx_uds",
- "libprocinfo",
- "libspeexresampler",
- "libspeexresampler",
- "libstagefright_esds",
- "libstagefright_flacdec",
- "libstagefright_flacdec",
- "libstagefright_foundation",
- "libstagefright_foundation_headers",
- "libstagefright_foundation_without_imemory",
- "libstagefright_headers",
- "libstagefright_id3",
- "libstagefright_metadatautils",
- "libstagefright_mpeg2extractor",
- "libstagefright_mpeg2support",
- "libui",
- "libui_headers",
- "libunwindstack",
- "libvibrator",
- "libvorbisidec",
- "libwavextractor",
- "libwebm",
- "media_ndk_headers",
- "media_plugin_headers",
- "updatable-media",
+ // empty
}
//
// Module separator
//
m["com.android.media.swcodec"] = []string{
- "android.frameworks.bufferhub@1.0",
- "android.hardware.common-ndk_platform",
- "android.hardware.configstore-utils",
- "android.hardware.configstore@1.0",
- "android.hardware.configstore@1.1",
- "android.hardware.graphics.allocator@2.0",
- "android.hardware.graphics.allocator@3.0",
- "android.hardware.graphics.allocator@4.0",
- "android.hardware.graphics.bufferqueue@1.0",
- "android.hardware.graphics.bufferqueue@2.0",
- "android.hardware.graphics.common-ndk_platform",
- "android.hardware.graphics.common@1.0",
- "android.hardware.graphics.common@1.1",
- "android.hardware.graphics.common@1.2",
- "android.hardware.graphics.mapper@2.0",
- "android.hardware.graphics.mapper@2.1",
- "android.hardware.graphics.mapper@3.0",
- "android.hardware.graphics.mapper@4.0",
- "android.hardware.media.bufferpool@2.0",
- "android.hardware.media.c2@1.0",
- "android.hardware.media.c2@1.1",
- "android.hardware.media.omx@1.0",
- "android.hardware.media@1.0",
- "android.hardware.media@1.0",
- "android.hidl.memory.token@1.0",
- "android.hidl.memory@1.0",
- "android.hidl.safe_union@1.0",
- "android.hidl.token@1.0",
- "android.hidl.token@1.0-utils",
- "libEGL",
- "libFLAC",
- "libFLAC-config",
- "libFLAC-headers",
- "libFraunhoferAAC",
- "libLibGuiProperties",
- "libarect",
- "libaudio_system_headers",
- "libaudioutils",
- "libaudioutils",
- "libaudioutils_fixedfft",
- "libavcdec",
- "libavcenc",
- "libavservices_minijail",
- "libavservices_minijail",
- "libbinderthreadstateutils",
- "libbluetooth-types-header",
- "libbufferhub_headers",
- "libcodec2",
- "libcodec2_headers",
- "libcodec2_hidl@1.0",
- "libcodec2_hidl@1.1",
- "libcodec2_internal",
- "libcodec2_soft_aacdec",
- "libcodec2_soft_aacenc",
- "libcodec2_soft_amrnbdec",
- "libcodec2_soft_amrnbenc",
- "libcodec2_soft_amrwbdec",
- "libcodec2_soft_amrwbenc",
- "libcodec2_soft_av1dec_gav1",
- "libcodec2_soft_avcdec",
- "libcodec2_soft_avcenc",
- "libcodec2_soft_common",
- "libcodec2_soft_flacdec",
- "libcodec2_soft_flacenc",
- "libcodec2_soft_g711alawdec",
- "libcodec2_soft_g711mlawdec",
- "libcodec2_soft_gsmdec",
- "libcodec2_soft_h263dec",
- "libcodec2_soft_h263enc",
- "libcodec2_soft_hevcdec",
- "libcodec2_soft_hevcenc",
- "libcodec2_soft_mp3dec",
- "libcodec2_soft_mpeg2dec",
- "libcodec2_soft_mpeg4dec",
- "libcodec2_soft_mpeg4enc",
- "libcodec2_soft_opusdec",
- "libcodec2_soft_opusenc",
- "libcodec2_soft_rawdec",
- "libcodec2_soft_vorbisdec",
- "libcodec2_soft_vp8dec",
- "libcodec2_soft_vp8enc",
- "libcodec2_soft_vp9dec",
- "libcodec2_soft_vp9enc",
- "libcodec2_vndk",
- "libdvr_headers",
- "libfmq",
- "libfmq",
- "libgav1",
- "libgralloctypes",
- "libgrallocusage",
- "libgraphicsenv",
- "libgsm",
- "libgui_bufferqueue_static",
- "libgui_headers",
- "libhardware",
- "libhardware_headers",
- "libhevcdec",
- "libhevcenc",
- "libion",
- "libjpeg",
- "liblzma",
- "libmath",
- "libmedia_codecserviceregistrant",
- "libmedia_headers",
- "libmpeg2dec",
- "libnativebase_headers",
- "libnativewindow_headers",
- "libpdx_headers",
- "libscudo_wrapper",
- "libsfplugin_ccodec_utils",
- "libspeexresampler",
- "libstagefright_amrnb_common",
- "libstagefright_amrnbdec",
- "libstagefright_amrnbenc",
- "libstagefright_amrwbdec",
- "libstagefright_amrwbenc",
- "libstagefright_bufferpool@2.0.1",
- "libstagefright_enc_common",
- "libstagefright_flacdec",
- "libstagefright_foundation",
- "libstagefright_foundation_headers",
- "libstagefright_headers",
- "libstagefright_m4vh263dec",
- "libstagefright_m4vh263enc",
- "libstagefright_mp3dec",
- "libui",
- "libui_headers",
- "libunwindstack",
- "libvorbisidec",
- "libvpx",
- "libyuv",
- "libyuv_static",
- "media_ndk_headers",
- "media_plugin_headers",
- "mediaswcodec",
+ // empty
}
//
// Module separator
diff --git a/apex/testing.go b/apex/testing.go
index 337c862..69bd73e 100644
--- a/apex/testing.go
+++ b/apex/testing.go
@@ -24,7 +24,6 @@
android.MockFS{
// Needed by apex.
"system/core/rootdir/etc/public.libraries.android.txt": nil,
- "build/soong/scripts/gen_java_usedby_apex.sh": nil,
"build/soong/scripts/gen_ndk_backedby_apex.sh": nil,
// Needed by prebuilt_apex.
"build/soong/scripts/unpack-prebuilt-apex.sh": nil,
diff --git a/cc/builder.go b/cc/builder.go
index 525b1a1..ff4e9b4 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -728,10 +728,8 @@
sAbiDumpFile := android.ObjPathWithExt(ctx, subdir, srcFile, "sdump")
sAbiDumpFiles = append(sAbiDumpFiles, sAbiDumpFile)
+ // TODO(b/226497964): dumpRule = sAbiDumpRE if USE_RBE and RBE_ABI_DUMPER are true.
dumpRule := sAbiDump
- if ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_ABI_DUMPER") {
- dumpRule = sAbiDumpRE
- }
ctx.Build(pctx, android.BuildParams{
Rule: dumpRule,
Description: "header-abi-dumper " + srcFile.Rel(),
diff --git a/cc/config/vndk.go b/cc/config/vndk.go
index 492cd98..f2e1a90 100644
--- a/cc/config/vndk.go
+++ b/cc/config/vndk.go
@@ -26,6 +26,8 @@
"android.hardware.automotive.occupant_awareness-V1-ndk",
"android.hardware.automotive.occupant_awareness-V1-ndk_platform",
"android.hardware.automotive.occupant_awareness-ndk_platform",
+ "android.hardware.drm-V1-ndk",
+ "android.hardware.dumpstate-V1-ndk",
"android.hardware.gnss-V1-ndk",
"android.hardware.gnss-V1-ndk_platform",
"android.hardware.gnss-ndk_platform",
@@ -91,6 +93,11 @@
"android.hardware.security.sharedsecret-V1-ndk_platform",
"android.hardware.security.sharedsecret-ndk_platform",
"android.hardware.security.sharedsecret-unstable-ndk_platform",
+ "android.hardware.sensors-V1-ndk",
+ "android.hardware.soundtrigger3-V1-ndk",
+ "android.hardware.soundtrigger3-V1-ndk_platform",
+ "android.hardware.uwb-V1-ndk",
+ "android.hardware.uwb-V1-ndk_platform",
"android.hardware.vibrator-V1-ndk_platform",
"android.hardware.vibrator-V2-ndk",
"android.hardware.vibrator-V2-ndk_platform",
@@ -110,6 +117,7 @@
"android.system.keystore2-V1-ndk_platform",
"android.system.keystore2-ndk_platform",
"android.system.keystore2-unstable-ndk_platform",
+ "android.system.suspend-V1-ndk",
"android.system.suspend-V1-ndk_platform",
"libbinder",
"libcrypto",
diff --git a/java/androidmk.go b/java/androidmk.go
index 80b828d..f51e072 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -409,13 +409,21 @@
entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", app.linter.reports)
},
},
- }}
+ ExtraFooters: []android.AndroidMkExtraFootersFunc{
+ func(w io.Writer, name, prefix, moduleDir string) {
+ if app.javaApiUsedByOutputFile.String() != "" {
+ fmt.Fprintf(w, "$(call dist-for-goals,%s,%s:%s/$(notdir %s))\n",
+ app.installApkName, app.javaApiUsedByOutputFile.String(), "java_apis_used_by_apex", app.javaApiUsedByOutputFile.String())
+ }
+ },
+ }},
+ }
}
func (a *AndroidApp) getOverriddenPackages() []string {
var overridden []string
- if len(a.appProperties.Overrides) > 0 {
- overridden = append(overridden, a.appProperties.Overrides...)
+ if len(a.overridableAppProperties.Overrides) > 0 {
+ overridden = append(overridden, a.overridableAppProperties.Overrides...)
}
// When APK name is overridden via PRODUCT_PACKAGE_NAME_OVERRIDES
// ensure that the original name is overridden.
diff --git a/java/androidmk_test.go b/java/androidmk_test.go
index 246c0eb..197da4f 100644
--- a/java/androidmk_test.go
+++ b/java/androidmk_test.go
@@ -206,3 +206,49 @@
t.Errorf("Unexpected flag value - expected: %q, actual: %q", expected, actual)
}
}
+
+func TestGetOverriddenPackages(t *testing.T) {
+ ctx, _ := testJava(
+ t, `
+ android_app {
+ name: "foo",
+ srcs: ["a.java"],
+ sdk_version: "current",
+ overrides: ["qux"]
+ }
+
+ override_android_app {
+ name: "foo_override",
+ base: "foo",
+ overrides: ["bar"]
+ }
+ `)
+
+ expectedVariants := []struct {
+ name string
+ moduleName string
+ variantName string
+ overrides []string
+ }{
+ {
+ name: "foo",
+ moduleName: "foo",
+ variantName: "android_common",
+ overrides: []string{"qux"},
+ },
+ {
+ name: "foo",
+ moduleName: "foo_override",
+ variantName: "android_common_foo_override",
+ overrides: []string{"bar", "foo"},
+ },
+ }
+
+ for _, expected := range expectedVariants {
+ mod := ctx.ModuleForTests(expected.name, expected.variantName).Module()
+ entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0]
+ actual := entries.EntryMap["LOCAL_OVERRIDES_PACKAGES"]
+
+ android.AssertDeepEquals(t, "overrides property", expected.overrides, actual)
+ }
+}
diff --git a/java/app.go b/java/app.go
index 2b52eab..c53fc81 100755
--- a/java/app.go
+++ b/java/app.go
@@ -63,13 +63,6 @@
// list of resource labels to generate individual resource packages
Package_splits []string
- // Names of modules to be overridden. Listed modules can only be other binaries
- // (in Make or Soong).
- // This does not completely prevent installation of the overridden binaries, but if both
- // binaries would be installed by default (in PRODUCT_PACKAGES) the other binary will be removed
- // from PRODUCT_PACKAGES.
- Overrides []string
-
// list of native libraries that will be provided in or alongside the resulting jar
Jni_libs []string `android:"arch_variant"`
@@ -125,6 +118,9 @@
// Name of the signing certificate lineage file or filegroup module.
Lineage *string `android:"path"`
+ // For overriding the --rotation-min-sdk-version property of apksig
+ RotationMinSdkVersion *string
+
// the package name of this app. The package name in the manifest file is used if one was not given.
Package_name *string
@@ -133,6 +129,13 @@
// Whether to rename the package in resources to the override name rather than the base name. Defaults to true.
Rename_resources_package *bool
+
+ // Names of modules to be overridden. Listed modules can only be other binaries
+ // (in Make or Soong).
+ // This does not completely prevent installation of the overridden binaries, but if both
+ // binaries would be installed by default (in PRODUCT_PACKAGES) the other binary will be removed
+ // from PRODUCT_PACKAGES.
+ Overrides []string
}
type AndroidApp struct {
@@ -166,6 +169,8 @@
overriddenManifestPackageName string
android.ApexBundleDepsInfo
+
+ javaApiUsedByOutputFile android.ModuleOutPath
}
func (a *AndroidApp) IsInstallable() bool {
@@ -274,6 +279,7 @@
func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
a.checkAppSdkVersions(ctx)
a.generateAndroidBuildActions(ctx)
+ a.generateJavaUsedByApex(ctx)
}
func (a *AndroidApp) checkAppSdkVersions(ctx android.ModuleContext) {
@@ -665,7 +671,10 @@
if lineage := String(a.overridableAppProperties.Lineage); lineage != "" {
lineageFile = android.PathForModuleSrc(ctx, lineage)
}
- CreateAndSignAppPackage(ctx, packageFile, a.exportPackage, jniJarFile, dexJarFile, certificates, apkDeps, v4SignatureFile, lineageFile)
+
+ rotationMinSdkVersion := String(a.overridableAppProperties.RotationMinSdkVersion)
+
+ CreateAndSignAppPackage(ctx, packageFile, a.exportPackage, jniJarFile, dexJarFile, certificates, apkDeps, v4SignatureFile, lineageFile, rotationMinSdkVersion)
a.outputFile = packageFile
if v4SigningRequested {
a.extraOutputFiles = append(a.extraOutputFiles, v4SignatureFile)
@@ -677,7 +686,7 @@
if v4SigningRequested {
v4SignatureFile = android.PathForModuleOut(ctx, a.installApkName+"_"+split.suffix+".apk.idsig")
}
- CreateAndSignAppPackage(ctx, packageFile, split.path, nil, nil, certificates, apkDeps, v4SignatureFile, lineageFile)
+ CreateAndSignAppPackage(ctx, packageFile, split.path, nil, nil, certificates, apkDeps, v4SignatureFile, lineageFile, rotationMinSdkVersion)
a.extraOutputFiles = append(a.extraOutputFiles, packageFile)
if v4SigningRequested {
a.extraOutputFiles = append(a.extraOutputFiles, v4SignatureFile)
@@ -912,7 +921,7 @@
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
android.InitDefaultableModule(module)
- android.InitOverridableModule(module, &module.appProperties.Overrides)
+ android.InitOverridableModule(module, &module.overridableAppProperties.Overrides)
android.InitApexModule(module)
android.InitBazelModule(module)
@@ -1035,7 +1044,7 @@
android.InitAndroidMultiTargetsArchModule(module, android.DeviceSupported, android.MultilibCommon)
android.InitDefaultableModule(module)
- android.InitOverridableModule(module, &module.appProperties.Overrides)
+ android.InitOverridableModule(module, &module.overridableAppProperties.Overrides)
return module
}
diff --git a/java/app_builder.go b/java/app_builder.go
index 4a18dca..31023cb 100644
--- a/java/app_builder.go
+++ b/java/app_builder.go
@@ -52,7 +52,7 @@
})
func CreateAndSignAppPackage(ctx android.ModuleContext, outputFile android.WritablePath,
- packageFile, jniJarFile, dexJarFile android.Path, certificates []Certificate, deps android.Paths, v4SignatureFile android.WritablePath, lineageFile android.Path) {
+ packageFile, jniJarFile, dexJarFile android.Path, certificates []Certificate, deps android.Paths, v4SignatureFile android.WritablePath, lineageFile android.Path, rotationMinSdkVersion string) {
unsignedApkName := strings.TrimSuffix(outputFile.Base(), ".apk") + "-unsigned.apk"
unsignedApk := android.PathForModuleOut(ctx, unsignedApkName)
@@ -73,10 +73,10 @@
Implicits: deps,
})
- SignAppPackage(ctx, outputFile, unsignedApk, certificates, v4SignatureFile, lineageFile)
+ SignAppPackage(ctx, outputFile, unsignedApk, certificates, v4SignatureFile, lineageFile, rotationMinSdkVersion)
}
-func SignAppPackage(ctx android.ModuleContext, signedApk android.WritablePath, unsignedApk android.Path, certificates []Certificate, v4SignatureFile android.WritablePath, lineageFile android.Path) {
+func SignAppPackage(ctx android.ModuleContext, signedApk android.WritablePath, unsignedApk android.Path, certificates []Certificate, v4SignatureFile android.WritablePath, lineageFile android.Path, rotationMinSdkVersion string) {
var certificateArgs []string
var deps android.Paths
@@ -97,6 +97,10 @@
deps = append(deps, lineageFile)
}
+ if rotationMinSdkVersion != "" {
+ flags = append(flags, "--rotation-min-sdk-version", rotationMinSdkVersion)
+ }
+
rule := Signapk
args := map[string]string{
"certificates": strings.Join(certificateArgs, " "),
@@ -254,6 +258,18 @@
})
}
+func (a *AndroidApp) generateJavaUsedByApex(ctx android.ModuleContext) {
+ javaApiUsedByOutputFile := android.PathForModuleOut(ctx, a.installApkName+"_using.xml")
+ javaUsedByRule := android.NewRuleBuilder(pctx, ctx)
+ javaUsedByRule.Command().
+ Tool(android.PathForSource(ctx, "build/soong/scripts/gen_java_usedby_apex.sh")).
+ BuiltTool("dexdeps").
+ Output(javaApiUsedByOutputFile).
+ Input(a.Library.Module.outputFile)
+ javaUsedByRule.Build("java_usedby_list", "Generate Java APIs used by Apex")
+ a.javaApiUsedByOutputFile = javaApiUsedByOutputFile
+}
+
func targetToJniDir(target android.Target) string {
return filepath.Join("lib", target.Arch.Abi[0])
}
diff --git a/java/app_import.go b/java/app_import.go
index b017eca..58c01a4 100644
--- a/java/app_import.go
+++ b/java/app_import.go
@@ -80,6 +80,9 @@
// Name of the signing certificate lineage file or filegroup module.
Lineage *string `android:"path"`
+ // For overriding the --rotation-min-sdk-version property of apksig
+ RotationMinSdkVersion *string
+
// Sign with the default system dev certificate. Must be used judiciously. Most imported apps
// need to either specify a specific certificate or be presigned.
Default_dev_cert *bool
@@ -333,7 +336,10 @@
if lineage := String(a.properties.Lineage); lineage != "" {
lineageFile = android.PathForModuleSrc(ctx, lineage)
}
- SignAppPackage(ctx, signed, jnisUncompressed, certificates, nil, lineageFile)
+
+ rotationMinSdkVersion := String(a.properties.RotationMinSdkVersion)
+
+ SignAppPackage(ctx, signed, jnisUncompressed, certificates, nil, lineageFile, rotationMinSdkVersion)
a.outputFile = signed
} else {
alignedApk := android.PathForModuleOut(ctx, "zip-aligned", apkFilename)
diff --git a/java/app_import_test.go b/java/app_import_test.go
index 8f6c75f..41be092 100644
--- a/java/app_import_test.go
+++ b/java/app_import_test.go
@@ -129,6 +129,7 @@
certificate: "platform",
additional_certificates: [":additional_certificate"],
lineage: "lineage.bin",
+ rotationMinSdkVersion: "32",
}
android_app_certificate {
@@ -148,11 +149,12 @@
if expected != certificatesFlag {
t.Errorf("Incorrect certificates flags, expected: %q, got: %q", expected, certificatesFlag)
}
- // Check cert signing lineage flag.
- signingFlag := signedApk.Args["flags"]
- expected = "--lineage lineage.bin"
- if expected != signingFlag {
- t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag)
+
+ // Check cert signing flags.
+ actualCertSigningFlags := signedApk.Args["flags"]
+ expectedCertSigningFlags := "--lineage lineage.bin --rotation-min-sdk-version 32"
+ if expectedCertSigningFlags != actualCertSigningFlags {
+ t.Errorf("Incorrect signing flags, expected: %q, got: %q", expectedCertSigningFlags, actualCertSigningFlags)
}
rule := variant.Rule("genProvenanceMetaData")
diff --git a/java/app_test.go b/java/app_test.go
index 6a4508c..3661426 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -1484,11 +1484,11 @@
func TestCertificates(t *testing.T) {
testCases := []struct {
- name string
- bp string
- certificateOverride string
- expectedLineage string
- expectedCertificate string
+ name string
+ bp string
+ certificateOverride string
+ expectedCertSigningFlags string
+ expectedCertificate string
}{
{
name: "default",
@@ -1499,9 +1499,9 @@
sdk_version: "current",
}
`,
- certificateOverride: "",
- expectedLineage: "",
- expectedCertificate: "build/make/target/product/security/testkey.x509.pem build/make/target/product/security/testkey.pk8",
+ certificateOverride: "",
+ expectedCertSigningFlags: "",
+ expectedCertificate: "build/make/target/product/security/testkey.x509.pem build/make/target/product/security/testkey.pk8",
},
{
name: "module certificate property",
@@ -1518,9 +1518,9 @@
certificate: "cert/new_cert",
}
`,
- certificateOverride: "",
- expectedLineage: "",
- expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
+ certificateOverride: "",
+ expectedCertSigningFlags: "",
+ expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
},
{
name: "path certificate property",
@@ -1532,9 +1532,9 @@
sdk_version: "current",
}
`,
- certificateOverride: "",
- expectedLineage: "",
- expectedCertificate: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
+ certificateOverride: "",
+ expectedCertSigningFlags: "",
+ expectedCertificate: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
},
{
name: "certificate overrides",
@@ -1551,18 +1551,19 @@
certificate: "cert/new_cert",
}
`,
- certificateOverride: "foo:new_certificate",
- expectedLineage: "",
- expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
+ certificateOverride: "foo:new_certificate",
+ expectedCertSigningFlags: "",
+ expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
},
{
- name: "certificate lineage",
+ name: "certificate signing flags",
bp: `
android_app {
name: "foo",
srcs: ["a.java"],
certificate: ":new_certificate",
lineage: "lineage.bin",
+ rotationMinSdkVersion: "32",
sdk_version: "current",
}
@@ -1571,18 +1572,19 @@
certificate: "cert/new_cert",
}
`,
- certificateOverride: "",
- expectedLineage: "--lineage lineage.bin",
- expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
+ certificateOverride: "",
+ expectedCertSigningFlags: "--lineage lineage.bin --rotation-min-sdk-version 32",
+ expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
},
{
- name: "lineage from filegroup",
+ name: "cert signing flags from filegroup",
bp: `
android_app {
name: "foo",
srcs: ["a.java"],
certificate: ":new_certificate",
lineage: ":lineage_bin",
+ rotationMinSdkVersion: "32",
sdk_version: "current",
}
@@ -1596,9 +1598,9 @@
srcs: ["lineage.bin"],
}
`,
- certificateOverride: "",
- expectedLineage: "--lineage lineage.bin",
- expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
+ certificateOverride: "",
+ expectedCertSigningFlags: "--lineage lineage.bin --rotation-min-sdk-version 32",
+ expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
},
}
@@ -1619,8 +1621,8 @@
signCertificateFlags := signapk.Args["certificates"]
android.AssertStringEquals(t, "certificates flags", test.expectedCertificate, signCertificateFlags)
- signFlags := signapk.Args["flags"]
- android.AssertStringEquals(t, "signing flags", test.expectedLineage, signFlags)
+ certSigningFlags := signapk.Args["flags"]
+ android.AssertStringEquals(t, "cert signing flags", test.expectedCertSigningFlags, certSigningFlags)
})
}
}
@@ -1815,6 +1817,7 @@
base: "foo",
certificate: ":new_certificate",
lineage: "lineage.bin",
+ rotationMinSdkVersion: "32",
logging_parent: "bah",
}
@@ -1860,89 +1863,89 @@
`)
expectedVariants := []struct {
- name string
- moduleName string
- variantName string
- apkName string
- apkPath string
- certFlag string
- lineageFlag string
- overrides []string
- packageFlag string
- renameResources bool
- logging_parent string
+ name string
+ moduleName string
+ variantName string
+ apkName string
+ apkPath string
+ certFlag string
+ certSigningFlags string
+ overrides []string
+ packageFlag string
+ renameResources bool
+ logging_parent string
}{
{
- name: "foo",
- moduleName: "foo",
- variantName: "android_common",
- apkPath: "out/soong/target/product/test_device/system/app/foo/foo.apk",
- certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
- lineageFlag: "",
- overrides: []string{"qux"},
- packageFlag: "",
- renameResources: false,
- logging_parent: "",
+ name: "foo",
+ moduleName: "foo",
+ variantName: "android_common",
+ apkPath: "out/soong/target/product/test_device/system/app/foo/foo.apk",
+ certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
+ certSigningFlags: "",
+ overrides: []string{"qux"},
+ packageFlag: "",
+ renameResources: false,
+ logging_parent: "",
},
{
- name: "foo",
- moduleName: "bar",
- variantName: "android_common_bar",
- apkPath: "out/soong/target/product/test_device/system/app/bar/bar.apk",
- certFlag: "cert/new_cert.x509.pem cert/new_cert.pk8",
- lineageFlag: "--lineage lineage.bin",
- overrides: []string{"qux", "foo"},
- packageFlag: "",
- renameResources: false,
- logging_parent: "bah",
+ name: "foo",
+ moduleName: "bar",
+ variantName: "android_common_bar",
+ apkPath: "out/soong/target/product/test_device/system/app/bar/bar.apk",
+ certFlag: "cert/new_cert.x509.pem cert/new_cert.pk8",
+ certSigningFlags: "--lineage lineage.bin --rotation-min-sdk-version 32",
+ overrides: []string{"qux", "foo"},
+ packageFlag: "",
+ renameResources: false,
+ logging_parent: "bah",
},
{
- name: "foo",
- moduleName: "baz",
- variantName: "android_common_baz",
- apkPath: "out/soong/target/product/test_device/system/app/baz/baz.apk",
- 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",
- renameResources: true,
- logging_parent: "",
+ name: "foo",
+ moduleName: "baz",
+ variantName: "android_common_baz",
+ apkPath: "out/soong/target/product/test_device/system/app/baz/baz.apk",
+ certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
+ certSigningFlags: "",
+ overrides: []string{"qux", "foo"},
+ packageFlag: "org.dandroid.bp",
+ renameResources: true,
+ logging_parent: "",
},
{
- name: "foo",
- moduleName: "baz_no_rename_resources",
- variantName: "android_common_baz_no_rename_resources",
- apkPath: "out/soong/target/product/test_device/system/app/baz_no_rename_resources/baz_no_rename_resources.apk",
- 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",
- renameResources: false,
- logging_parent: "",
+ name: "foo",
+ moduleName: "baz_no_rename_resources",
+ variantName: "android_common_baz_no_rename_resources",
+ apkPath: "out/soong/target/product/test_device/system/app/baz_no_rename_resources/baz_no_rename_resources.apk",
+ certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
+ certSigningFlags: "",
+ overrides: []string{"qux", "foo"},
+ packageFlag: "org.dandroid.bp",
+ renameResources: false,
+ logging_parent: "",
},
{
- name: "foo_no_rename_resources",
- moduleName: "baz_base_no_rename_resources",
- variantName: "android_common_baz_base_no_rename_resources",
- apkPath: "out/soong/target/product/test_device/system/app/baz_base_no_rename_resources/baz_base_no_rename_resources.apk",
- certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
- lineageFlag: "",
- overrides: []string{"qux", "foo_no_rename_resources"},
- packageFlag: "org.dandroid.bp",
- renameResources: false,
- logging_parent: "",
+ name: "foo_no_rename_resources",
+ moduleName: "baz_base_no_rename_resources",
+ variantName: "android_common_baz_base_no_rename_resources",
+ apkPath: "out/soong/target/product/test_device/system/app/baz_base_no_rename_resources/baz_base_no_rename_resources.apk",
+ certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
+ certSigningFlags: "",
+ overrides: []string{"qux", "foo_no_rename_resources"},
+ packageFlag: "org.dandroid.bp",
+ renameResources: false,
+ logging_parent: "",
},
{
- name: "foo_no_rename_resources",
- moduleName: "baz_override_base_rename_resources",
- variantName: "android_common_baz_override_base_rename_resources",
- apkPath: "out/soong/target/product/test_device/system/app/baz_override_base_rename_resources/baz_override_base_rename_resources.apk",
- certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
- lineageFlag: "",
- overrides: []string{"qux", "foo_no_rename_resources"},
- packageFlag: "org.dandroid.bp",
- renameResources: true,
- logging_parent: "",
+ name: "foo_no_rename_resources",
+ moduleName: "baz_override_base_rename_resources",
+ variantName: "android_common_baz_override_base_rename_resources",
+ apkPath: "out/soong/target/product/test_device/system/app/baz_override_base_rename_resources/baz_override_base_rename_resources.apk",
+ certFlag: "build/make/target/product/security/expiredkey.x509.pem build/make/target/product/security/expiredkey.pk8",
+ certSigningFlags: "",
+ overrides: []string{"qux", "foo_no_rename_resources"},
+ packageFlag: "org.dandroid.bp",
+ renameResources: true,
+ logging_parent: "",
},
}
for _, expected := range expectedVariants {
@@ -1956,13 +1959,13 @@
certFlag := signapk.Args["certificates"]
android.AssertStringEquals(t, "certificates flags", expected.certFlag, certFlag)
- // Check the lineage flags
- lineageFlag := signapk.Args["flags"]
- android.AssertStringEquals(t, "signing flags", expected.lineageFlag, lineageFlag)
+ // Check the cert signing flags
+ certSigningFlags := signapk.Args["flags"]
+ android.AssertStringEquals(t, "cert signing flags", expected.certSigningFlags, certSigningFlags)
// Check if the overrides field values are correctly aggregated.
mod := variant.Module().(*AndroidApp)
- android.AssertDeepEquals(t, "overrides property", expected.overrides, mod.appProperties.Overrides)
+ android.AssertDeepEquals(t, "overrides property", expected.overrides, mod.overridableAppProperties.Overrides)
// Test Overridable property: Logging_parent
logging_parent := mod.aapt.LoggingParent
@@ -1980,6 +1983,64 @@
}
}
+func TestOverrideAndroidAppOverrides(t *testing.T) {
+ ctx, _ := testJava(
+ t, `
+ android_app {
+ name: "foo",
+ srcs: ["a.java"],
+ sdk_version: "current",
+ overrides: ["qux"]
+ }
+
+ android_app {
+ name: "bar",
+ srcs: ["b.java"],
+ sdk_version: "current",
+ overrides: ["foo"]
+ }
+
+ override_android_app {
+ name: "foo_override",
+ base: "foo",
+ overrides: ["bar"]
+ }
+ `)
+
+ expectedVariants := []struct {
+ name string
+ moduleName string
+ variantName string
+ overrides []string
+ }{
+ {
+ name: "foo",
+ moduleName: "foo",
+ variantName: "android_common",
+ overrides: []string{"qux"},
+ },
+ {
+ name: "bar",
+ moduleName: "bar",
+ variantName: "android_common",
+ overrides: []string{"foo"},
+ },
+ {
+ name: "foo",
+ moduleName: "foo_override",
+ variantName: "android_common_foo_override",
+ overrides: []string{"bar", "foo"},
+ },
+ }
+ for _, expected := range expectedVariants {
+ variant := ctx.ModuleForTests(expected.name, expected.variantName)
+
+ // Check if the overrides field values are correctly aggregated.
+ mod := variant.Module().(*AndroidApp)
+ android.AssertDeepEquals(t, "overrides property", expected.overrides, mod.overridableAppProperties.Overrides)
+ }
+}
+
func TestOverrideAndroidAppStem(t *testing.T) {
ctx, _ := testJava(t, `
android_app {
@@ -2160,9 +2221,9 @@
// Check if the overrides field values are correctly aggregated.
mod := variant.Module().(*AndroidTest)
- if !reflect.DeepEqual(expected.overrides, mod.appProperties.Overrides) {
+ if !reflect.DeepEqual(expected.overrides, mod.overridableAppProperties.Overrides) {
t.Errorf("Incorrect overrides property value, expected: %q, got: %q",
- expected.overrides, mod.appProperties.Overrides)
+ expected.overrides, mod.overridableAppProperties.Overrides)
}
// Check if javac classpath has the correct jar file path. This checks instrumentation_for overrides.
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go
index c3a5d5f..9600935 100644
--- a/java/bootclasspath_fragment.go
+++ b/java/bootclasspath_fragment.go
@@ -709,6 +709,10 @@
} else if global.ApexBootJars.Len() != 0 && !android.IsModuleInVersionedSdk(ctx.Module()) {
unknown = android.RemoveListFromList(unknown, b.properties.Coverage.Contents)
_, unknown = android.RemoveFromList("core-icu4j", unknown)
+ // This module only exists in car products.
+ // So ignore it even if it is not in PRODUCT_APEX_BOOT_JARS.
+ // TODO(b/202896428): Add better way to handle this.
+ _, unknown = android.RemoveFromList("android.car-module", unknown)
if len(unknown) > 0 {
ctx.ModuleErrorf("%s in contents must also be declared in PRODUCT_APEX_BOOT_JARS", unknown)
}
diff --git a/java/droidstubs.go b/java/droidstubs.go
index 3b1f7c0..d444738 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -379,7 +379,8 @@
cmd.FlagWithOutput("--generate-api-levels ", d.apiVersionsXml)
cmd.FlagWithInput("--apply-api-levels ", d.apiVersionsXml)
cmd.FlagWithArg("--current-version ", ctx.Config().PlatformSdkVersion().String())
- cmd.FlagWithArg("--current-codename ", ctx.Config().PlatformSdkCodename())
+ // STOPSHIP: RESTORE THIS LOGIC WHEN DECLARING "REL" BUILD
+ // cmd.FlagWithArg("--current-codename ", ctx.Config().PlatformSdkCodename())
filename := proptools.StringDefault(d.properties.Api_levels_jar_filename, "android.jar")
diff --git a/java/rro.go b/java/rro.go
index be84aff..c98cbbd 100644
--- a/java/rro.go
+++ b/java/rro.go
@@ -51,6 +51,9 @@
// Name of the signing certificate lineage file.
Lineage *string
+ // For overriding the --rotation-min-sdk-version property of apksig
+ RotationMinSdkVersion *string
+
// optional theme name. If specified, the overlay package will be applied
// only when the ro.boot.vendor.overlay.theme system property is set to the same value.
Theme *string
@@ -149,7 +152,10 @@
if lineage := String(r.properties.Lineage); lineage != "" {
lineageFile = android.PathForModuleSrc(ctx, lineage)
}
- SignAppPackage(ctx, signed, r.aapt.exportPackage, certificates, nil, lineageFile)
+
+ rotationMinSdkVersion := String(r.properties.RotationMinSdkVersion)
+
+ SignAppPackage(ctx, signed, r.aapt.exportPackage, certificates, nil, lineageFile, rotationMinSdkVersion)
r.certificate = certificates[0]
r.outputFile = signed
diff --git a/java/rro_test.go b/java/rro_test.go
index be0d7ba..00ba5ba 100644
--- a/java/rro_test.go
+++ b/java/rro_test.go
@@ -33,6 +33,7 @@
name: "foo",
certificate: "platform",
lineage: "lineage.bin",
+ rotationMinSdkVersion: "32",
product_specific: true,
static_libs: ["bar"],
resource_libs: ["baz"],
@@ -89,13 +90,14 @@
t.Errorf("Resource lib flag %q missing in aapt2 link flags: %q", resourceLibFlag, aapt2Flags)
}
- // Check cert signing flag.
+ // Check cert signing flags.
signedApk := m.Output("signed/foo.apk")
- lineageFlag := signedApk.Args["flags"]
- expectedLineageFlag := "--lineage lineage.bin"
- if expectedLineageFlag != lineageFlag {
- t.Errorf("Incorrect signing lineage flags, expected: %q, got: %q", expectedLineageFlag, lineageFlag)
+ actualCertSigningFlags := signedApk.Args["flags"]
+ expectedCertSigningFlags := "--lineage lineage.bin --rotation-min-sdk-version 32"
+ if expectedCertSigningFlags != actualCertSigningFlags {
+ t.Errorf("Incorrect cert signing flags, expected: %q, got: %q", expectedCertSigningFlags, actualCertSigningFlags)
}
+
signingFlag := signedApk.Args["certificates"]
expected := "build/make/target/product/security/platform.x509.pem build/make/target/product/security/platform.pk8"
if expected != signingFlag {
diff --git a/java/testing.go b/java/testing.go
index 4000334..511cc5d 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -54,6 +54,8 @@
"build/soong/java/lint_defaults.txt": nil,
// Needed for apps that do not provide their own.
"build/make/target/product/security": nil,
+ // Required to generate Java used-by API coverage
+ "build/soong/scripts/gen_java_usedby_apex.sh": nil,
}.AddToFixture(),
)
diff --git a/scripts/test_config_fixer.py b/scripts/test_config_fixer.py
index c150e8c..3dbc22e 100644
--- a/scripts/test_config_fixer.py
+++ b/scripts/test_config_fixer.py
@@ -28,6 +28,8 @@
from manifest import parse_test_config
from manifest import write_xml
+KNOWN_PREPARERS = ['com.android.tradefed.targetprep.TestAppInstallSetup',
+ 'com.android.tradefed.targetprep.suite.SuiteApkInstaller']
def parse_args():
"""Parse commandline arguments."""
@@ -64,7 +66,7 @@
tests = get_children_with_tag(test_config, 'target_preparer')
for test in tests:
- if test.getAttribute('class') == "com.android.tradefed.targetprep.TestAppInstallSetup":
+ if test.getAttribute('class') in KNOWN_PREPARERS:
options = get_children_with_tag(test, 'option')
for option in options:
if option.getAttribute('name') == "test-file-name":
diff --git a/scripts/test_config_fixer_test.py b/scripts/test_config_fixer_test.py
index d00a593..39ce5b3 100644
--- a/scripts/test_config_fixer_test.py
+++ b/scripts/test_config_fixer_test.py
@@ -70,7 +70,7 @@
class OverwriteTestFileNameTest(unittest.TestCase):
""" Unit tests for overwrite_test_file_name function """
- test_config = (
+ test_config_test_app_install_setup = (
'<?xml version="1.0" encoding="utf-8"?>\n'
'<configuration description="Runs some tests.">\n'
' <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">\n'
@@ -82,15 +82,38 @@
' </test>\n'
'</configuration>\n')
- def test_all(self):
- doc = minidom.parseString(self.test_config % ("foo.apk"))
+ test_config_suite_apk_installer = (
+ '<?xml version="1.0" encoding="utf-8"?>\n'
+ '<configuration description="Runs some tests.">\n'
+ ' <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">\n'
+ ' <option name="test-file-name" value="%s"/>\n'
+ ' </target_preparer>\n'
+ ' <test class="com.android.tradefed.testtype.AndroidJUnitTest">\n'
+ ' <option name="package" value="com.android.foo"/>\n'
+ ' <option name="runtime-hint" value="20s"/>\n'
+ ' </test>\n'
+ '</configuration>\n')
+
+ def test_testappinstallsetup(self):
+ doc = minidom.parseString(self.test_config_test_app_install_setup % ("foo.apk"))
test_config_fixer.overwrite_test_file_name(doc, "bar.apk")
output = io.StringIO()
test_config_fixer.write_xml(output, doc)
# Only the matching package name in a test node should be updated.
- expected = self.test_config % ("bar.apk")
+ expected = self.test_config_test_app_install_setup % ("bar.apk")
+ self.assertEqual(expected, output.getvalue())
+
+ def test_suiteapkinstaller(self):
+ doc = minidom.parseString(self.test_config_suite_apk_installer % ("foo.apk"))
+
+ test_config_fixer.overwrite_test_file_name(doc, "bar.apk")
+ output = io.StringIO()
+ test_config_fixer.write_xml(output, doc)
+
+ # Only the matching package name in a test node should be updated.
+ expected = self.test_config_suite_apk_installer % ("bar.apk")
self.assertEqual(expected, output.getvalue())