Merge "Skip install deps that is in "data" partition" into main
diff --git a/Android.bp b/Android.bp
index 337545b..7134591 100644
--- a/Android.bp
+++ b/Android.bp
@@ -176,6 +176,12 @@
footer_files: [
":applied_backported_fixes",
],
+ dist: {
+ targets: [
+ "droidcore-unbundled",
+ "sdk",
+ ],
+ },
// Currently, only microdroid, Ravenwood, and cf system image can refer to system-build.prop
visibility: [
"//build/soong/fsgen",
@@ -191,6 +197,10 @@
system_ext_specific: true,
product_config: ":product_config",
relative_install_path: "etc", // system_ext/etc/build.prop
+ dist: {
+ targets: ["droidcore-unbundled"],
+ dest: "build.prop-system_ext",
+ },
visibility: [
"//build/make/target/product/gsi",
"//build/soong/fsgen",
@@ -203,6 +213,10 @@
product_specific: true,
product_config: ":product_config",
relative_install_path: "etc", // product/etc/build.prop
+ dist: {
+ targets: ["droidcore-unbundled"],
+ dest: "build.prop-product",
+ },
visibility: [
"//build/make/target/product/gsi",
"//build/soong/fsgen",
@@ -215,6 +229,10 @@
device_specific: true,
product_config: ":product_config",
relative_install_path: "etc", // odm/etc/build.prop
+ dist: {
+ targets: ["droidcore-unbundled"],
+ dest: "build.prop-odm",
+ },
visibility: ["//build/soong/fsgen"],
}
@@ -251,6 +269,10 @@
ramdisk: true,
product_config: ":product_config",
relative_install_path: "etc/ramdisk", // ramdisk/system/etc/ramdisk/build.prop
+ dist: {
+ targets: ["droidcore-unbundled"],
+ dest: "build.prop-ramdisk",
+ },
visibility: ["//visibility:private"],
}
diff --git a/apex/apex.go b/apex/apex.go
index 196f389..38ab012 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -550,6 +550,9 @@
// Required modules, filled out during GenerateAndroidBuildActions and used in AndroidMk
required []string
+
+ // appinfo of the apk-in-apex of this module
+ appInfos java.AppInfos
}
// apexFileClass represents a type of file that can be included in APEX.
@@ -1931,6 +1934,7 @@
}
case androidAppTag:
if appInfo, ok := android.OtherModuleProvider(ctx, child, java.AppInfoProvider); ok {
+ a.appInfos = append(a.appInfos, *appInfo)
if appInfo.AppSet {
appDir := "app"
if appInfo.Privileged {
@@ -2267,6 +2271,8 @@
})
android.SetProvider(ctx, filesystem.ApexKeyPathInfoProvider, filesystem.ApexKeyPathInfo{a.apexKeysPath})
+
+ android.SetProvider(ctx, java.AppInfosProvider, a.appInfos)
}
// Set prebuiltInfoProvider. This will be used by `apex_prebuiltinfo_singleton` to print out a metadata file
diff --git a/filesystem/android_device.go b/filesystem/android_device.go
index 3d306e3..17209ed 100644
--- a/filesystem/android_device.go
+++ b/filesystem/android_device.go
@@ -114,6 +114,7 @@
miscInfo android.Path
rootDirForFsConfig string
rootDirForFsConfigTimestamp android.Path
+ apkCertsInfo android.Path
}
func AndroidDeviceFactory() android.Module {
@@ -188,6 +189,7 @@
allInstalledModules := a.allInstalledModules(ctx)
+ a.apkCertsInfo = a.buildApkCertsInfo(ctx, allInstalledModules)
a.kernelConfig, a.kernelVersion = a.extractKernelVersionAndConfigs(ctx)
a.miscInfo = a.addMiscInfo(ctx)
a.buildTargetFilesZip(ctx, allInstalledModules)
@@ -651,6 +653,9 @@
}
installedApexKeys = android.SortedUniquePaths(installedApexKeys) // Sort by keypath to match make
builder.Command().Text("cat").Inputs(installedApexKeys).Textf(" >> %s/META/apexkeys.txt", targetFilesDir.String())
+ // apkcerts.txt
+ builder.Command().Textf("cp").Input(a.apkCertsInfo).Textf(" %s/META/", targetFilesDir.String())
+
// Copy fastboot-info.txt
if fastbootInfo := android.PathForModuleSrc(ctx, proptools.String(a.deviceProps.FastbootInfo)); fastbootInfo != nil {
// TODO (b/399788523): Autogenerate fastboot-info.txt if there is no source fastboot-info.txt
@@ -864,3 +869,49 @@
return extractedVersionFile, extractedConfigsFile
}
+
+func (a *androidDevice) buildApkCertsInfo(ctx android.ModuleContext, allInstalledModules []android.Module) android.Path {
+ // TODO (spandandas): Add compressed
+ formatLine := func(cert java.Certificate, name, partition string) string {
+ pem := cert.AndroidMkString()
+ var key string
+ if cert.Key == nil {
+ key = ""
+ } else {
+ key = cert.Key.String()
+ }
+ return fmt.Sprintf(`name="%s" certificate="%s" private_key="%s" partition="%s"`, name, pem, key, partition)
+ }
+
+ apkCerts := []string{}
+ for _, installedModule := range allInstalledModules {
+ partition := ""
+ if commonInfo, ok := android.OtherModuleProvider(ctx, installedModule, android.CommonModuleInfoKey); ok {
+ partition = commonInfo.PartitionTag
+ } else {
+ ctx.ModuleErrorf("%s does not set CommonModuleInfoKey", installedModule.Name())
+ }
+ if info, ok := android.OtherModuleProvider(ctx, installedModule, java.AppInfoProvider); ok {
+ apkCerts = append(apkCerts, formatLine(info.Certificate, info.InstallApkName+".apk", partition))
+ } else if info, ok := android.OtherModuleProvider(ctx, installedModule, java.AppInfosProvider); ok {
+ for _, certInfo := range info {
+ apkCerts = append(apkCerts, formatLine(certInfo.Certificate, certInfo.InstallApkName+".apk", partition))
+ }
+ } else if info, ok := android.OtherModuleProvider(ctx, installedModule, java.RuntimeResourceOverlayInfoProvider); ok {
+ apkCerts = append(apkCerts, formatLine(info.Certificate, info.OutputFile.Base(), partition))
+ }
+ }
+ slices.Sort(apkCerts) // sort by name
+ fsInfos := a.getFsInfos(ctx)
+ if fsInfos["system"].HasFsverity {
+ defaultPem, defaultKey := ctx.Config().DefaultAppCertificate(ctx)
+ apkCerts = append(apkCerts, formatLine(java.Certificate{Pem: defaultPem, Key: defaultKey}, "BuildManifest.apk", "system"))
+ if info, ok := fsInfos["system_ext"]; ok && info.HasFsverity {
+ apkCerts = append(apkCerts, formatLine(java.Certificate{Pem: defaultPem, Key: defaultKey}, "BuildManifestSystemExt.apk", "system_ext"))
+ }
+ }
+
+ apkCertsInfo := android.PathForModuleOut(ctx, "apkcerts.txt")
+ android.WriteFileRuleVerbatim(ctx, apkCertsInfo, strings.Join(apkCerts, "\n")+"\n")
+ return apkCertsInfo
+}
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index 35fdd00..8b3b51e 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -438,6 +438,8 @@
Owners []InstalledModuleInfo
UseAvb bool
+
+ HasFsverity bool
}
// FullInstallPathInfo contains information about the "full install" paths of all the files
@@ -683,6 +685,7 @@
FilesystemConfig: f.generateFilesystemConfig(ctx, rootDir, rebasedDir),
Owners: f.gatherOwners(specs),
UseAvb: proptools.Bool(f.properties.Use_avb),
+ HasFsverity: f.properties.Fsverity.Inputs.GetOrDefault(ctx, nil) != nil,
}
android.SetProvider(ctx, FilesystemProvider, fsInfo)
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index 29d5e79..b73fb21 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -854,19 +854,29 @@
Product_config *string
Android_info *string
Licenses []string
+ Dist android.Dist
}{
Name: proptools.StringPtr(generatedModuleName(ctx.Config(), "vendor-build.prop")),
Vendor: proptools.BoolPtr(true),
Stem: proptools.StringPtr("build.prop"),
Product_config: proptools.StringPtr(":product_config"),
Android_info: proptools.StringPtr(":" + generatedModuleName(ctx.Config(), "android_info.prop")),
- Licenses: []string{"Android-Apache-2.0"},
+ Dist: android.Dist{
+ Targets: []string{"droidcore-unbundled"},
+ Dest: proptools.StringPtr("build.prop-vendor"),
+ },
+ Licenses: []string{"Android-Apache-2.0"},
}
vendorBuildProp := ctx.CreateModule(
android.BuildPropFactory,
vendorBuildProps,
)
- vendorBuildProp.HideFromMake()
+ // We don't want this to conflict with the make-built vendor build.prop, but unfortunately
+ // calling HideFromMake() prevents disting files, even in soong-only mode. So only call
+ // HideFromMake() on soong+make builds.
+ if ctx.Config().KatiEnabled() {
+ vendorBuildProp.HideFromMake()
+ }
}
func createRecoveryBuildProp(ctx android.LoadHookContext) string {
diff --git a/java/app.go b/java/app.go
index fe5eec3..65ccc68 100644
--- a/java/app.go
+++ b/java/app.go
@@ -2209,3 +2209,7 @@
appInfo.Certificate = m.Certificate()
appInfo.PrivAppAllowlist = m.PrivAppAllowlist()
}
+
+type AppInfos []AppInfo
+
+var AppInfosProvider = blueprint.NewProvider[AppInfos]()
diff --git a/phony/phony.go b/phony/phony.go
index 4f61c45..e75f4c8 100644
--- a/phony/phony.go
+++ b/phony/phony.go
@@ -104,8 +104,7 @@
android.ModuleBase
android.DefaultableModuleBase
- phonyDepsModuleNames []string
- properties PhonyProperties
+ properties PhonyProperties
}
type PhonyProperties struct {
@@ -126,18 +125,8 @@
}
func (p *PhonyRule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- p.phonyDepsModuleNames = p.properties.Phony_deps.GetOrDefault(ctx, nil)
-}
-
-func (p *PhonyRule) AndroidMk() android.AndroidMkData {
- return android.AndroidMkData{
- Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
- if len(p.phonyDepsModuleNames) > 0 {
- depModulesStr := strings.Join(p.phonyDepsModuleNames, " ")
- fmt.Fprintln(w, ".PHONY:", name)
- fmt.Fprintln(w, name, ":", depModulesStr)
- }
- },
+ for _, dep := range p.properties.Phony_deps.GetOrDefault(ctx, nil) {
+ ctx.Phony(ctx.ModuleName(), android.PathForPhony(ctx, dep))
}
}