Merge "SystemConfig: allow reading sku specific props" am: 2a23450552
am: 79ad229599
Change-Id: Ic07a75a9e66a3d20579ef71b442d32db04fbeb28
diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java
index 45069ca..a07c96c 100644
--- a/core/java/com/android/server/SystemConfig.java
+++ b/core/java/com/android/server/SystemConfig.java
@@ -25,6 +25,7 @@
import android.os.Build;
import android.os.Environment;
import android.os.Process;
+import android.os.SystemProperties;
import android.os.storage.StorageManager;
import android.text.TextUtils;
import android.util.ArrayMap;
@@ -67,6 +68,9 @@
private static final int ALLOW_HIDDENAPI_WHITELISTING = 0x40;
private static final int ALLOW_ALL = ~0;
+ // property for runtime configuration differentiation
+ private static final String SKU_PROPERTY = "ro.boot.product.hardware.sku";
+
// Group-ids that are given to all packages as read from etc/permissions/*.xml.
int[] mGlobalGids;
@@ -312,6 +316,17 @@
readPermissions(Environment.buildPath(
Environment.getOdmDirectory(), "etc", "permissions"), odmPermissionFlag);
+ String skuProperty = SystemProperties.get(SKU_PROPERTY, "");
+ if (!skuProperty.isEmpty()) {
+ String skuDir = "sku_" + skuProperty;
+
+ readPermissions(Environment.buildPath(
+ Environment.getOdmDirectory(), "etc", "sysconfig", skuDir), odmPermissionFlag);
+ readPermissions(Environment.buildPath(
+ Environment.getOdmDirectory(), "etc", "permissions", skuDir),
+ odmPermissionFlag);
+ }
+
// Allow OEM to customize features and OEM permissions
int oemPermissionFlag = ALLOW_FEATURES | ALLOW_OEM_PERMISSIONS;
readPermissions(Environment.buildPath(
@@ -342,6 +357,10 @@
// Iterate over the files in the directory and scan .xml files
File platformFile = null;
for (File f : libraryDir.listFiles()) {
+ if (!f.isFile()) {
+ continue;
+ }
+
// We'll read platform.xml last
if (f.getPath().endsWith("etc/permissions/platform.xml")) {
platformFile = f;