Add qsee_log to dumpstate

Updating dumpstate to cat /d/tzdbg/qsee_log
Added debugfs_tzdbg selinux security context
Give hal_dumpstate_impl debugfs_tzdbg read permissions

Fixes: 74536221
Test: taimen: adb bugreport, qsee_log in dumpstate_device.txt

Change-Id: If80e665b789125d11a55d2812380aa4b906f10ab
diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp
index 363f334..7c9a0de 100755
--- a/dumpstate/DumpstateDevice.cpp
+++ b/dumpstate/DumpstateDevice.cpp
@@ -261,12 +261,7 @@
     DumpFileToFd(fd, "WLAN FW Log Symbol Table", "/vendor/firmware/Data.msc");
     DumpTouch(fd);
     RunCommandToFd(fd, "USB Device Descriptors", {"/vendor/bin/sh", "-c", "cd /sys/bus/usb/devices/1-1 && cat product && cat bcdDevice; cat descriptors | od -t x1 -w16 -N96"});
-
-    /* Check if qsee_logger tool exists */
-    if (!access("/vendor/bin/qsee_logger", X_OK)) {
-      RunCommandToFd(fd, "FP LOGS", {"qsee_logger", "-d"});
-    }
-
+    RunCommandToFd(fd, "QSEE logs", {"/vendor/bin/sh", "-c", "cat /d/tzdbg/qsee_log"});
     DumpFileToFd(fd, "Battery type", "/sys/class/power_supply/bms/battery_type");
 
     RunCommandToFd(fd, "Battery cycle count", {"/vendor/bin/sh", "-c", "for f in 1 2 3 4 5 6 7 8 ; do echo $f > /sys/class/power_supply/bms/cycle_count_id; count=`cat /sys/class/power_supply/bms/cycle_count`; echo \"$f: $count\"; done"});
diff --git a/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc b/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc
index 39a9618..bfd7617 100644
--- a/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc
+++ b/dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc
@@ -2,3 +2,6 @@
     class hal
     user system
     group system
+
+on boot
+    chmod 0444 /sys/kernel/debug/tzdbg/qsee_log
diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te
index b73cef6..cc99f23 100644
--- a/sepolicy/vendor/file.te
+++ b/sepolicy/vendor/file.te
@@ -32,6 +32,7 @@
 type debugfs_icnss, debugfs_type, fs_type;
 type debugfs_ufs, debugfs_type, fs_type;
 type debugfs_dma_bufinfo, debugfs_type, fs_type;
+type debugfs_tzdbg, debugfs_type, fs_type;
 
 # /proc
 type proc_wifi_dbg, fs_type;
diff --git a/sepolicy/vendor/genfs_contexts b/sepolicy/vendor/genfs_contexts
index fa5a27c..fa561ef 100644
--- a/sepolicy/vendor/genfs_contexts
+++ b/sepolicy/vendor/genfs_contexts
@@ -98,3 +98,4 @@
 genfscon debugfs /ufshcd0                             u:object_r:debugfs_ufs:s0
 
 genfscon debugfs /dma_buf/bufinfo                     u:object_r:debugfs_dma_bufinfo:s0
+genfscon debugfs /tzdbg	                              u:object_r:debugfs_tzdbg:s0
diff --git a/sepolicy/vendor/hal_dumpstate_impl.te b/sepolicy/vendor/hal_dumpstate_impl.te
index bcfc267..8a60bfa 100644
--- a/sepolicy/vendor/hal_dumpstate_impl.te
+++ b/sepolicy/vendor/hal_dumpstate_impl.te
@@ -19,6 +19,8 @@
   allow hal_dumpstate_impl netmgr_data_file:file r_file_perms;
   allow hal_dumpstate_impl debugfs_ipc:dir r_dir_perms;
   allow hal_dumpstate_impl debugfs_ipc:file r_file_perms;
+  allow hal_dumpstate_impl debugfs_tzdbg:dir search;
+  allow hal_dumpstate_impl debugfs_tzdbg:file r_file_perms;
   allow hal_dumpstate_impl sysfs_usb_device:dir r_dir_perms;
   allow hal_dumpstate_impl sysfs_usb_device:file r_file_perms;
   allow hal_dumpstate_impl sysfs_msm_subsys:file write;