From 1e6afedb963c1aad6094b7cd835a0a18700de2c6 Mon Sep 17 00:00:00 2001 From: Inseob Kim Date: Wed, 3 Apr 2024 17:24:54 +0900 Subject: [PATCH] Add libs for BuildManifest.apk generation Bug: 330282551 Test: m aosp_cf_system_x86_64 Change-Id: I4f99b5638490dae4f1da22287647ef4dfd47dcaa --- filesystem/fsverity_metadata.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/filesystem/fsverity_metadata.go b/filesystem/fsverity_metadata.go index 70f94e0a9..3e50ff752 100644 --- a/filesystem/fsverity_metadata.go +++ b/filesystem/fsverity_metadata.go @@ -27,6 +27,9 @@ type fsverityProperties struct { // etc/security/fsverity/BuildManifest.apk will also be generated which contains information // about generated .fsv_meta files. Inputs []string + + // APK libraries to link against, for etc/security/fsverity/BuildManifest.apk + Libs []string `android:"path"` } func (f *filesystem) writeManifestGeneratorListFile(ctx android.ModuleContext, outputPath android.OutputPath, matchedSpecs []android.PackagingSpec, rebasedDir android.OutputPath) { @@ -117,20 +120,20 @@ func (f *filesystem) buildFsverityMetadataFiles(ctx android.ModuleContext, build aapt2Path := ctx.Config().HostToolPath(ctx, "aapt2") apkPath := rebasedDir.Join(ctx, "etc", "security", "fsverity", "BuildManifest.apk") manifestTemplatePath := android.PathForSource(ctx, "system/security/fsverity/AndroidManifest.xml") - // package-export is currently generated by Makefile. - // TODO(b/330282551): fully migrate into Soong - frameworkResPath := android.PathForArbitraryOutput(ctx, "target/common/obj/APPS/framework-res_intermediates/package-export.apk") + libs := android.PathsForModuleSrc(ctx, f.properties.Fsverity.Libs) cmd.Implicit(aapt2Path) cmd.Implicit(manifestTemplatePath) - cmd.Implicit(frameworkResPath) + cmd.Implicits(libs) sb.WriteString(aapt2Path.String()) sb.WriteString(" link -o ") sb.WriteString(apkPath.String()) sb.WriteString(" -A ") sb.WriteString(assetsPath.String()) - sb.WriteString(" -I ") - sb.WriteString(frameworkResPath.String()) + for _, lib := range libs { + sb.WriteString(" -I ") + sb.WriteString(lib.String()) + } minSdkVersion := ctx.Config().PlatformSdkCodename() if minSdkVersion == "REL" { minSdkVersion = ctx.Config().PlatformSdkVersion().String()