SimpleDeviceConfig: Separate base and device configs
Some devices may want to add device-specific DeviceConfig values
overlayed in the device tree while retaining the base system configs
provided by the ROM.
diff --git a/res/values/config.xml b/res/values/config.xml
index cc02141..88ac362 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -15,5 +15,6 @@
limitations under the License.
-->
<resources>
- <string-array name="device_config" />
+ <string-array name="configs_base" />
+ <string-array name="configs_device" />
</resources>
diff --git a/src/org/protonaosp/deviceconfig/BootReceiver.java b/src/org/protonaosp/deviceconfig/BootReceiver.java
index 2be918a..a2aca63 100644
--- a/src/org/protonaosp/deviceconfig/BootReceiver.java
+++ b/src/org/protonaosp/deviceconfig/BootReceiver.java
@@ -29,13 +29,18 @@
public void onReceive(Context context, Intent intent) {
new Thread(() -> {
Log.i(TAG, "Updating device config at boot");
- updateConfig(context);
+ updateDefaultConfigs(context);
}).start();
}
- private void updateConfig(Context context) {
+ private void updateDefaultConfigs(Context context) {
+ updateConfig(context, R.array.configs_base);
+ updateConfig(context, R.array.configs_device);
+ }
+
+ private void updateConfig(Context context, int configArray) {
// Set current properties
- String[] rawProperties = context.getResources().getStringArray(R.array.device_config);
+ String[] rawProperties = context.getResources().getStringArray(configArray);
for (String property : rawProperties) {
String[] kv = property.split("=");
String fullKey = kv[0];