Update src/dev/oxmc/configprovisioner/VendorConfig.java
This commit is contained in:
@@ -58,31 +58,42 @@ public class VendorConfig {
|
||||
}
|
||||
|
||||
private static boolean getConfigBoolean(String key, boolean defaultValue) {
|
||||
// 1. Vendor file
|
||||
String value = getConfigValue(key);
|
||||
if (value != null) {
|
||||
Log.d(TAG, key + " loaded from vendor config: " + value);
|
||||
return "true".equalsIgnoreCase(value) || "1".equals(value);
|
||||
}
|
||||
|
||||
// Fallback to system properties if config file doesn't exist
|
||||
if (!hasVendorConfig()) {
|
||||
String propValue = android.os.SystemProperties.get("persist.configprovisioner." + key, "");
|
||||
if (!propValue.isEmpty()) {
|
||||
return "true".equalsIgnoreCase(propValue) || "1".equals(propValue);
|
||||
}
|
||||
// 2. System property (only if no vendor file)
|
||||
String propValue = android.os.SystemProperties.get("persist.configprovisioner." + key, "");
|
||||
if (!propValue.isEmpty()) {
|
||||
Log.d(TAG, key + " loaded from system property: " + propValue);
|
||||
return "true".equalsIgnoreCase(propValue) || "1".equals(propValue);
|
||||
}
|
||||
|
||||
// 3. Default
|
||||
Log.d(TAG, key + " using default: " + defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
private static String getConfigString(String key, String defaultValue) {
|
||||
// 1. Vendor file
|
||||
String value = getConfigValue(key);
|
||||
if (value != null) return value;
|
||||
|
||||
// Fallback to system properties if config file doesn't exist
|
||||
if (!hasVendorConfig()) {
|
||||
return android.os.SystemProperties.get("persist.configprovisioner." + key, defaultValue);
|
||||
if (value != null) {
|
||||
Log.d(TAG, key + " loaded from vendor config: " + value);
|
||||
return value;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user