aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArian <arian.kulmer@web.de>2021-04-06 19:29:03 +0200
committerArian <arian.kulmer@web.de>2021-04-07 11:50:33 +0200
commite99db13236bc8ac3471fcb22e81178fc423679eb (patch)
treed13113be29fdb04c693b323ae6d2e58ea8d28893
parent0950b9cb5eeddcc776a656c87cdf0d97d36e961e (diff)
shinano-common: rootdir: Introduce a service to start suntrold
* suntrold is a oneshot service and spawns a subprocess which is required for the rear camera. Since [1] oneshot services' process groups are killed which prevents suntrold from working correctly. * To work this issue around create a non-oneshot service, suntrold.sh, which never exits, so that suntrold can be started from it and it's subprocesses will not be killed. [1] https://github.com/aosp-mirror/platform_system_core/commit/d89ed132a0ee1a57046286b83e64a35b71774952 [Idea of this is from LuK1337] Co-authored-by: LuK1337 <priv.luk@gmail.com> Change-Id: Id9c4f56648168f0ffe19b2bb31c591750afe6f97
-rw-r--r--rootdir/Android.mk8
-rw-r--r--rootdir/bin/suntrold.sh7
-rw-r--r--rootdir/etc/init.camera.rc5
-rw-r--r--rootdir/etc/init.qcom.rc7
-rw-r--r--sepolicy/credmgrd.te3
-rw-r--r--sepolicy/dontaudit.te2
-rw-r--r--sepolicy/file_contexts1
-rw-r--r--shinano.mk3
8 files changed, 27 insertions, 9 deletions
diff --git a/rootdir/Android.mk b/rootdir/Android.mk
index 92b8981..216a8da 100644
--- a/rootdir/Android.mk
+++ b/rootdir/Android.mk
@@ -66,6 +66,14 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES)
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
+LOCAL_MODULE := suntrold.sh
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE_CLASS := EXECUTABLES
+LOCAL_SRC_FILES := bin/suntrold.sh
+LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES)
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
LOCAL_MODULE := tad_static
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := EXECUTABLES
diff --git a/rootdir/bin/suntrold.sh b/rootdir/bin/suntrold.sh
new file mode 100644
index 0000000..170b738
--- /dev/null
+++ b/rootdir/bin/suntrold.sh
@@ -0,0 +1,7 @@
+#!/vendor/bin/sh
+
+# Start suntrold
+/vendor/bin/suntrold
+
+# Sleep infinite to prevent that suntrold's subprocess gets killed
+tail -f /dev/null
diff --git a/rootdir/etc/init.camera.rc b/rootdir/etc/init.camera.rc
index ce77064..068c838 100644
--- a/rootdir/etc/init.camera.rc
+++ b/rootdir/etc/init.camera.rc
@@ -101,6 +101,11 @@ service credmgrd /vendor/bin/credmgrd
socket credmgr stream 0660 system camera
disabled
+service suntrold-sh /vendor/bin/suntrold.sh
+ class main
+ user system
+ group system camera
+
# Secure Config Transfer service
service sct_service /vendor/bin/sct_service
user root
diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc
index 7329ce0..010b98b 100644
--- a/rootdir/etc/init.qcom.rc
+++ b/rootdir/etc/init.qcom.rc
@@ -385,13 +385,6 @@ service ril-daemon1 /vendor/bin/hw/rild -c 2
on property:persist.radio.multisim.config=dsds
start ril-daemon1
-# Start suntrold
-service suntrold /vendor/bin/suntrold
- user system
- group system camera
- oneshot
- class main
-
# Modem Log QMI service
service mlog_qmi_service /vendor/bin/mlog_qmi_service
class core
diff --git a/sepolicy/credmgrd.te b/sepolicy/credmgrd.te
index 2b61930..38edd9f 100644
--- a/sepolicy/credmgrd.te
+++ b/sepolicy/credmgrd.te
@@ -18,4 +18,7 @@ allow credmgrd system_data_root_file:dir { create_dir_perms relabelfrom };
allow credmgrd credmgrd_data_file:dir { create_dir_perms relabelto };
allow credmgrd credmgrd_data_file:file create_file_perms;
+# Allow suntrold.sh to start suntrold
+allow credmgrd credmgrd_exec:file rx_file_perms;
+
set_prop(credmgrd, credmgrd_prop)
diff --git a/sepolicy/dontaudit.te b/sepolicy/dontaudit.te
index 2ddef4b..faf73b3 100644
--- a/sepolicy/dontaudit.te
+++ b/sepolicy/dontaudit.te
@@ -1 +1 @@
-dontaudit domain credmgrd_exec:file *;
+dontaudit { domain -credmgrd } credmgrd_exec:file *;
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index d95a492..d953062 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -18,6 +18,7 @@
/(vendor|system/vendor)/bin/credmgrd u:object_r:credmgrd_exec:s0
/(vendor|system/vendor)/bin/credmgrfirstboot\.sh u:object_r:credmgrd_exec:s0
/(vendor|system/vendor)/bin/suntrold u:object_r:credmgrd_exec:s0
+/(vendor|system/vendor)/bin/suntrold.sh u:object_r:credmgrd_exec:s0
# Lineage hardware
/(vendor|system/vendor)/bin/hw/vendor\.lineage\.touch@1\.0-service\.shinano u:object_r:hal_lineage_touch_default_exec:s0
diff --git a/shinano.mk b/shinano.mk
index 204be18..9cf9980 100644
--- a/shinano.mk
+++ b/shinano.mk
@@ -137,7 +137,8 @@ PRODUCT_PACKAGES += \
ueventd.qcom.rc
PRODUCT_PACKAGES += \
- credmgrfirstboot.sh
+ credmgrfirstboot.sh \
+ suntrold.sh
# Include BCM Wifi
$(call inherit-product-if-exists, hardware/broadcom/wlan/bcmdhd/config/config-bcm.mk)