apex: validate vintf fragments in vendor APEX
In Make, vintf fragments are checked with assemble_vintf. Since vendor
APEXes can have vintf fragments, perform the same check with vintf
fragments in APEX.
Bug: 299034304
Test: m test.bad2.com.android.hardware.wifi
(should fail if its module type is `apex`)
Change-Id: I2f9ed50066b9b499b3562bfa51214c1e375d5747
diff --git a/apex/builder.go b/apex/builder.go
index cd7599a..1204dbb 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -76,6 +76,7 @@
pctx.HostBinToolVariable("debugfs_static", "debugfs_static")
pctx.SourcePathVariable("genNdkUsedbyApexPath", "build/soong/scripts/gen_ndk_usedby_apex.sh")
pctx.HostBinToolVariable("conv_linker_config", "conv_linker_config")
+ pctx.HostBinToolVariable("assemble_vintf", "assemble_vintf")
}
var (
@@ -229,6 +230,12 @@
CommandDeps: []string{"${conv_linker_config}"},
Description: "run apex_linkerconfig_validation",
}, "image_dir")
+
+ apexVintfFragmentsValidationRule = pctx.StaticRule("apexVintfFragmentsValidationRule", blueprint.RuleParams{
+ Command: `/bin/bash -c '(shopt -s nullglob; for f in ${image_dir}/etc/vintf/*.xml; do VINTF_IGNORE_TARGET_FCM_VERSION=true ${assemble_vintf} -i "$$f" > /dev/null; done)' && touch ${out}`,
+ CommandDeps: []string{"${assemble_vintf}"},
+ Description: "run apex_vintf_validation",
+ }, "image_dir")
)
// buildManifest creates buile rules to modify the input apex_manifest.json to add information
@@ -851,6 +858,9 @@
}
var validations android.Paths
validations = append(validations, runApexLinkerconfigValidation(ctx, unsignedOutputFile.OutputPath, imageDir.OutputPath))
+ if !a.testApex && a.SocSpecific() {
+ validations = append(validations, runApexVintfFragmentsValidation(ctx, unsignedOutputFile.OutputPath, imageDir.OutputPath))
+ }
// TODO(b/279688635) deapexer supports [ext4]
if suffix == imageApexSuffix && ext4 == a.payloadFsType {
validations = append(validations, runApexSepolicyTests(ctx, unsignedOutputFile.OutputPath))
@@ -1118,6 +1128,19 @@
return timestamp
}
+func runApexVintfFragmentsValidation(ctx android.ModuleContext, apexFile android.OutputPath, imageDir android.OutputPath) android.Path {
+ timestamp := android.PathForModuleOut(ctx, "apex_vintf_fragments_validation.timestamp")
+ ctx.Build(pctx, android.BuildParams{
+ Rule: apexVintfFragmentsValidationRule,
+ Input: apexFile,
+ Output: timestamp,
+ Args: map[string]string{
+ "image_dir": imageDir.String(),
+ },
+ })
+ return timestamp
+}
+
// Runs apex_sepolicy_tests
//
// $ deapexer list -Z {apex_file} > {file_contexts}