Merge changes from topic "touch_dumpstate_priority" into main

* changes:
  dumpstate: touch: Add touch_predump for focaltech
  dumpstate: touch: Add touch_predump for stm
diff --git a/touch/focaltech/Android.bp b/touch/focaltech/Android.bp
index ebaa308..0b53132 100644
--- a/touch/focaltech/Android.bp
+++ b/touch/focaltech/Android.bp
@@ -9,3 +9,11 @@
     vendor: true,
     sub_dir: "dump",
 }
+
+sh_binary {
+    name: "predump_focaltech.sh",
+    src: "dump_focaltech.sh",
+    init_rc: ["init.touch.rc"],
+    vendor: true,
+    sub_dir: "dump_touch",
+}
diff --git a/touch/focaltech/predump_focaltech.mk b/touch/focaltech/predump_focaltech.mk
new file mode 100644
index 0000000..aff76bc
--- /dev/null
+++ b/touch/focaltech/predump_focaltech.mk
@@ -0,0 +1,3 @@
+BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/touch/focaltech/predump_sepolicy
+
+PRODUCT_PACKAGES += predump_focaltech.sh
diff --git a/touch/focaltech/predump_sepolicy/file.te b/touch/focaltech/predump_sepolicy/file.te
new file mode 100644
index 0000000..696f244
--- /dev/null
+++ b/touch/focaltech/predump_sepolicy/file.te
@@ -0,0 +1,2 @@
+# touch predump script
+type proc_touch, proc_type, fs_type;
diff --git a/touch/focaltech/predump_sepolicy/file_contexts b/touch/focaltech/predump_sepolicy/file_contexts
new file mode 100644
index 0000000..517895b
--- /dev/null
+++ b/touch/focaltech/predump_sepolicy/file_contexts
@@ -0,0 +1,2 @@
+/vendor/bin/dump/predump_focaltech\.sh      u:object_r:predump_touch_exec:s0
+
diff --git a/touch/focaltech/predump_sepolicy/genfs_contexts b/touch/focaltech/predump_sepolicy/genfs_contexts
new file mode 100644
index 0000000..2ac9314
--- /dev/null
+++ b/touch/focaltech/predump_sepolicy/genfs_contexts
@@ -0,0 +1,3 @@
+genfscon proc  /focaltech_touch                                                u:object_r:proc_touch:s0
+
+
diff --git a/touch/focaltech/predump_sepolicy/predump_touch.te b/touch/focaltech/predump_sepolicy/predump_touch.te
new file mode 100644
index 0000000..c34ba49
--- /dev/null
+++ b/touch/focaltech/predump_sepolicy/predump_touch.te
@@ -0,0 +1,3 @@
+# touch predump script
+allow predump_touch proc_touch:dir search;
+allow predump_touch proc_touch:file rw_file_perms;
diff --git a/touch/stm/Android.bp b/touch/stm/Android.bp
index 1727f07..0d64fd6 100644
--- a/touch/stm/Android.bp
+++ b/touch/stm/Android.bp
@@ -8,3 +8,10 @@
     vendor: true,
     sub_dir: "dump",
 }
