Add WiFi Statistics to Bugreport to marlin

This commit adds some statistics from debugfs to bugreport
this includes the files:
/d/wlan_wcnss/power_stats
/d/cnss_runtime_pm
/d/cnss-prealloc/status

Bug: 62290986
Test: adb bugreport and inspect the required statistics

Merged-In: I1fcb499c11890df07e1193ce3c4a82f92e8be2ec

Change-Id: Ia7ac961e6ca6bdd1a98ce6090e4e32e28788d0fe
Signed-off-by: Ahmed ElArabawy <arabawy@google.com>
diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp
index daf27d2..445e777 100755
--- a/dumpstate/DumpstateDevice.cpp
+++ b/dumpstate/DumpstateDevice.cpp
@@ -109,8 +109,13 @@
     DumpFileToFd(fd, "CPU present", "/sys/devices/system/cpu/present");
     DumpFileToFd(fd, "CPU online", "/sys/devices/system/cpu/online");
     DumpFileToFd(fd, "INTERRUPTS", "/proc/interrupts");
+
     DumpFileToFd(fd, "RPM Stats", "/d/rpm_stats");
     DumpFileToFd(fd, "Power Management Stats", "/d/rpm_master_stats");
+    DumpFileToFd(fd, "WLAN Power Stats", "/d/wlan_wcnss/power_stats");
+    DumpFileToFd(fd, "Runtime-PM Stats", "/d/cnss_runtime_pm");
+    DumpFileToFd(fd, "CNSS Pre-Alloc", "/d/cnss-prealloc/status");
+
     DumpFileToFd(fd, "SMD Log", "/d/ipc_logging/smd/log");
     RunCommandToFd(fd, "ION HEAPS", {"/vendor/bin/sh", "-c", "for d in $(ls -d /d/ion/*); do for f in $(ls $d); do echo --- $d/$f; cat $d/$f; done; done"});
     DumpFileToFd(fd, "dmabuf info", "/d/dma_buf/bufinfo");
diff --git a/sepolicy/file.te b/sepolicy/file.te
index 7a0f562..5488640 100644
--- a/sepolicy/file.te
+++ b/sepolicy/file.te
@@ -49,6 +49,9 @@
 type debugfs_ion, debugfs_type, fs_type;
 type debugfs_qsee_log, debugfs_type, fs_type;
 type debugfs_usb, debugfs_type, fs_type;
+type debugfs_wlan, debugfs_type, fs_type;
+type debugfs_runtime_pm, debugfs_type, fs_type;
+type debugfs_cnss, debugfs_type, fs_type;
 
 # /proc
 type proc_kernel_sched, fs_type;
diff --git a/sepolicy/genfs_contexts b/sepolicy/genfs_contexts
index 6b896df..a0743dc 100644
--- a/sepolicy/genfs_contexts
+++ b/sepolicy/genfs_contexts
@@ -12,4 +12,8 @@
 genfscon proc /debug/fwdump                           u:object_r:proc_wifi_dbg:s0
 genfscon proc /debugdriver/driverdump                 u:object_r:proc_wifi_dbg:s0
 
+# debugfs
 genfscon debugfs /kgsl/proc                           u:object_r:debugfs_kgsl:s0
+genfscon debugfs /cnss_runtime_pm                     u:object_r:debugfs_runtime_pm:s0
+genfscon debugfs /cnss-prealloc/status                u:object_r:debugfs_cnss:s0
+genfscon debugfs /wlan_wcnss                          u:object_r:debugfs_wlan:s0
\ No newline at end of file
diff --git a/sepolicy/hal_dumpstate_impl.te b/sepolicy/hal_dumpstate_impl.te
index b8dbc9b..08f6d2a 100644
--- a/sepolicy/hal_dumpstate_impl.te
+++ b/sepolicy/hal_dumpstate_impl.te
@@ -31,6 +31,13 @@
 # rpm stat
 allow hal_dumpstate_impl debugfs_rpm:file r_file_perms;
 allow hal_dumpstate_impl debugfs_bufinfo:file r_file_perms;
+# wlan power stats
+allow hal_dumpstate_impl debugfs_wlan:dir r_dir_perms;
+allow hal_dumpstate_impl debugfs_wlan:file r_file_perms;
+# runtime-pm
+allow hal_dumpstate_impl debugfs_runtime_pm:file r_file_perms;
+# cnss
+allow hal_dumpstate_impl debugfs_cnss:file r_file_perms;
 # qsee_logger
 allow hal_dumpstate_impl qsee_logger_exec:file rx_file_perms;
 allow hal_dumpstate_impl debugfs_qsee_log:file r_file_perms;
diff --git a/sepolicy/hal_wifi.te b/sepolicy/hal_wifi.te
index bd7ebc1..1983a95 100644
--- a/sepolicy/hal_wifi.te
+++ b/sepolicy/hal_wifi.te
@@ -8,3 +8,10 @@
 
 # Allow wifi hal to read debug info from the driver.
 r_dir_file(hal_wifi, proc_wifi_dbg)
+
+userdebug_or_eng(`
+# debugfs entries are only needed in user-debug or eng builds
+
+# Allow wifi hal to access wlan debugfs files and directories
+allow hal_wifi debugfs_wlan:dir r_dir_perms;
+')