Include service-cleaner.sh which kills looping services 30s after boot
diff --git a/base.mk b/base.mk
index 90dc732..2f314ca 100644
--- a/base.mk
+++ b/base.mk
@@ -49,7 +49,8 @@
device/phh/treble/fixSPL/getSPL.arm:system/bin/getSPL
PRODUCT_COPY_FILES += \
- device/phh/treble/empty:system/phh/empty
+ device/phh/treble/empty:system/phh/empty \
+ device/phh/treble/service-cleaner.sh:system/bin/service-cleaner.sh
PRODUCT_PACKAGES += \
treble-environ-rc
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index 3cdbabe..14940ae 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -2,3 +2,4 @@
/system/bin/vndk-detect u:object_r:vndk_detect_exec:s0
/system/etc/usb_audio_policy_configuration.xml u:object_r:vendor_configs_file:s0
/system/bin/rw-system.sh u:object_r:phhsu_exec:s0
+/system/bin/service-cleaner.sh u:object_r:phhsu_exec:s0
diff --git a/service-cleaner.sh b/service-cleaner.sh
new file mode 100644
index 0000000..f8f7287
--- /dev/null
+++ b/service-cleaner.sh
@@ -0,0 +1,9 @@
+#!/system/bin/sh
+
+sleep 30
+getprop | \
+ grep restarting | \
+ sed -nE -e 's/\[([^]]*).*/\1/g' -e 's/init.svc.(.*)/\1/p' |
+ while read svc ;do
+ setprop ctl.stop $svc
+ done
diff --git a/vndk.rc b/vndk.rc
index a4361a5..0f694a8 100644
--- a/vndk.rc
+++ b/vndk.rc
@@ -3,3 +3,9 @@
exec - root -- /system/bin/rw-system.sh
mount none /system/etc/usb_audio_policy_configuration.xml /vendor/etc/usb_audio_policy_configuration.xml bind
export LD_CONFIG_FILE /system/etc/ld.config.${persist.sys.vndk}.txt
+
+service phh_service_cleaner /system/bin/service-cleaner.sh
+ disabled
+
+on property:sys.boot_completed=1
+ start phh_service_cleaner