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

Commit 07931c73 authored by Jooyung Han's avatar Jooyung Han
Browse files

apex: pass init_rc/vintf_fragments to make

For "non-updatable" devices, apex_manifest.pb is a module representing
the apex, so we need to pass common properties like init_rc and
vintf_fragments to the Make module of apex_manifest.pb so that those
files are copied when the apex is installed as flattened.

Bug: 159211312
Bug: 167383491
Test: lunch aosp_sunfish-userdebug
      OVERRIDE_TARGET_FLATTEN_APEX=true m com.android.vibrator.sunfish
      check $OUT/vendor/etc for init_rc/vintf_fragmemts
Change-Id: I5d5ce5acb9b837da2fb4e6ee8f3813707c6c3bd4
parent c2c2d4e7
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -36,7 +36,9 @@ func (a *apexBundle) AndroidMk() android.AndroidMkData {
	return a.androidMkForType()
}

func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, moduleDir string) []string {
func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, moduleDir string,
	apexAndroidMkData android.AndroidMkData) []string {

	// apexBundleName comes from the 'name' property; apexName comes from 'apex_name' property.
	// An apex is installed to /system/apex/<apexBundleName> and is activated at /apex/<apexName>
	// In many cases, the two names are the same, but could be different in general.
@@ -236,6 +238,17 @@ func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, mo
			fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.Stem())
			if fi.builtFile == a.manifestPbOut && apexType == flattenedApex {
				if a.primaryApexType {
					// To install companion files (init_rc, vintf_fragments)
					// Copy some common properties of apexBundle to apex_manifest
					commonProperties := []string{
						"LOCAL_INIT_RC", "LOCAL_VINTF_FRAGMENTS",
					}
					for _, name := range commonProperties {
						if value, ok := apexAndroidMkData.Entries.EntryMap[name]; ok {
							fmt.Fprintln(w, name+" := "+strings.Join(value, " "))
						}
					}

					// Make apex_manifest.pb module for this APEX to override all other
					// modules in the APEXes being overridden by this APEX
					var patterns []string
@@ -294,7 +307,7 @@ func (a *apexBundle) androidMkForType() android.AndroidMkData {
			apexType := a.properties.ApexType
			if a.installable() {
				apexName := proptools.StringDefault(a.properties.Apex_name, name)
				moduleNames = a.androidMkForFiles(w, name, apexName, moduleDir)
				moduleNames = a.androidMkForFiles(w, name, apexName, moduleDir, data)
			}

			if apexType == flattenedApex {