Merge "have a per-module switch to turn the symlinking optimizaiton off" am: eb9b9f23ec
am: 67a0970d4f
Change-Id: Ic867f4a1b7f4d3e59bc67c94f0bd6c423ae9d490
This commit is contained in:
11
apex/apex.go
11
apex/apex.go
@@ -1275,6 +1275,11 @@ type apexBundleProperties struct {
|
|||||||
Legacy_android10_support *bool
|
Legacy_android10_support *bool
|
||||||
|
|
||||||
IsCoverageVariant bool `blueprint:"mutated"`
|
IsCoverageVariant bool `blueprint:"mutated"`
|
||||||
|
|
||||||
|
// Whether this APEX is considered updatable or not. When set to true, this will enforce additional
|
||||||
|
// rules for making sure that the APEX is truely updatable. This will also disable the size optimizations
|
||||||
|
// like symlinking to the system libs. Default is false.
|
||||||
|
Updatable *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type apexTargetBundleProperties struct {
|
type apexTargetBundleProperties struct {
|
||||||
@@ -2309,6 +2314,12 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
a.installable() &&
|
a.installable() &&
|
||||||
!proptools.Bool(a.properties.Use_vendor)
|
!proptools.Bool(a.properties.Use_vendor)
|
||||||
|
|
||||||
|
// We don't need the optimization for updatable APEXes, as it might give false signal
|
||||||
|
// to the system health when the APEXes are still bundled (b/149805758)
|
||||||
|
if proptools.Bool(a.properties.Updatable) && a.properties.ApexType == imageApex {
|
||||||
|
a.linkToSystemLib = false
|
||||||
|
}
|
||||||
|
|
||||||
// prepare apex_manifest.json
|
// prepare apex_manifest.json
|
||||||
a.buildManifest(ctx, provideNativeLibs, requireNativeLibs)
|
a.buildManifest(ctx, provideNativeLibs, requireNativeLibs)
|
||||||
|
|
||||||
|
@@ -223,6 +223,7 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
|
|||||||
"apex_manifest.json": nil,
|
"apex_manifest.json": nil,
|
||||||
"AndroidManifest.xml": nil,
|
"AndroidManifest.xml": nil,
|
||||||
"system/sepolicy/apex/myapex-file_contexts": nil,
|
"system/sepolicy/apex/myapex-file_contexts": nil,
|
||||||
|
"system/sepolicy/apex/myapex.updatable-file_contexts": nil,
|
||||||
"system/sepolicy/apex/myapex2-file_contexts": nil,
|
"system/sepolicy/apex/myapex2-file_contexts": nil,
|
||||||
"system/sepolicy/apex/otherapex-file_contexts": nil,
|
"system/sepolicy/apex/otherapex-file_contexts": nil,
|
||||||
"system/sepolicy/apex/commonapex-file_contexts": nil,
|
"system/sepolicy/apex/commonapex-file_contexts": nil,
|
||||||
@@ -3640,6 +3641,14 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
|
|||||||
java_libs: ["myjar"],
|
java_libs: ["myjar"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apex {
|
||||||
|
name: "myapex.updatable",
|
||||||
|
key: "myapex.key",
|
||||||
|
native_shared_libs: ["mylib"],
|
||||||
|
java_libs: ["myjar"],
|
||||||
|
updatable: true,
|
||||||
|
}
|
||||||
|
|
||||||
apex_key {
|
apex_key {
|
||||||
name: "myapex.key",
|
name: "myapex.key",
|
||||||
public_key: "testkey.avbpubkey",
|
public_key: "testkey.avbpubkey",
|
||||||
@@ -3654,6 +3663,7 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
|
|||||||
stl: "none",
|
stl: "none",
|
||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
|
"myapex.updatable",
|
||||||
"//apex_available:platform",
|
"//apex_available:platform",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
@@ -3665,6 +3675,7 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
|
|||||||
stl: "none",
|
stl: "none",
|
||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
|
"myapex.updatable",
|
||||||
"//apex_available:platform",
|
"//apex_available:platform",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
@@ -3677,6 +3688,7 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
|
|||||||
libs: ["myotherjar"],
|
libs: ["myotherjar"],
|
||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
|
"myapex.updatable",
|
||||||
"//apex_available:platform",
|
"//apex_available:platform",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
@@ -3688,6 +3700,7 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
|
|||||||
system_modules: "none",
|
system_modules: "none",
|
||||||
apex_available: [
|
apex_available: [
|
||||||
"myapex",
|
"myapex",
|
||||||
|
"myapex.updatable",
|
||||||
"//apex_available:platform",
|
"//apex_available:platform",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
@@ -3717,17 +3730,30 @@ func TestSymlinksFromApexToSystem(t *testing.T) {
|
|||||||
t.Errorf("%q is not found", file)
|
t.Errorf("%q is not found", file)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For unbundled build, symlink shouldn't exist regardless of whether an APEX
|
||||||
|
// is updatable or not
|
||||||
ctx, _ := testApex(t, bp, withUnbundledBuild)
|
ctx, _ := testApex(t, bp, withUnbundledBuild)
|
||||||
files := getFiles(t, ctx, "myapex", "android_common_myapex_image")
|
files := getFiles(t, ctx, "myapex", "android_common_myapex_image")
|
||||||
ensureRealfileExists(t, files, "javalib/myjar.jar")
|
ensureRealfileExists(t, files, "javalib/myjar.jar")
|
||||||
ensureRealfileExists(t, files, "lib64/mylib.so")
|
ensureRealfileExists(t, files, "lib64/mylib.so")
|
||||||
ensureRealfileExists(t, files, "lib64/myotherlib.so")
|
ensureRealfileExists(t, files, "lib64/myotherlib.so")
|
||||||
|
|
||||||
|
files = getFiles(t, ctx, "myapex.updatable", "android_common_myapex.updatable_image")
|
||||||
|
ensureRealfileExists(t, files, "javalib/myjar.jar")
|
||||||
|
ensureRealfileExists(t, files, "lib64/mylib.so")
|
||||||
|
ensureRealfileExists(t, files, "lib64/myotherlib.so")
|
||||||
|
|
||||||
|
// For bundled build, symlink to the system for the non-updatable APEXes only
|
||||||
ctx, _ = testApex(t, bp)
|
ctx, _ = testApex(t, bp)
|
||||||
files = getFiles(t, ctx, "myapex", "android_common_myapex_image")
|
files = getFiles(t, ctx, "myapex", "android_common_myapex_image")
|
||||||
ensureRealfileExists(t, files, "javalib/myjar.jar")
|
ensureRealfileExists(t, files, "javalib/myjar.jar")
|
||||||
ensureRealfileExists(t, files, "lib64/mylib.so")
|
ensureRealfileExists(t, files, "lib64/mylib.so")
|
||||||
ensureSymlinkExists(t, files, "lib64/myotherlib.so") // this is symlink
|
ensureSymlinkExists(t, files, "lib64/myotherlib.so") // this is symlink
|
||||||
|
|
||||||
|
files = getFiles(t, ctx, "myapex.updatable", "android_common_myapex.updatable_image")
|
||||||
|
ensureRealfileExists(t, files, "javalib/myjar.jar")
|
||||||
|
ensureRealfileExists(t, files, "lib64/mylib.so")
|
||||||
|
ensureRealfileExists(t, files, "lib64/myotherlib.so") // this is a real file
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
|
Reference in New Issue
Block a user