Skip to content

Commit

Permalink
Start service daemon in late_start mode (#57)
Browse files Browse the repository at this point in the history
1. Starting daemon during post-fs-data can cause Play Integrity detection
   for devices without the PlayIntegrityFix module.
2. Starting LSPosed service daemon in post-fs-data mode is redundant on
   many devices
  • Loading branch information
CaptainThrowback authored and JingMatrix committed Oct 17, 2024
1 parent 8f23a05 commit fef9300
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 0 additions & 2 deletions magisk-loader/magisk_module/post-fs-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@&"
6 changes: 4 additions & 2 deletions magisk-loader/magisk_module/service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@&"

# To avoid breaking Play Integrity in certain cases, we start LSPosed service daemon in late_start service mode instead of post-fs-data mode
unshare --propagation slave -m sh -c "$MODDIR/daemon $@&"

0 comments on commit fef9300

Please sign in to comment.