+
+sh_binary {
+    name: "predump_stm.sh",
+    src: "dump_stm.sh",
+    vendor: true,
+    sub_dir: "dump_touch",
+}
diff --git a/touch/stm/predump_sepolicy/file.te b/touch/stm/predump_sepolicy/file.te
new file mode 100644
index 0000000..7f298c3
--- /dev/null
+++ b/touch/stm/predump_sepolicy/file.te
@@ -0,0 +1,3 @@
+# touch predump script
+type proc_touch, proc_type, fs_type;
+type sysfs_touch, sysfs_type, fs_type;
diff --git a/touch/stm/predump_sepolicy/file_contexts b/touch/stm/predump_sepolicy/file_contexts
new file mode 100644
index 0000000..2667543
--- /dev/null
+++ b/touch/stm/predump_sepolicy/file_contexts
@@ -0,0 +1,2 @@
+/vendor/bin/dump_touch/predump_stm\.sh      u:object_r:predump_touch_exec:s0
+
diff --git a/touch/stm/predump_sepolicy/genfs_contexts b/touch/stm/predump_sepolicy/genfs_contexts
new file mode 100644
index 0000000..2ed8978
--- /dev/null
+++ b/touch/stm/predump_sepolicy/genfs_contexts
@@ -0,0 +1,7 @@
+genfscon sysfs /devices/platform/111d0000.spi/spi_master/spi20/spi20.0  u:object_r:sysfs_touch:s0
+genfscon sysfs /devices/platform/10d40000.spi/spi_master/spi11/spi11.0  u:object_r:sysfs_touch:s0
+genfscon sysfs /devices/platform/10950000.spi/spi_master/spi6/spi6.0    u:object_r:sysfs_touch:s0
+
+genfscon proc  /fts/driver_test                                         u:object_r:proc_touch:s0
+genfscon proc  /fts_ext/driver_test                                     u:object_r:proc_touch:s0
+
diff --git a/touch/stm/predump_sepolicy/predump_touch.te b/touch/stm/predump_sepolicy/predump_touch.te
new file mode 100644
index 0000000..f0f458c
--- /dev/null
+++ b/touch/stm/predump_sepolicy/predump_touch.te
@@ -0,0 +1,6 @@
+# touch predump script
+allow predump_touch proc_touch:file rw_file_perms;
+allow predump_touch sysfs_touch:dir search;
+allow predump_touch sysfs_touch:file rw_file_perms;
+
+get_prop(predump_touch vendor_touch_dump_path_prop)
diff --git a/touch/stm/predump_sepolicy/property.te b/touch/stm/predump_sepolicy/property.te
new file mode 100644
index 0000000..612c855
--- /dev/null
+++ b/touch/stm/predump_sepolicy/property.te
@@ -0,0 +1,2 @@
+# touch predump script
+vendor_internal_prop(vendor_touch_dump_path_prop)
diff --git a/touch/stm/predump_sepolicy/property_contexts b/touch/stm/predump_sepolicy/property_contexts
new file mode 100644
index 0000000..db9fd5a
--- /dev/null
+++ b/touch/stm/predump_sepolicy/property_contexts
@@ -0,0 +1,2 @@
+ro.vendor.touch.dump. u:object_r:vendor_touch_dump_path_prop:s0
+
diff --git a/touch/stm/predump_sepolicy/vendor_init.te b/touch/stm/predump_sepolicy/vendor_init.te
new file mode 100644
index 0000000..9017c5b
--- /dev/null
+++ b/touch/stm/predump_sepolicy/vendor_init.te
@@ -0,0 +1,2 @@
+# touch predump script
+set_prop(vendor_init, vendor_touch_dump_path_prop)
diff --git a/touch/stm/predump_stm20.mk b/touch/stm/predump_stm20.mk
new file mode 100644
index 0000000..cdf3e35
--- /dev/null
+++ b/touch/stm/predump_stm20.mk
@@ -0,0 +1,6 @@
+PRODUCT_VENDOR_PROPERTIES += ro.vendor.touch.dump.sys=/sys/class/spi_master/spi20/spi20.0
+PRODUCT_VENDOR_PROPERTIES += ro.vendor.touch.dump.proc=/proc/fts/driver_test
+
+BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/touch/stm/predump_sepolicy
+
+PRODUCT_PACKAGES += predump_stm.sh
diff --git a/touch/stm/predump_stm6.mk b/touch/stm/predump_stm6.mk
new file mode 100644
index 0000000..2cbde2c
--- /dev/null
+++ b/touch/stm/predump_stm6.mk
@@ -0,0 +1,6 @@
+PRODUCT_VENDOR_PROPERTIES += ro.vendor.touch.dump.sys=/sys/class/spi_master/spi6/spi6.0
+PRODUCT_VENDOR_PROPERTIES += ro.vendor.touch.dump.proc=/proc/fts_ext/driver_test
+
+BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/touch/stm/predump_sepolicy
+
+PRODUCT_PACKAGES += predump_stm.sh