Sepolicy: selinux change for FP HIDL limited init retry times on B4S4

(cherry-pick of commit: 02a872394c32b8fd2bcd76036d2d74fb46e85795)

Add new mechanism for stopping FP HIDL after several times init fail.
This prevents the case of FP HIDL keeping trying to do init process and
raising CPU usage when sensor totally dead.
After limited time init retry fail (default 10 times), FP HIDL will
be stopped.

vendor.fps.init_retry.count: count for FP HDIL init retry times.

Test: build pass and FP functionaily are good.
Test: init process will be stopped after limited times retry fail.
Bug: 129225155
Change-Id: I9a995315ec788611e78f5bbd3c7a707d47daee14
Merged-In: I9a995315ec788611e78f5bbd3c7a707d47daee14
Signed-off-by: emilchung <emilchung@google.com>
Signed-off-by: eddielan <eddielan@google.com>
diff --git a/vendor/google/file_contexts b/vendor/google/file_contexts
index 56c530a..8ec9560 100644
--- a/vendor/google/file_contexts
+++ b/vendor/google/file_contexts
@@ -14,6 +14,7 @@
 /vendor/bin/hw/android\.hardware\.power@1\.3-service\.bonito-libperfmgr     u:object_r:hal_power_default_exec:s0
 /vendor/bin/perfstatsd                                                      u:object_r:perfstatsd_exec:s0
 /vendor/bin/init\.firstboot\.sh                                             u:object_r:init-firstboot_exec:s0
+/vendor/bin/init\.fingerprint\.sh                                           u:object_r:init-fingerprint_exec:s0
 /vendor/bin/ramoops                                                         u:object_r:ramoops_exec:s0
 /vendor/bin/init\.ramoops\.sh                                               u:object_r:ramoops_exec:s0
 /vendor/bin/pixelstats-vendor                                               u:object_r:pixelstats_vendor_exec:s0
diff --git a/vendor/google/init-fingerprint.te b/vendor/google/init-fingerprint.te
new file mode 100644
index 0000000..7053f0d
--- /dev/null
+++ b/vendor/google/init-fingerprint.te
@@ -0,0 +1,10 @@
+type init-fingerprint, domain;
+type init-fingerprint_exec, exec_type, vendor_file_type, file_type;
+
+init_daemon_domain(init-fingerprint)
+
+allow init-fingerprint vendor_shell_exec:file rx_file_perms;
+allow init-fingerprint vendor_toolbox_exec:file rx_file_perms;
+
+set_prop(init-fingerprint, vendor_fingerprint_prop)
+set_prop(init-fingerprint, ctl_start_prop)
diff --git a/vendor/google/property.te b/vendor/google/property.te
index d4519d1..4c15940 100644
--- a/vendor/google/property.te
+++ b/vendor/google/property.te
@@ -1,3 +1,6 @@
 type vendor_ramoops_prop, property_type;
 type vendor_shutdown_prop, property_type;
 type vendor_vibrator_prop, property_type;
+
+# fingerprint
+type vendor_fingerprint_prop, property_type;
diff --git a/vendor/google/property_contexts b/vendor/google/property_contexts
index ce87b46..42b9c73 100644
--- a/vendor/google/property_contexts
+++ b/vendor/google/property_contexts
@@ -10,3 +10,7 @@
 ro.vibrator.hal.short.voltage      u:object_r:vendor_vibrator_prop:s0
 ro.vibrator.hal.long.voltage       u:object_r:vendor_vibrator_prop:s0
 ro.vibrator.hal.long.frequency.shift    u:object_r:vendor_vibrator_prop:s0
+
+# fingerprint
+vendor.fps.init.succeed               u:object_r:vendor_fingerprint_prop:s0
+vendor.fps.init_retry.count           u:object_r:vendor_fingerprint_prop:s0