dumpstate: Support dump TEMP-DEFEND/DWELL-DEFEND setting

Bug: 173149361
Test: adb bugreport and check pass
Signed-off-by: Ted Lin <tedlin@google.com>
Change-Id: I73bf180dd81d8f826818dae2049ff6776e47ab4a
diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp
index fe2e21c..758387a 100755
--- a/dumpstate/DumpstateDevice.cpp
+++ b/dumpstate/DumpstateDevice.cpp
@@ -585,6 +585,18 @@
     DumpFileToFd(fd, "Modem Stat", "/data/vendor/modem_stat/debug.txt");
     DumpFileToFd(fd, "Pixel trace", "/d/tracing/instances/pixel-trace/trace");
 
+    /* Battery Defend setting */
+    RunCommandToFd(
+        fd, "TEMP-DEFEND Config",
+        {"/vendor/bin/sh", "-c",
+         " cd /sys/devices/platform/soc/soc:google,charger; for f in `ls bd_*` ; do echo "
+         "\"$f: `cat $f`\" ; done"});
+    RunCommandToFd(
+        fd, "DWELL-DEFEND Config",
+        {"/vendor/bin/sh", "-c",
+         " cd /sys/devices/platform/soc/soc:google,charger; for f in `ls charge_s*` ; do echo "
+         "\"$f: `cat $f`\" ; done"});
+
     // Citadel info
     RunCommandToFd(fd, "Citadel VERSION", {"/vendor/bin/hw/citadel_updater", "-lv"});
     RunCommandToFd(fd, "Citadel STATS", {"/vendor/bin/hw/citadel_updater", "--stats"});
diff --git a/init.hardware.rc b/init.hardware.rc
index d75d9cf..ca45a83 100644
--- a/init.hardware.rc
+++ b/init.hardware.rc
@@ -145,6 +145,17 @@
     # Battery Defender
     chown system system /sys/devices/platform/soc/soc:google,charger/charge_stop_level
     chown system system /sys/devices/platform/soc/soc:google,charger/charge_start_level
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_drainto_soc
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_recharge_soc
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_recharge_voltage
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_abs_temp
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_soc
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_temp
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_resume_time
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_temp
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_time
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_trigger_voltage
+    chown system system /sys/devices/platform/soc/soc:google,charger/bd_temp_enable
 
 on late-init
     chown system system /sys/devices/virtual/thermal/tz-by-name/mb-therm-monitor/trip_point_0_temp