From 9fb9ff77b1bdb45195b2c4dd2986ab955e9685b2 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Mon, 10 Jul 2023 17:42:05 -0700 Subject: [PATCH] compatibility_matrices: add vintf_compatibility_matrix.core_hals. Add core_hals attribute to the vintf_compatibility_matrix rule. Its value is passed to assemble_vintf directly. Test: TH Bug: 290408770 Change-Id: Ie5e3363f0039f032033cbc2889b1bbbb0a5a56a7 --- .../build/vintf_compatibility_matrix.go | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/compatibility_matrices/build/vintf_compatibility_matrix.go b/compatibility_matrices/build/vintf_compatibility_matrix.go index c72cbde05c..4f342b252e 100644 --- a/compatibility_matrices/build/vintf_compatibility_matrix.go +++ b/compatibility_matrices/build/vintf_compatibility_matrix.go @@ -35,10 +35,10 @@ var ( pctx = android.NewPackageContext("android/vintf") assembleVintfRule = pctx.AndroidStaticRule("assemble_vintf", blueprint.RuleParams{ - Command: `${assembleVintfCmd} -i ${inputs} -o ${out}`, + Command: `${assembleVintfCmd} -i ${inputs} -o ${out} ${extraParams}`, CommandDeps: []string{"${assembleVintfCmd}"}, Description: "assemble_vintf -i ${inputs}", - }, "inputs") + }, "inputs", "extraParams") xmllintXsd = pctx.AndroidStaticRule("xmllint-xsd", blueprint.RuleParams{ Command: `$XmlLintCmd --quiet --schema $xsd $in > /dev/null && touch -a $out`, @@ -64,6 +64,13 @@ type vintfCompatibilityMatrixProperties struct { // list of kernel_config modules to be combined to final output Kernel_configs []string + + // Default is "default" for compatibility matrices on /vendor + // and /odm, and "disallow" for compatibility matrices on /system, + // /product, and /system_ext. + // If value is "only", only android.* HALs are allowed. If value + // is "disallow", none of android.* HALs are allowed. + Core_hals *string } type vintfCompatibilityMatrixRule struct { @@ -166,7 +173,8 @@ func (g *vintfCompatibilityMatrixRule) GenerateAndroidBuildActions(ctx android.M Implicits: inputPaths, Output: g.genFile, Args: map[string]string{ - "inputs": strings.Join(inputPaths.Strings(), ":"), + "inputs": strings.Join(inputPaths.Strings(), ":"), + "extraParams": strings.Join(g.getExtraParams(), " "), }, }) g.generateValidateBuildAction(ctx, g.genFile, schema.Path()) @@ -191,3 +199,23 @@ func (g *vintfCompatibilityMatrixRule) AndroidMk() android.AndroidMkData { }, } } + +// Return extra parameters to assemble_vintf. +func (g *vintfCompatibilityMatrixRule) getExtraParams() []string { + var extraParams []string + + coreHalsStrategy := proptools.StringDefault( + g.properties.Core_hals, + g.defaultCoreHalsStrategy(), + ) + extraParams = append(extraParams, "--core-hals", proptools.ShellEscape(coreHalsStrategy)) + return extraParams +} + +func (g *vintfCompatibilityMatrixRule) defaultCoreHalsStrategy() string { + // TODO(b/290408770): default to "disallow" for FCMs + + // For Device (vendor, odm) compatibility matrix, default is + // to not check anything. + return "default" +}