From 730a69fbb3ff0f35cf79009b500567b1a4a9f6fa Mon Sep 17 00:00:00 2001
From: maxwen <max.weninger@gmail.com>
Date: Fri, 12 Aug 2022 15:18:53 +0200
Subject: [PATCH] add vnc server integration bits

[nift4: squashed "sepolicy fix for vncflinger_exec"]
---
 etc/vncflinger.rc      | 4 ++++
 sepolicy/file_contexts | 1 +
 sepolicy/system_app.te | 4 ++++
 sepolicy/vncflinger.te | 2 +-
 4 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 sepolicy/system_app.te

diff --git a/etc/vncflinger.rc b/etc/vncflinger.rc
index 3e86595..30e0649 100644
--- a/etc/vncflinger.rc
+++ b/etc/vncflinger.rc
@@ -10,3 +10,7 @@ on property:persist.vnc.enable=true
 
 on property:persist.vnc.enable=false
     stop vncflinger
+
+on boot
+    # vnc
+    chmod 0666 /dev/uinput
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index 9c73aa4..4027332 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -1 +1,2 @@
 /system/bin/vncflinger   u:object_r:vncflinger_exec:s0
+/system/bin/vncpasswd    u:object_r:vncflinger_exec:s0
diff --git a/sepolicy/system_app.te b/sepolicy/system_app.te
new file mode 100644
index 0000000..82468dc
--- /dev/null
+++ b/sepolicy/system_app.te
@@ -0,0 +1,4 @@
+allow system_app vncflinger_exec:file { r_file_perms execute execute_no_trans map };
+
+# uinput
+allow system_app uhid_device:chr_file rw_file_perms;
diff --git a/sepolicy/vncflinger.te b/sepolicy/vncflinger.te
index edeccc4..511dd47 100644
--- a/sepolicy/vncflinger.te
+++ b/sepolicy/vncflinger.te
@@ -1,4 +1,4 @@
-type vncflinger_exec, exec_type, file_type;
+type vncflinger_exec, exec_type, file_type, system_file_type;
 type vncflinger, domain;
 typeattribute vncflinger coredomain;
 
-- 
GitLab