Fix symlinks to system libs for flattened apex
Symlinks to system libs should be created for flattened apex regardless
that it is primary or not.
For example, GSI installs non-primary flattened apexes as well. These
flattened (non-primary) apexes could be activated on non-updatable
devices.
Bug: 148195518
Test: GSI runs on P
Change-Id: I238b226473d923e03280b1b28dd0d5d1f77ae74a
diff --git a/apex/androidmk.go b/apex/androidmk.go
index f1194be..5fa5bf0 100644
--- a/apex/androidmk.go
+++ b/apex/androidmk.go
@@ -63,7 +63,6 @@
postInstallCommands = append(postInstallCommands, mkdirCmd, linkCmd)
}
}
- postInstallCommands = append(postInstallCommands, a.compatSymlinks...)
for _, fi := range a.filesInfo {
if cc, ok := fi.module.(*cc.Module); ok && cc.Properties.HideFromMake {
@@ -178,17 +177,22 @@
fmt.Fprintln(w, "include $(BUILD_SYSTEM)/soong_cc_prebuilt.mk")
} else {
fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", fi.builtFile.Base())
- if a.primaryApexType && fi.builtFile == a.manifestPbOut {
- // Make apex_manifest.pb module for this APEX to override all other
- // modules in the APEXes being overridden by this APEX
- var patterns []string
- for _, o := range a.overridableProperties.Overrides {
- patterns = append(patterns, "%."+o+a.suffix)
- }
- fmt.Fprintln(w, "LOCAL_OVERRIDES_MODULES :=", strings.Join(patterns, " "))
+ if fi.builtFile == a.manifestPbOut {
+ if a.primaryApexType {
+ // Make apex_manifest.pb module for this APEX to override all other
+ // modules in the APEXes being overridden by this APEX
+ var patterns []string
+ for _, o := range a.overridableProperties.Overrides {
+ patterns = append(patterns, "%."+o+a.suffix)
+ }
+ fmt.Fprintln(w, "LOCAL_OVERRIDES_MODULES :=", strings.Join(patterns, " "))
- if apexType == flattenedApex && len(postInstallCommands) > 0 {
- // For flattened apexes, compat symlinks are attached to apex_manifest.json which is guaranteed for every apex
+ if apexType == flattenedApex && len(a.compatSymlinks) > 0 {
+ // For flattened apexes, compat symlinks are attached to apex_manifest.json which is guaranteed for every apex
+ postInstallCommands = append(postInstallCommands, a.compatSymlinks...)
+ }
+ }
+ if len(postInstallCommands) > 0 {
fmt.Fprintln(w, "LOCAL_POST_INSTALL_CMD :=", strings.Join(postInstallCommands, " && "))
}
}