From c8a931945da037aa69345eeb5291e1bfe40c5253 Mon Sep 17 00:00:00 2001 From: oxmc Date: Sat, 23 Aug 2025 02:50:04 -0700 Subject: [PATCH] Update src/dev/oxmc/configprovisioner/VendorConfig.java --- .../oxmc/configprovisioner/VendorConfig.java | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/dev/oxmc/configprovisioner/VendorConfig.java b/src/dev/oxmc/configprovisioner/VendorConfig.java index 8fece67..f8e44b7 100644 --- a/src/dev/oxmc/configprovisioner/VendorConfig.java +++ b/src/dev/oxmc/configprovisioner/VendorConfig.java @@ -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; }