Revert "Remove apex.apex_name"
This reverts commit df26332d50c9c156b13844b4dbbecb43df6e3e1c.
Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_tm-qpr-dev-plus-aosp&target=aosp_sunfish-userdebug&lkgb=9578804&lkbb=9579062&fkbb=9578931, bug b/268301897
Change-Id: I819a416286cda63a6fa8d3d6b4343c86638b4dc9
BUG: 268301897
diff --git a/apex/androidmk.go b/apex/androidmk.go
index 7f03621..f66ae16 100644
--- a/apex/androidmk.go
+++ b/apex/androidmk.go
@@ -24,6 +24,8 @@
"android/soong/cc"
"android/soong/java"
"android/soong/rust"
+
+ "github.com/google/blueprint/proptools"
)
func (a *apexBundle) AndroidMk() android.AndroidMkData {
@@ -72,15 +74,12 @@
return fi.androidMkModuleName + "." + apexBundleName + a.suffix
}
-func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, moduleDir string,
+func (a *apexBundle) androidMkForFiles(w io.Writer, apexBundleName, apexName, moduleDir string,
apexAndroidMkData android.AndroidMkData) []string {
- // apexBundleName comes from the 'name' property or soong module.
- // apexName comes from 'name' property of apex_manifest.
+ // 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.
- // However, symbol files for apex files are installed under /apex/<apexBundleName> to avoid
- // conflicts between two apexes with the same apexName.
moduleNames := []string{}
apexType := a.properties.ApexType
@@ -91,6 +90,11 @@
return moduleNames
}
+ // b/162366062. Prevent GKI APEXes to emit make rules to avoid conflicts.
+ if strings.HasPrefix(apexName, "com.android.gki.") && apexType != flattenedApex {
+ return moduleNames
+ }
+
seenDataOutPaths := make(map[string]bool)
for _, fi := range a.filesInfo {
@@ -127,15 +131,15 @@
if fi.module != nil && fi.module.Owner() != "" {
fmt.Fprintln(w, "LOCAL_MODULE_OWNER :=", fi.module.Owner())
}
- // /apex/<apexBundleName>/{lib|framework|...}
- pathForSymbol := filepath.Join("$(PRODUCT_OUT)", "apex", apexBundleName, fi.installDir)
+ // /apex/<apex_name>/{lib|framework|...}
+ pathWhenActivated := filepath.Join("$(PRODUCT_OUT)", "apex", apexName, fi.installDir)
var modulePath string
if apexType == flattenedApex {
- // /system/apex/<apexBundleName>/{lib|framework|...}
+ // /system/apex/<name>/{lib|framework|...}
modulePath = filepath.Join(a.installDir.String(), apexBundleName, fi.installDir)
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", modulePath)
if a.primaryApexType {
- fmt.Fprintln(w, "LOCAL_SOONG_SYMBOL_PATH :=", pathForSymbol)
+ fmt.Fprintln(w, "LOCAL_SOONG_SYMBOL_PATH :=", pathWhenActivated)
}
android.AndroidMkEmitAssignList(w, "LOCAL_MODULE_SYMLINKS", fi.symlinks)
newDataPaths := []android.DataPath{}
@@ -148,8 +152,8 @@
}
android.AndroidMkEmitAssignList(w, "LOCAL_TEST_DATA", android.AndroidMkDataPaths(newDataPaths))
} else {
- modulePath = pathForSymbol
- fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", modulePath)
+ modulePath = pathWhenActivated
+ fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", pathWhenActivated)
// For non-flattend APEXes, the merged notice file is attached to the APEX itself.
// We don't need to have notice file for the individual modules in it. Otherwise,
@@ -307,7 +311,8 @@
moduleNames := []string{}
apexType := a.properties.ApexType
if a.installable() {
- moduleNames = a.androidMkForFiles(w, name, moduleDir, data)
+ apexName := proptools.StringDefault(a.properties.Apex_name, name)
+ moduleNames = a.androidMkForFiles(w, name, apexName, moduleDir, data)
}
if apexType == flattenedApex {