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

Bug:175172404
Test: adb bugreport and check pass
Signed-off-by: Ted Lin <tedlin@google.com>
Change-Id: I73bf180dd81d8f826818dae2049ff6776e47ab4a
(cherry picked from commit 0d39421ad62d73c07f8d4ab7d76f6d696af0dc28)
diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp
index 1b1b222..6733400 100755
--- a/dumpstate/DumpstateDevice.cpp
+++ b/dumpstate/DumpstateDevice.cpp
@@ -456,6 +456,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 f351d47..f73cbb1 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