Add wakeup_events and logbuffer to dump_modem

Adding /dev/logbuffer_cpif and wakeup_events sysfs attribute
under cpif to the modem bugreport.

Test: Tested bugreport on P23
Bug: 278501642
Change-Id: Ic4fcc5d637a59245f966442294e180d19de27f00
Signed-off-by: Mahesh Kallelil <kallelil@google.com>
diff --git a/modem/dump_modem.sh b/modem/dump_modem.sh
index f9f7cf2..b3f4ed3 100644
--- a/modem/dump_modem.sh
+++ b/modem/dump_modem.sh
@@ -1,5 +1,8 @@
 #!/vendor/bin/sh
 
+WAKEUP_EVENTS_FILE=/sys/devices/platform/cpif/wakeup_events
+CPIF_LOGBUFFER=/dev/logbuffer_cpif
+
 echo "------ Modem Stat ------"
 cat /data/vendor/modem_stat/debug.txt
 
@@ -15,3 +18,16 @@
   cat $f
 done
 
+if [ -e $WAKEUP_EVENTS_FILE ]
+then
+  echo "\n------ Wakeup event counts ------"
+  echo $WAKEUP_EVENTS_FILE
+  cat $WAKEUP_EVENTS_FILE
+fi
+
+if [ -e $CPIF_LOGBUFFER ]
+then
+  echo "\n------ CPIF Logbuffer ------"
+  echo $CPIF_LOGBUFFER
+  cat $CPIF_LOGBUFFER
+fi
diff --git a/modem/sepolicy/dump_modem.te b/modem/sepolicy/dump_modem.te
index dc9b38d..87c38cb 100644
--- a/modem/sepolicy/dump_modem.te
+++ b/modem/sepolicy/dump_modem.te
@@ -8,3 +8,5 @@
 allow dump_modem vendor_rfsd_log_file:dir r_dir_perms;
 allow dump_modem vendor_rfsd_log_file:file r_file_perms;
 allow dump_modem vendor_toolbox_exec:file execute_no_trans;
+allow dump_modem sysfs_modem:file r_file_perms;
+allow dump_modem logbuffer_device:chr_file r_file_perms;
diff --git a/modem/sepolicy/file.te b/modem/sepolicy/file.te
new file mode 100644
index 0000000..383480d
--- /dev/null
+++ b/modem/sepolicy/file.te
@@ -0,0 +1 @@
+type sysfs_dump_modem, sysfs_type, fs_type;
diff --git a/modem/sepolicy/genfs_contexts b/modem/sepolicy/genfs_contexts
new file mode 100644
index 0000000..bae95cc
--- /dev/null
+++ b/modem/sepolicy/genfs_contexts
@@ -0,0 +1 @@
+genfscon sysfs /devices/platform/cpif/wakeup_events u:object_r:sysfs_dump_modem:s0