Vendor apexes can be "updatable: true"
Vendor APEXes can be updatable unless it sets "use_vndk_as_stable:true". When "updatable:true", it should meet the "updatable" requirements like "should set min_sdk_version". Bug: 274396342 Bug: 274041915 Test: m nothing (soong tests) Change-Id: I746d8941c21e883c1eba3e1f1e5a414a67db071a
This commit is contained in:
@@ -3025,8 +3025,8 @@ func (a *apexBundle) checkUpdatable(ctx android.ModuleContext) {
|
|||||||
if a.UsePlatformApis() {
|
if a.UsePlatformApis() {
|
||||||
ctx.PropertyErrorf("updatable", "updatable APEXes can't use platform APIs")
|
ctx.PropertyErrorf("updatable", "updatable APEXes can't use platform APIs")
|
||||||
}
|
}
|
||||||
if a.SocSpecific() || a.DeviceSpecific() {
|
if proptools.Bool(a.properties.Use_vndk_as_stable) {
|
||||||
ctx.PropertyErrorf("updatable", "vendor APEXes are not updatable")
|
ctx.PropertyErrorf("use_vndk_as_stable", "updatable APEXes can't use external VNDK libs")
|
||||||
}
|
}
|
||||||
if a.FutureUpdatable() {
|
if a.FutureUpdatable() {
|
||||||
ctx.PropertyErrorf("future_updatable", "Already updatable. Remove `future_updatable: true:`")
|
ctx.PropertyErrorf("future_updatable", "Already updatable. Remove `future_updatable: true:`")
|
||||||
|
@@ -1927,13 +1927,13 @@ func TestApexMinSdkVersion_DefaultsToLatest(t *testing.T) {
|
|||||||
expectNoLink("libx", "shared_apex10000", "libz", "shared")
|
expectNoLink("libx", "shared_apex10000", "libz", "shared")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestApexMinSdkVersion_crtobjectInVendorApex(t *testing.T) {
|
func TestApexMinSdkVersion_InVendorApex(t *testing.T) {
|
||||||
ctx := testApex(t, `
|
ctx := testApex(t, `
|
||||||
apex {
|
apex {
|
||||||
name: "myapex",
|
name: "myapex",
|
||||||
key: "myapex.key",
|
key: "myapex.key",
|
||||||
native_shared_libs: ["mylib"],
|
native_shared_libs: ["mylib"],
|
||||||
updatable: false,
|
updatable: true,
|
||||||
vendor: true,
|
vendor: true,
|
||||||
min_sdk_version: "29",
|
min_sdk_version: "29",
|
||||||
}
|
}
|
||||||
@@ -1946,20 +1946,34 @@ func TestApexMinSdkVersion_crtobjectInVendorApex(t *testing.T) {
|
|||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
name: "mylib",
|
name: "mylib",
|
||||||
|
srcs: ["mylib.cpp"],
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
system_shared_libs: [],
|
|
||||||
stl: "none",
|
|
||||||
apex_available: [ "myapex" ],
|
|
||||||
min_sdk_version: "29",
|
min_sdk_version: "29",
|
||||||
|
shared_libs: ["libbar"],
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_library {
|
||||||
|
name: "libbar",
|
||||||
|
stubs: { versions: ["29", "30"] },
|
||||||
|
llndk: { symbol_file: "libbar.map.txt" },
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
vendorVariant := "android_vendor.29_arm64_armv8-a"
|
vendorVariant := "android_vendor.29_arm64_armv8-a"
|
||||||
|
|
||||||
// First check that the correct variant of crtbegin_so is used.
|
mylib := ctx.ModuleForTests("mylib", vendorVariant+"_shared_myapex")
|
||||||
ldRule := ctx.ModuleForTests("mylib", vendorVariant+"_shared_apex29").Rule("ld")
|
|
||||||
crtBegin := names(ldRule.Args["crtBegin"])
|
// Ensure that mylib links with "current" LLNDK
|
||||||
ensureListContains(t, crtBegin, "out/soong/.intermediates/"+cc.DefaultCcCommonTestModulesDir+"crtbegin_so/"+vendorVariant+"_apex29/crtbegin_so.o")
|
libFlags := names(mylib.Rule("ld").Args["libFlags"])
|
||||||
|
ensureListContains(t, libFlags, "out/soong/.intermediates/libbar/"+vendorVariant+"_shared_current/libbar.so")
|
||||||
|
|
||||||
|
// Ensure that mylib is targeting 29
|
||||||
|
ccRule := ctx.ModuleForTests("mylib", vendorVariant+"_static_apex29").Output("obj/mylib.o")
|
||||||
|
ensureContains(t, ccRule.Args["cFlags"], "-target aarch64-linux-android29")
|
||||||
|
|
||||||
|
// Ensure that the correct variant of crtbegin_so is used.
|
||||||
|
crtBegin := mylib.Rule("ld").Args["crtBegin"]
|
||||||
|
ensureContains(t, crtBegin, "out/soong/.intermediates/"+cc.DefaultCcCommonTestModulesDir+"crtbegin_so/"+vendorVariant+"_apex29/crtbegin_so.o")
|
||||||
|
|
||||||
// Ensure that the crtbegin_so used by the APEX is targeting 29
|
// Ensure that the crtbegin_so used by the APEX is targeting 29
|
||||||
cflags := ctx.ModuleForTests("crtbegin_so", vendorVariant+"_apex29").Rule("cc").Args["cFlags"]
|
cflags := ctx.ModuleForTests("crtbegin_so", vendorVariant+"_apex29").Rule("cc").Args["cFlags"]
|
||||||
@@ -7860,12 +7874,14 @@ func TestUpdatableDefault_should_set_min_sdk_version(t *testing.T) {
|
|||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUpdatable_cannot_be_vendor_apex(t *testing.T) {
|
func Test_use_vndk_as_stable_shouldnt_be_used_for_updatable_vendor_apexes(t *testing.T) {
|
||||||
testApexError(t, `"myapex" .*: updatable: vendor APEXes are not updatable`, `
|
testApexError(t, `"myapex" .*: use_vndk_as_stable: updatable APEXes can't use external VNDK libs`, `
|
||||||
apex {
|
apex {
|
||||||
name: "myapex",
|
name: "myapex",
|
||||||
key: "myapex.key",
|
key: "myapex.key",
|
||||||
updatable: true,
|
updatable: true,
|
||||||
|
min_sdk_version: "current",
|
||||||
|
use_vndk_as_stable: true,
|
||||||
soc_specific: true,
|
soc_specific: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7877,6 +7893,23 @@ func TestUpdatable_cannot_be_vendor_apex(t *testing.T) {
|
|||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Test_use_vndk_as_stable_shouldnt_be_used_for_non_vendor_apexes(t *testing.T) {
|
||||||
|
testApexError(t, `"myapex" .*: use_vndk_as_stable: not supported for system/system_ext APEXes`, `
|
||||||
|
apex {
|
||||||
|
name: "myapex",
|
||||||
|
key: "myapex.key",
|
||||||
|
updatable: false,
|
||||||
|
use_vndk_as_stable: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
apex_key {
|
||||||
|
name: "myapex.key",
|
||||||
|
public_key: "testkey.avbpubkey",
|
||||||
|
private_key: "testkey.pem",
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
}
|
||||||
|
|
||||||
func TestUpdatable_should_not_set_generate_classpaths_proto(t *testing.T) {
|
func TestUpdatable_should_not_set_generate_classpaths_proto(t *testing.T) {
|
||||||
testApexError(t, `"mysystemserverclasspathfragment" .* it must not set generate_classpaths_proto to false`, `
|
testApexError(t, `"mysystemserverclasspathfragment" .* it must not set generate_classpaths_proto to false`, `
|
||||||
apex {
|
apex {
|
||||||
|
1
cc/cc.go
1
cc/cc.go
@@ -3861,6 +3861,7 @@ func (c *Module) UniqueApexVariations() bool {
|
|||||||
// When a vendor APEX needs a VNDK lib in it (use_vndk_as_stable: false), it should be a unique
|
// When a vendor APEX needs a VNDK lib in it (use_vndk_as_stable: false), it should be a unique
|
||||||
// APEX variation. Otherwise, another vendor APEX with use_vndk_as_stable:true may use a wrong
|
// APEX variation. Otherwise, another vendor APEX with use_vndk_as_stable:true may use a wrong
|
||||||
// variation of the VNDK lib because APEX variations are merged/grouped.
|
// variation of the VNDK lib because APEX variations are merged/grouped.
|
||||||
|
// TODO(b/274401041) Find a way to merge APEX variations for vendor apexes.
|
||||||
return c.UseVndk() && c.IsVndk()
|
return c.UseVndk() && c.IsVndk()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user