From 8e42ca9426069d06cafc3246e15271eba996e9db Mon Sep 17 00:00:00 2001 From: Andrew LeCain Date: Wed, 14 Mar 2018 19:57:00 -0700 Subject: [PATCH] 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 --- dumpstate/DumpstateDevice.cpp | 7 +------ dumpstate/android.hardware.dumpstate@1.0-service.wahoo.rc | 3 +++ sepolicy/vendor/file.te | 1 + sepolicy/vendor/genfs_contexts | 1 + sepolicy/vendor/hal_dumpstate_impl.te | 2 ++ 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 363f3343..7c9a0dea 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -261,12 +261,7 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle& handle) { 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 39a96184..bfd76177 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 @@ service vendor.dumpstate-1-0 /vendor/bin/hw/android.hardware.dumpstate@1.0-servi 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 b73cef69..cc99f23f 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -32,6 +32,7 @@ type debugfs_mdp, debugfs_type, fs_type; 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 fa5a27c0..fa561efb 100644 --- a/sepolicy/vendor/genfs_contexts +++ b/sepolicy/vendor/genfs_contexts @@ -98,3 +98,4 @@ genfscon debugfs /icnss u:object_r:debugfs_icnss:s 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 bcfc2673..8a60bfa5 100644 --- a/sepolicy/vendor/hal_dumpstate_impl.te +++ b/sepolicy/vendor/hal_dumpstate_impl.te @@ -19,6 +19,8 @@ userdebug_or_eng(` 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;