Wifi hal - Firmware dump permissions

we are aiming to improve logging performance by having wifi hal
directly write to the flash.

Wifi hal need to be able to create, write, and delete files in
a directory. This will be restricted to userdebug and eng builds only.

Bug: 70170285
Test: compile, run on device
Change-Id: Id0cd317411f4c393d7529aa31b501046d7350edb
diff --git a/public/file.te b/public/file.te
index 339f57d..81bb1f1 100644
--- a/public/file.te
+++ b/public/file.te
@@ -163,6 +163,8 @@
 type anr_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
 # /data/tombstones - core dumps
 type tombstone_data_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
+# /data/vendor/tombstones/wifi - vendor wifi dumps
+type tombstone_wifi_data_file, file_type, data_file_type;
 # /data/app - user-installed apps
 type apk_data_file, file_type, data_file_type, core_data_file_type;
 type apk_tmp_file, file_type, data_file_type, core_data_file_type, mlstrustedobject;
diff --git a/public/hal_wifi.te b/public/hal_wifi.te
index ac8a0d9..b8693fb 100644
--- a/public/hal_wifi.te
+++ b/public/hal_wifi.te
@@ -23,3 +23,9 @@
 allow hal_wifi sysfs_wlan_fwpath:file { w_file_perms };
 # allow hal_wifi to access /proc/modules to check if Wi-Fi driver is loaded
 allow hal_wifi proc_modules:file { getattr open read };
+
+# allow hal_wifi to write into /data/vendor/tombstones/wifi
+userdebug_or_eng(`
+  allow hal_wifi_server tombstone_wifi_data_file:dir rw_dir_perms;
+  allow hal_wifi_server tombstone_wifi_data_file:file create_file_perms;
+')