Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c8c74d67 authored by Marybeth Fair's avatar Marybeth Fair
Browse files

Connect fingerprint build flag to soong.

When RELEASE_FINGERPRINT_ACONFIG_PACKAGE is true, the storage file
version will be v2 for aconfig create-storage.

Test: manual
Change-Id: I6861ac1bfe8680ff7311e26efb627e0ac7c58f05
parent e451ed64
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -73,11 +73,11 @@ var (

	CreateStorageRule = pctx.AndroidStaticRule("aconfig_create_storage",
		blueprint.RuleParams{
			Command: `${aconfig} create-storage --container ${container} --file ${file_type} --out ${out} ${cache_files}`,
			Command: `${aconfig} create-storage --container ${container} --file ${file_type} --out ${out} ${cache_files} --version ${version}`,
			CommandDeps: []string{
				"${aconfig}",
			},
		}, "container", "file_type", "cache_files")
		}, "container", "file_type", "cache_files", "version")

	// For exported_java_aconfig_library: Generate a JAR from all
	// java_aconfig_libraries to be consumed by apps built outside the
+4 −0
Original line number Diff line number Diff line
@@ -289,6 +289,10 @@ func (c Config) ReleaseUseSystemFeatureBuildFlags() bool {
	return c.config.productVariables.GetBuildFlagBool("RELEASE_USE_SYSTEM_FEATURE_BUILD_FLAGS")
}

func (c Config) ReleaseFingerprintAconfigPackages() bool {
	return c.config.productVariables.GetBuildFlagBool("RELEASE_FINGERPRINT_ACONFIG_PACKAGES")
}

// A DeviceConfig object represents the configuration for a particular device
// being built. For now there will only be one of these, but in the future there
// may be multiple devices being built.
+7 −0
Original line number Diff line number Diff line
@@ -275,6 +275,12 @@ func (a *apexBundle) buildAconfigFiles(ctx android.ModuleContext) []apexFile {
		})
		files = append(files, newApexFile(ctx, apexAconfigFile, "aconfig_flags", "etc", etc, nil))

		// To enable fingerprint, we need to have v2 storage files. The default version is 1.
		storageFilesVersion := 1
		if ctx.Config().ReleaseFingerprintAconfigPackages() {
			storageFilesVersion = 2
		}

		for _, info := range createStorageInfo {
			outputFile := android.PathForModuleOut(ctx, info.Output_file)
			ctx.Build(pctx, android.BuildParams{
@@ -286,6 +292,7 @@ func (a *apexBundle) buildAconfigFiles(ctx android.ModuleContext) []apexFile {
					"container":   ctx.ModuleName(),
					"file_type":   info.File_type,
					"cache_files": android.JoinPathsWithPrefix(aconfigFiles, "--cache "),
					"version":     strconv.Itoa(storageFilesVersion),
				},
			})
			files = append(files, newApexFile(ctx, outputFile, info.File_type, "etc", etc, nil))
+9 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ package filesystem

import (
	"android/soong/android"
	"strconv"

	"github.com/google/blueprint/proptools"
)
@@ -45,6 +46,12 @@ func (f *filesystem) buildAconfigFlagsFiles(ctx android.ModuleContext, builder *
	installAconfigStorageDir := dir.Join(ctx, "etc", "aconfig")
	builder.Command().Text("mkdir -p").Text(installAconfigStorageDir.String())

	// To enable fingerprint, we need to have v2 storage files. The default version is 1.
	storageFilesVersion := 1
	if ctx.Config().ReleaseFingerprintAconfigPackages() {
		storageFilesVersion = 2
	}

	generatePartitionAconfigStorageFile := func(fileType, fileName string) {
		outputPath := installAconfigStorageDir.Join(ctx, fileName)
		builder.Command().
@@ -52,7 +59,8 @@ func (f *filesystem) buildAconfigFlagsFiles(ctx android.ModuleContext, builder *
			FlagWithArg("create-storage --container ", f.PartitionType()).
			FlagWithArg("--file ", fileType).
			FlagWithOutput("--out ", outputPath).
			FlagWithArg("--cache ", installAconfigFlagsPath.String())
			FlagWithArg("--cache ", installAconfigFlagsPath.String()).
			FlagWithArg("--version ", strconv.Itoa(storageFilesVersion))
		f.appendToEntry(ctx, outputPath)
	}