Use sysprop stub regarding to the install location
Rather than the owner of sysprop, the install location is important when choosing a stub for sysprop_library. Bug: 171170584 Test: soong test Change-Id: Iba934d14dd235bd85d0bd631ef6bad83c1b4f551
This commit is contained in:
@@ -404,13 +404,21 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
|
|||||||
// ctx's Platform or Specific functions represent where this sysprop_library installed.
|
// ctx's Platform or Specific functions represent where this sysprop_library installed.
|
||||||
installedInSystem := ctx.Platform() || ctx.SystemExtSpecific()
|
installedInSystem := ctx.Platform() || ctx.SystemExtSpecific()
|
||||||
installedInVendorOrOdm := ctx.SocSpecific() || ctx.DeviceSpecific()
|
installedInVendorOrOdm := ctx.SocSpecific() || ctx.DeviceSpecific()
|
||||||
|
installedInProduct := ctx.ProductSpecific()
|
||||||
isOwnerPlatform := false
|
isOwnerPlatform := false
|
||||||
stub := "sysprop-library-stub-"
|
var stub string
|
||||||
|
|
||||||
|
if installedInVendorOrOdm {
|
||||||
|
stub = "sysprop-library-stub-vendor"
|
||||||
|
} else if installedInProduct {
|
||||||
|
stub = "sysprop-library-stub-product"
|
||||||
|
} else {
|
||||||
|
stub = "sysprop-library-stub-platform"
|
||||||
|
}
|
||||||
|
|
||||||
switch m.Owner() {
|
switch m.Owner() {
|
||||||
case "Platform":
|
case "Platform":
|
||||||
// Every partition can access platform-defined properties
|
// Every partition can access platform-defined properties
|
||||||
stub += "platform"
|
|
||||||
isOwnerPlatform = true
|
isOwnerPlatform = true
|
||||||
case "Vendor":
|
case "Vendor":
|
||||||
// System can't access vendor's properties
|
// System can't access vendor's properties
|
||||||
@@ -418,14 +426,12 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
|
|||||||
ctx.ModuleErrorf("None of soc_specific, device_specific, product_specific is true. " +
|
ctx.ModuleErrorf("None of soc_specific, device_specific, product_specific is true. " +
|
||||||
"System can't access sysprop_library owned by Vendor")
|
"System can't access sysprop_library owned by Vendor")
|
||||||
}
|
}
|
||||||
stub += "vendor"
|
|
||||||
case "Odm":
|
case "Odm":
|
||||||
// Only vendor can access Odm-defined properties
|
// Only vendor can access Odm-defined properties
|
||||||
if !installedInVendorOrOdm {
|
if !installedInVendorOrOdm {
|
||||||
ctx.ModuleErrorf("Neither soc_speicifc nor device_specific is true. " +
|
ctx.ModuleErrorf("Neither soc_speicifc nor device_specific is true. " +
|
||||||
"Odm-defined properties should be accessed only in Vendor or Odm")
|
"Odm-defined properties should be accessed only in Vendor or Odm")
|
||||||
}
|
}
|
||||||
stub += "vendor"
|
|
||||||
default:
|
default:
|
||||||
ctx.PropertyErrorf("property_owner",
|
ctx.PropertyErrorf("property_owner",
|
||||||
"Unknown value %s: must be one of Platform, Vendor or Odm", m.Owner())
|
"Unknown value %s: must be one of Platform, Vendor or Odm", m.Owner())
|
||||||
|
@@ -103,6 +103,8 @@ func testConfig(env map[string]string, bp string, fs map[string][]byte) android.
|
|||||||
"api/sysprop-platform-on-product-latest.txt": nil,
|
"api/sysprop-platform-on-product-latest.txt": nil,
|
||||||
"api/sysprop-vendor-current.txt": nil,
|
"api/sysprop-vendor-current.txt": nil,
|
||||||
"api/sysprop-vendor-latest.txt": nil,
|
"api/sysprop-vendor-latest.txt": nil,
|
||||||
|
"api/sysprop-vendor-on-product-current.txt": nil,
|
||||||
|
"api/sysprop-vendor-on-product-latest.txt": nil,
|
||||||
"api/sysprop-odm-current.txt": nil,
|
"api/sysprop-odm-current.txt": nil,
|
||||||
"api/sysprop-odm-latest.txt": nil,
|
"api/sysprop-odm-latest.txt": nil,
|
||||||
"framework/aidl/a.aidl": nil,
|
"framework/aidl/a.aidl": nil,
|
||||||
@@ -182,8 +184,15 @@ func TestSyspropLibrary(t *testing.T) {
|
|||||||
srcs: ["com/android/VendorProperties.sysprop"],
|
srcs: ["com/android/VendorProperties.sysprop"],
|
||||||
api_packages: ["com.android"],
|
api_packages: ["com.android"],
|
||||||
property_owner: "Vendor",
|
property_owner: "Vendor",
|
||||||
|
vendor: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
sysprop_library {
|
||||||
|
name: "sysprop-vendor-on-product",
|
||||||
|
srcs: ["com/android/VendorProperties.sysprop"],
|
||||||
|
api_packages: ["com.android"],
|
||||||
|
property_owner: "Vendor",
|
||||||
product_specific: true,
|
product_specific: true,
|
||||||
vendor_available: true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sysprop_library {
|
sysprop_library {
|
||||||
@@ -213,7 +222,7 @@ func TestSyspropLibrary(t *testing.T) {
|
|||||||
srcs: ["c.java"],
|
srcs: ["c.java"],
|
||||||
sdk_version: "system_current",
|
sdk_version: "system_current",
|
||||||
product_specific: true,
|
product_specific: true,
|
||||||
libs: ["sysprop-platform", "sysprop-vendor"],
|
libs: ["sysprop-platform", "sysprop-vendor-on-product"],
|
||||||
}
|
}
|
||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
@@ -240,7 +249,7 @@ func TestSyspropLibrary(t *testing.T) {
|
|||||||
name: "cc-client-product",
|
name: "cc-client-product",
|
||||||
srcs: ["d.cpp"],
|
srcs: ["d.cpp"],
|
||||||
product_specific: true,
|
product_specific: true,
|
||||||
static_libs: ["sysprop-platform-on-product", "sysprop-vendor"],
|
static_libs: ["sysprop-platform-on-product", "sysprop-vendor-on-product"],
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_library {
|
cc_library {
|
||||||
@@ -290,6 +299,12 @@ func TestSyspropLibrary(t *testing.T) {
|
|||||||
soc_specific: true,
|
soc_specific: true,
|
||||||
sdk_version: "core_current",
|
sdk_version: "core_current",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java_library {
|
||||||
|
name: "sysprop-library-stub-product",
|
||||||
|
product_specific: true,
|
||||||
|
sdk_version: "core_current",
|
||||||
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
// Check for generated cc_library
|
// Check for generated cc_library
|
||||||
@@ -317,13 +332,14 @@ func TestSyspropLibrary(t *testing.T) {
|
|||||||
expectedApexAvailableOnLibrary, library.ApexProperties.Apex_available)
|
expectedApexAvailableOnLibrary, library.ApexProperties.Apex_available)
|
||||||
}
|
}
|
||||||
|
|
||||||
// core variant of vendor-owned sysprop_library is for product
|
// product variant of vendor-owned sysprop_library
|
||||||
ctx.ModuleForTests("libsysprop-vendor", variant)
|
ctx.ModuleForTests("libsysprop-vendor-on-product", variant)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.ModuleForTests("sysprop-platform", "android_common")
|
ctx.ModuleForTests("sysprop-platform", "android_common")
|
||||||
ctx.ModuleForTests("sysprop-platform_public", "android_common")
|
ctx.ModuleForTests("sysprop-platform_public", "android_common")
|
||||||
ctx.ModuleForTests("sysprop-vendor", "android_common")
|
ctx.ModuleForTests("sysprop-vendor", "android_common")
|
||||||
|
ctx.ModuleForTests("sysprop-vendor-on-product", "android_common")
|
||||||
|
|
||||||
// Check for exported includes
|
// Check for exported includes
|
||||||
coreVariant := "android_arm64_armv8-a_static"
|
coreVariant := "android_arm64_armv8-a_static"
|
||||||
@@ -336,7 +352,7 @@ func TestSyspropLibrary(t *testing.T) {
|
|||||||
platformOnProductPath := "libsysprop-platform-on-product/android_arm64_armv8-a_static/gen/sysprop/public/include"
|
platformOnProductPath := "libsysprop-platform-on-product/android_arm64_armv8-a_static/gen/sysprop/public/include"
|
||||||
|
|
||||||
vendorInternalPath := "libsysprop-vendor/android_vendor.VER_arm64_armv8-a_static/gen/sysprop/include"
|
vendorInternalPath := "libsysprop-vendor/android_vendor.VER_arm64_armv8-a_static/gen/sysprop/include"
|
||||||
vendorPublicPath := "libsysprop-vendor/android_arm64_armv8-a_static/gen/sysprop/public/include"
|
vendorPublicPath := "libsysprop-vendor-on-product/android_arm64_armv8-a_static/gen/sysprop/public/include"
|
||||||
|
|
||||||
platformClient := ctx.ModuleForTests("cc-client-platform", coreVariant)
|
platformClient := ctx.ModuleForTests("cc-client-platform", coreVariant)
|
||||||
platformFlags := platformClient.Rule("cc").Args["cFlags"]
|
platformFlags := platformClient.Rule("cc").Args["cFlags"]
|
||||||
|
Reference in New Issue
Block a user