From 50c61752a8beaa5329b0ecc19b2c3733b14ffd2e Mon Sep 17 00:00:00 2001 From: Roopesh Nataraja Date: Mon, 24 Feb 2020 19:08:44 -0800 Subject: [PATCH] SystemConfig: Allow runtime differentiation of vendor configurations Single vendor can support multiple sku's with different capabilities. Add support to load capability xml's from below vendor locations. vendor/etc/sysconf/sku_${ro.boot.product.vendor.sku}/*.xml vendor/etc/permissions/sku_${ro.boot.product.vendor.sku}/*.xml Bug : 148582757 Test: Copy capability xml's to above mentioned vendor locations during compilation and check if it gets loaded by SystemConfig at runtime. Change-Id: Ic1a332d30224f6d26afdfc230ea7c1462aefa243 (cherry picked from commit 62e212521aadc0f7470843921c4f2fee828d60f1) Merged-In: Ic1a332d30224f6d26afdfc230ea7c1462aefa243 --- core/java/com/android/server/SystemConfig.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java index 3378c073eacea..d40924b603a58 100644 --- a/core/java/com/android/server/SystemConfig.java +++ b/core/java/com/android/server/SystemConfig.java @@ -82,6 +82,9 @@ public class SystemConfig { // property for runtime configuration differentiation private static final String SKU_PROPERTY = "ro.boot.product.hardware.sku"; + // property for runtime configuration differentiation in vendor + private static final String VENDOR_SKU_PROPERTY = "ro.boot.product.vendor.sku"; + // Group-ids that are given to all packages as read from etc/permissions/*.xml. int[] mGlobalGids; @@ -468,6 +471,17 @@ public class SystemConfig { readPermissions(Environment.buildPath( Environment.getVendorDirectory(), "etc", "permissions"), vendorPermissionFlag); + String vendorSkuProperty = SystemProperties.get(VENDOR_SKU_PROPERTY, ""); + if (!vendorSkuProperty.isEmpty()) { + String vendorSkuDir = "sku_" + vendorSkuProperty; + readPermissions(Environment.buildPath( + Environment.getVendorDirectory(), "etc", "sysconfig", vendorSkuDir), + vendorPermissionFlag); + readPermissions(Environment.buildPath( + Environment.getVendorDirectory(), "etc", "permissions", vendorSkuDir), + vendorPermissionFlag); + } + // Allow ODM to customize system configs as much as Vendor, because /odm is another // vendor partition other than /vendor. int odmPermissionFlag = vendorPermissionFlag;