Skip to content

Commit 05f5b23

Browse files
committed
Start service daemon in post-fs-data.sh (#429)
For trace cleaning modules to work properly, such as the DenyList feature of NeoZygisk, it is better to execute modules mount (`dex2oat` for the case of LSPosed) at post-fs-data.sh. Moreover, the `logd` daemon of LSPosed should start as early as possible. This reverts commit 92cbed4 (pull-request #57). The original pull-request claimed a `PlayIntegrityFix` break, but was not reproducible on other devices.
1 parent bcea75e commit 05f5b23

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

daemon/src/main/java/org/lsposed/lspd/service/ServiceManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ public static void start(String[] args) {
9999

100100
int systemServerMaxRetry = 1;
101101
for (String arg : args) {
102-
if (arg.startsWith("--system-server-max-retry=")) {
102+
if (arg.equals("--from-service")) {
103+
Log.w(TAG, "LSPosed daemon is not started properly. Try for a late start...");
104+
} else if (arg.startsWith("--system-server-max-retry=")) {
103105
try {
104106
systemServerMaxRetry = Integer.parseInt(arg.substring(arg.lastIndexOf('=') + 1));
105107
} catch (Throwable ignored) {

magisk-loader/magisk_module/post-fs-data.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@ MODDIR=${0%/*}
2121

2222
rm -f "/data/local/tmp/daemon.apk"
2323
rm -f "/data/local/tmp/manager.apk"
24+
cd "$MODDIR"
2425

26+
unshare --propagation slave -m sh -c "$MODDIR/daemon $@&"

magisk-loader/magisk_module/service.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#
1919

2020
MODDIR=${0%/*}
21-
2221
cd "$MODDIR"
23-
24-
# To avoid breaking Play Integrity in certain cases, we start LSPosed service daemon in late_start service mode instead of post-fs-data mode
25-
unshare --propagation slave -m sh -c "$MODDIR/daemon $@&"
22+
# post-fs-data.sh may be blocked by other modules. retry to start this
23+
unshare --propagation slave -m sh -c "$MODDIR/daemon --from-service $@&"

0 commit comments

Comments
 (0)