Loading sysprop/sysprop_library.go +10 −4 Original line number Diff line number Diff line Loading @@ -404,13 +404,21 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) { // ctx's Platform or Specific functions represent where this sysprop_library installed. installedInSystem := ctx.Platform() || ctx.SystemExtSpecific() installedInVendorOrOdm := ctx.SocSpecific() || ctx.DeviceSpecific() installedInProduct := ctx.ProductSpecific() 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() { case "Platform": // Every partition can access platform-defined properties stub += "platform" isOwnerPlatform = true case "Vendor": // System can't access vendor's properties Loading @@ -418,14 +426,12 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) { ctx.ModuleErrorf("None of soc_specific, device_specific, product_specific is true. " + "System can't access sysprop_library owned by Vendor") } stub += "vendor" case "Odm": // Only vendor can access Odm-defined properties if !installedInVendorOrOdm { ctx.ModuleErrorf("Neither soc_speicifc nor device_specific is true. " + "Odm-defined properties should be accessed only in Vendor or Odm") } stub += "vendor" default: ctx.PropertyErrorf("property_owner", "Unknown value %s: must be one of Platform, Vendor or Odm", m.Owner()) Loading sysprop/sysprop_test.go +22 −6 Original line number Diff line number Diff line Loading @@ -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-vendor-current.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-latest.txt": nil, "framework/aidl/a.aidl": nil, Loading Loading @@ -182,8 +184,15 @@ func TestSyspropLibrary(t *testing.T) { srcs: ["com/android/VendorProperties.sysprop"], api_packages: ["com.android"], 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, vendor_available: true, } sysprop_library { Loading Loading @@ -213,7 +222,7 @@ func TestSyspropLibrary(t *testing.T) { srcs: ["c.java"], sdk_version: "system_current", product_specific: true, libs: ["sysprop-platform", "sysprop-vendor"], libs: ["sysprop-platform", "sysprop-vendor-on-product"], } java_library { Loading @@ -240,7 +249,7 @@ func TestSyspropLibrary(t *testing.T) { name: "cc-client-product", srcs: ["d.cpp"], product_specific: true, static_libs: ["sysprop-platform-on-product", "sysprop-vendor"], static_libs: ["sysprop-platform-on-product", "sysprop-vendor-on-product"], } cc_library { Loading Loading @@ -290,6 +299,12 @@ func TestSyspropLibrary(t *testing.T) { soc_specific: true, sdk_version: "core_current", } java_library { name: "sysprop-library-stub-product", product_specific: true, sdk_version: "core_current", } `) // Check for generated cc_library Loading Loading @@ -317,13 +332,14 @@ func TestSyspropLibrary(t *testing.T) { expectedApexAvailableOnLibrary, library.ApexProperties.Apex_available) } // core variant of vendor-owned sysprop_library is for product ctx.ModuleForTests("libsysprop-vendor", variant) // product variant of vendor-owned sysprop_library ctx.ModuleForTests("libsysprop-vendor-on-product", variant) } ctx.ModuleForTests("sysprop-platform", "android_common") ctx.ModuleForTests("sysprop-platform_public", "android_common") ctx.ModuleForTests("sysprop-vendor", "android_common") ctx.ModuleForTests("sysprop-vendor-on-product", "android_common") // Check for exported includes coreVariant := "android_arm64_armv8-a_static" Loading @@ -336,7 +352,7 @@ func TestSyspropLibrary(t *testing.T) { 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" 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) platformFlags := platformClient.Rule("cc").Args["cFlags"] Loading Loading
sysprop/sysprop_library.go +10 −4 Original line number Diff line number Diff line Loading @@ -404,13 +404,21 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) { // ctx's Platform or Specific functions represent where this sysprop_library installed. installedInSystem := ctx.Platform() || ctx.SystemExtSpecific() installedInVendorOrOdm := ctx.SocSpecific() || ctx.DeviceSpecific() installedInProduct := ctx.ProductSpecific() 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() { case "Platform": // Every partition can access platform-defined properties stub += "platform" isOwnerPlatform = true case "Vendor": // System can't access vendor's properties Loading @@ -418,14 +426,12 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) { ctx.ModuleErrorf("None of soc_specific, device_specific, product_specific is true. " + "System can't access sysprop_library owned by Vendor") } stub += "vendor" case "Odm": // Only vendor can access Odm-defined properties if !installedInVendorOrOdm { ctx.ModuleErrorf("Neither soc_speicifc nor device_specific is true. " + "Odm-defined properties should be accessed only in Vendor or Odm") } stub += "vendor" default: ctx.PropertyErrorf("property_owner", "Unknown value %s: must be one of Platform, Vendor or Odm", m.Owner()) Loading
sysprop/sysprop_test.go +22 −6 Original line number Diff line number Diff line Loading @@ -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-vendor-current.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-latest.txt": nil, "framework/aidl/a.aidl": nil, Loading Loading @@ -182,8 +184,15 @@ func TestSyspropLibrary(t *testing.T) { srcs: ["com/android/VendorProperties.sysprop"], api_packages: ["com.android"], 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, vendor_available: true, } sysprop_library { Loading Loading @@ -213,7 +222,7 @@ func TestSyspropLibrary(t *testing.T) { srcs: ["c.java"], sdk_version: "system_current", product_specific: true, libs: ["sysprop-platform", "sysprop-vendor"], libs: ["sysprop-platform", "sysprop-vendor-on-product"], } java_library { Loading @@ -240,7 +249,7 @@ func TestSyspropLibrary(t *testing.T) { name: "cc-client-product", srcs: ["d.cpp"], product_specific: true, static_libs: ["sysprop-platform-on-product", "sysprop-vendor"], static_libs: ["sysprop-platform-on-product", "sysprop-vendor-on-product"], } cc_library { Loading Loading @@ -290,6 +299,12 @@ func TestSyspropLibrary(t *testing.T) { soc_specific: true, sdk_version: "core_current", } java_library { name: "sysprop-library-stub-product", product_specific: true, sdk_version: "core_current", } `) // Check for generated cc_library Loading Loading @@ -317,13 +332,14 @@ func TestSyspropLibrary(t *testing.T) { expectedApexAvailableOnLibrary, library.ApexProperties.Apex_available) } // core variant of vendor-owned sysprop_library is for product ctx.ModuleForTests("libsysprop-vendor", variant) // product variant of vendor-owned sysprop_library ctx.ModuleForTests("libsysprop-vendor-on-product", variant) } ctx.ModuleForTests("sysprop-platform", "android_common") ctx.ModuleForTests("sysprop-platform_public", "android_common") ctx.ModuleForTests("sysprop-vendor", "android_common") ctx.ModuleForTests("sysprop-vendor-on-product", "android_common") // Check for exported includes coreVariant := "android_arm64_armv8-a_static" Loading @@ -336,7 +352,7 @@ func TestSyspropLibrary(t *testing.T) { 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" 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) platformFlags := platformClient.Rule("cc").Args["cFlags"] Loading