diff --git a/core/src/main/java/org/lsposed/lspd/impl/utils/LSPosedDexParser.java b/core/src/main/java/org/lsposed/lspd/impl/utils/LSPosedDexParser.java index 2c4b5e5fc..5fe3f5913 100644 --- a/core/src/main/java/org/lsposed/lspd/impl/utils/LSPosedDexParser.java +++ b/core/src/main/java/org/lsposed/lspd/impl/utils/LSPosedDexParser.java @@ -76,7 +76,7 @@ public LSPosedDexParser(@NonNull ByteBuffer buffer, boolean includeAnnotations) var methodIds = (int[]) out[4]; this.methodIds = new MethodId[methodIds.length / 3]; - for (int i = 0; i < this.methodIds.length / 3; ++i) { + for (int i = 0; i < this.methodIds.length; ++i) { this.methodIds[i] = new LSPosedMethodId(i, methodIds[3 * i], methodIds[3 * i + 1], methodIds[3 * i + 2]); } @@ -176,8 +176,8 @@ class LSPosedProtoId extends LSPosedId implements ProtoId { this.returnType = typeIds[protoId[1]]; if (protoId.length > 2) { this.parameters = new TypeId[protoId.length - 2]; - for (int i = 2; i < parameters.length; ++i) { - this.parameters[i] = typeIds[protoId[i]]; + for (int i = 0; i < parameters.length; ++i) { + this.parameters[i] = typeIds[protoId[i + 2]]; } } else { this.parameters = null; 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 f6df0d059..1e890081a 100644 --- a/daemon/src/main/java/org/lsposed/lspd/service/ServiceManager.java +++ b/daemon/src/main/java/org/lsposed/lspd/service/ServiceManager.java @@ -99,9 +99,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/customize.sh b/magisk-loader/magisk_module/customize.sh index 010a94324..5fc4161cf 100644 --- a/magisk-loader/magisk_module/customize.sh +++ b/magisk-loader/magisk_module/customize.sh @@ -73,7 +73,6 @@ ui_print "- Extracting module files" extract "$ZIPFILE" 'module.prop' "$MODPATH" extract "$ZIPFILE" 'action.sh' "$MODPATH" -extract "$ZIPFILE" 'post-fs-data.sh' "$MODPATH" extract "$ZIPFILE" 'service.sh' "$MODPATH" extract "$ZIPFILE" 'uninstall.sh' "$MODPATH" extract "$ZIPFILE" 'sepolicy.rule' "$MODPATH" diff --git a/magisk-loader/magisk_module/post-fs-data.sh b/magisk-loader/magisk_module/post-fs-data.sh deleted file mode 100644 index c0234f4da..000000000 --- a/magisk-loader/magisk_module/post-fs-data.sh +++ /dev/null @@ -1,26 +0,0 @@ -# -# This file is part of LSPosed. -# -# LSPosed is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# LSPosed is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with LSPosed. If not, see . -# -# Copyright (C) 2021 LSPosed Contributors -# - -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 48b99320f..95979daa2 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 $@&" + +# To avoid delaying the normal mount timing of zygote, we start LSPosed service daemon in late_start service mode instead of post-fs-data mode +unshare --propagation slave -m sh -c "$MODDIR/daemon $@&"