Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62e21252 authored by Roopesh Nataraja's avatar Roopesh Nataraja
Browse files

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
parent a7fdceeb
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -76,6 +76,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;

@@ -381,6 +384,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;