diff options
author | Danny Lin <danny@kdrag0n.dev> | 2020-12-12 19:05:10 -0800 |
---|---|---|
committer | Danny Lin <danny@kdrag0n.dev> | 2020-12-12 19:05:10 -0800 |
commit | b13034a011b9cc08274c2bc4b90b8213d4293e97 (patch) | |
tree | 6e1be22e9dbff2147d9ff28f9c3466c91c5fb4bc | |
parent | 2e8d1254157701f4ba1aef7838e6bbc0fd3957dd (diff) |
SimpleDeviceConfig: Allow setting empty values
Some keys are meant to be set to an empty string.
-rw-r--r-- | src/org/protonaosp/deviceconfig/BootReceiver.java | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/org/protonaosp/deviceconfig/BootReceiver.java b/src/org/protonaosp/deviceconfig/BootReceiver.java index a2aca63..286b678 100644 --- a/src/org/protonaosp/deviceconfig/BootReceiver.java +++ b/src/org/protonaosp/deviceconfig/BootReceiver.java @@ -42,13 +42,17 @@ public class BootReceiver extends BroadcastReceiver { // Set current properties String[] rawProperties = context.getResources().getStringArray(configArray); for (String property : rawProperties) { + // Format: namespace/key=value String[] kv = property.split("="); String fullKey = kv[0]; - String[] nk = fullKey.split("/"); - - String namespace = nk[0]; - String key = nk[1]; - String value = kv[1]; + String[] nsKey = fullKey.split("/"); + + String namespace = nsKey[0]; + String key = nsKey[1]; + String value = ""; + if (kv.length > 1) { + value = kv[1]; + } DeviceConfig.setProperty(namespace, key, value, true); } |