dumpstate: touch: Add touch_predump for gti

go/touch_predump

Test: b/318578275
Test: Locally flash and check dump logs on dogfood device
Bug: 287907308
Change-Id: I4a35a9a57c1331d67dfcd1863b57d75a9b804c32
diff --git a/touch/gti/Android.bp b/touch/gti/Android.bp
index 7f2eb66..d22a5a4 100644
--- a/touch/gti/Android.bp
+++ b/touch/gti/Android.bp
@@ -33,3 +33,19 @@
     ],
     vendor: true,
 }
+
+sh_binary {
+    name: "predump_gti0.sh",
+    src: "dump_gti0.sh",
+    init_rc: ["init.touch.gti0.rc"],
+    vendor: true,
+    sub_dir: "dump_touch",
+}
+
+sh_binary {
+    name: "predump_gti1.sh",
+    src: "dump_gti1.sh",
+    init_rc: ["init.touch.gti1.rc"],
+    vendor: true,
+    sub_dir: "dump_touch",
+}
diff --git a/touch/gti/predump_gti.mk b/touch/gti/predump_gti.mk
new file mode 100644
index 0000000..ae25254
--- /dev/null
+++ b/touch/gti/predump_gti.mk
@@ -0,0 +1,7 @@
+include device/google/gs-common/touch/predump/predump_touch.mk
+
+BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/touch/gti/predump_sepolicy
+BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/touch/gti/ical/sepolicy
+
+PRODUCT_PACKAGES += predump_gti0.sh
+PRODUCT_PACKAGES += touch_gti_ical
diff --git a/touch/gti/predump_gti_dual.mk b/touch/gti/predump_gti_dual.mk
new file mode 100644
index 0000000..b7f2efc
--- /dev/null
+++ b/touch/gti/predump_gti_dual.mk
@@ -0,0 +1,6 @@
+include device/google/gs-common/touch/gti/predump_gti.mk
+
+BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/touch/gti/predump_sepolicy_gti_dual
+BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/touch/gti/ical/sepolicy_gti_dual
+
+PRODUCT_PACKAGES += predump_gti1.sh
diff --git a/touch/gti/predump_sepolicy/file.te b/touch/gti/predump_sepolicy/file.te
new file mode 100644
index 0000000..c3900f0
--- /dev/null
+++ b/touch/gti/predump_sepolicy/file.te
@@ -0,0 +1,3 @@
+type proc_touch_gti, proc_type, fs_type;
+type sysfs_touch_gti, sysfs_type, fs_type;
+
diff --git a/touch/gti/predump_sepolicy/file_contexts b/touch/gti/predump_sepolicy/file_contexts
new file mode 100644
index 0000000..6d8ca17
--- /dev/null
+++ b/touch/gti/predump_sepolicy/file_contexts
@@ -0,0 +1 @@
+/vendor/bin/dump_touch/predump_gti0\.sh      u:object_r:predump_touch_exec:s0
diff --git a/touch/gti/predump_sepolicy/genfs_contexts b/touch/gti/predump_sepolicy/genfs_contexts
new file mode 100644
index 0000000..45d3b53
--- /dev/null
+++ b/touch/gti/predump_sepolicy/genfs_contexts
@@ -0,0 +1,4 @@
+# Touch
+genfscon sysfs /devices/virtual/goog_touch_interface                            u:object_r:sysfs_touch_gti:s0
+genfscon proc  /goog_touch_interface                                            u:object_r:proc_touch_gti:s0
+
diff --git a/touch/gti/predump_sepolicy/predump_touch.te b/touch/gti/predump_sepolicy/predump_touch.te
new file mode 100644
index 0000000..7c1f408
--- /dev/null
+++ b/touch/gti/predump_sepolicy/predump_touch.te
@@ -0,0 +1,4 @@
+allow predump_touch proc_touch_gti:dir r_dir_perms;
+allow predump_touch proc_touch_gti:file rw_file_perms;
+allow predump_touch sysfs_touch_gti:dir r_dir_perms;
+allow predump_touch sysfs_touch_gti:file rw_file_perms;
\ No newline at end of file
diff --git a/touch/gti/predump_sepolicy_gti_dual/file_contexts b/touch/gti/predump_sepolicy_gti_dual/file_contexts
new file mode 100644
index 0000000..02a300a
--- /dev/null
+++ b/touch/gti/predump_sepolicy_gti_dual/file_contexts
@@ -0,0 +1,2 @@
+/vendor/bin/dump_touch/predump_gti1\.sh     u:object_r:predump_touch_exec:s0
+