Install font module in recovery partition
Similar to the resource module, font.png file is installed conditionally
based on the dpi.
Test: mount soong generated recovery partition and diff with TARGET_RECOVERY_ROOT_OUT
Bug: 381888358
Change-Id: I4ccc8eb65d626c18d1166c67beaa6067b0dbad04
diff --git a/fsgen/fsgen_mutators.go b/fsgen/fsgen_mutators.go
index f0a54db..20e4c3e 100644
--- a/fsgen/fsgen_mutators.go
+++ b/fsgen/fsgen_mutators.go
@@ -164,6 +164,7 @@
// Add common resources `prebuilt_res` module as dep of recovery partition
(*fsGenState.fsDeps["recovery"])[fmt.Sprintf("recovery-resources-common-%s", getDpi(ctx))] = defaultDepCandidateProps(ctx.Config())
+ (*fsGenState.fsDeps["recovery"])[getRecoveryFontModuleName(ctx)] = defaultDepCandidateProps(ctx.Config())
return &fsGenState
}).(*FsGenState)
diff --git a/fsgen/util.go b/fsgen/util.go
index 3894c46..008f9fe 100644
--- a/fsgen/util.go
+++ b/fsgen/util.go
@@ -60,6 +60,15 @@
return recoveryDensity
}
+// Returns the name of the appropriate prebuilt module for installing font.png file.
+// https://cs.android.com/android/platform/superproject/main/+/main:build/make/core/Makefile;l=2536;drc=a6af369e71ded123734523ea640b97b70a557cb9
+func getRecoveryFontModuleName(ctx android.LoadHookContext) string {
+ if android.InList(getDpi(ctx), []string{"xxxhdpi", "xxhdpi", "xhdpi"}) {
+ return "recovery-fonts-18"
+ }
+ return "recovery-fonts-12"
+}
+
// Returns a new list of symlinks with prefix added to the dest directory for all symlinks
func symlinksWithNamePrefix(symlinks []filesystem.SymlinkDefinition, prefix string) []filesystem.SymlinkDefinition {
ret := make([]filesystem.SymlinkDefinition, len(symlinks))