Update src/dev/oxmc/configprovisioner/VendorConfig.java

This commit is contained in:
2025-08-23 02:50:04 -07:00
parent c7a1050353
commit c8a931945d

View File

@@ -58,31 +58,42 @@ public class VendorConfig {
} }
private static boolean getConfigBoolean(String key, boolean defaultValue) { private static boolean getConfigBoolean(String key, boolean defaultValue) {
// 1. Vendor file
String value = getConfigValue(key); String value = getConfigValue(key);
if (value != null) { if (value != null) {
Log.d(TAG, key + " loaded from vendor config: " + value);
return "true".equalsIgnoreCase(value) || "1".equals(value); return "true".equalsIgnoreCase(value) || "1".equals(value);
} }
// Fallback to system properties if config file doesn't exist // 2. System property (only if no vendor file)
if (!hasVendorConfig()) { String propValue = android.os.SystemProperties.get("persist.configprovisioner." + key, "");
String propValue = android.os.SystemProperties.get("persist.configprovisioner." + key, ""); if (!propValue.isEmpty()) {
if (!propValue.isEmpty()) { Log.d(TAG, key + " loaded from system property: " + propValue);
return "true".equalsIgnoreCase(propValue) || "1".equals(propValue); return "true".equalsIgnoreCase(propValue) || "1".equals(propValue);
}
} }
// 3. Default
Log.d(TAG, key + " using default: " + defaultValue);
return defaultValue; return defaultValue;
} }
private static String getConfigString(String key, String defaultValue) { private static String getConfigString(String key, String defaultValue) {
// 1. Vendor file
String value = getConfigValue(key); String value = getConfigValue(key);
if (value != null) return value; if (value != null) {
Log.d(TAG, key + " loaded from vendor config: " + value);
// Fallback to system properties if config file doesn't exist return value;
if (!hasVendorConfig()) {
return android.os.SystemProperties.get("persist.configprovisioner." + key, defaultValue);
} }
// 2. System property
String propValue = android.os.SystemProperties.get("persist.configprovisioner." + key, "");
if (!propValue.isEmpty()) {
Log.d(TAG, key + " loaded from system property: " + propValue);
return propValue;
}
// 3. Default
Log.d(TAG, key + " using default: " + defaultValue);
return defaultValue; return defaultValue;
} }