From 51944860023ce8cd2530c24907f0c69be9be392c Mon Sep 17 00:00:00 2001 From: Captain Throwback Date: Thu, 3 Oct 2024 16:01:49 -0400 Subject: [PATCH] module: move daemon start exclusively to service.sh Starting daemon during post-fs-data can cause Play Integrity detection for devices that do not need to use a Play Integrity Fix module --- .../main/java/org/lsposed/lspd/service/ServiceManager.java | 4 +--- magisk-loader/magisk_module/post-fs-data.sh | 2 -- magisk-loader/magisk_module/service.sh | 6 ++++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/daemon/src/main/java/org/lsposed/lspd/service/ServiceManager.java b/daemon/src/main/java/org/lsposed/lspd/service/ServiceManager.java index 0998d910948..1d26901129a 100644 --- a/daemon/src/main/java/org/lsposed/lspd/service/ServiceManager.java +++ b/daemon/src/main/java/org/lsposed/lspd/service/ServiceManager.java @@ -95,9 +95,7 @@ public static void start(String[] args) { int systemServerMaxRetry = 1; for (String arg : args) { - if (arg.equals("--from-service")) { - Log.w(TAG, "LSPosed daemon is not started properly. Try for a late start..."); - } else if (arg.startsWith("--system-server-max-retry=")) { + if (arg.startsWith("--system-server-max-retry=")) { try { systemServerMaxRetry = Integer.parseInt(arg.substring(arg.lastIndexOf('=') + 1)); } catch (Throwable ignored) { diff --git a/magisk-loader/magisk_module/post-fs-data.sh b/magisk-loader/magisk_module/post-fs-data.sh index c0234f4da84..9f687745b0b 100644 --- a/magisk-loader/magisk_module/post-fs-data.sh +++ b/magisk-loader/magisk_module/post-fs-data.sh @@ -21,6 +21,4 @@ MODDIR=${0%/*} rm -f "/data/local/tmp/daemon.apk" rm -f "/data/local/tmp/manager.apk" -cd "$MODDIR" -unshare --propagation slave -m sh -c "$MODDIR/daemon $@&" diff --git a/magisk-loader/magisk_module/service.sh b/magisk-loader/magisk_module/service.sh index 48b99320fab..2731fc99448 100644 --- a/magisk-loader/magisk_module/service.sh +++ b/magisk-loader/magisk_module/service.sh @@ -18,6 +18,8 @@ # MODDIR=${0%/*} + cd "$MODDIR" -# post-fs-data.sh may be blocked by other modules. retry to start this -unshare --propagation slave -m sh -c "$MODDIR/daemon --from-service $@&" + +# Start daemon in service.sh as early start can cause Play Integrity detection +unshare --propagation slave -m sh -c "$MODDIR/daemon $@&"