From 67e3460d7a312ad724278db19c25acb7b326fc48 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Thu, 3 Feb 2022 13:31:48 +0800 Subject: [PATCH] Get rid of config.cpp --- core/magisk_module/post-fs-data.sh | 1 + core/magisk_module/service.sh | 1 + daemon/src/main/cpp/Android.mk | 4 ++-- daemon/src/main/cpp/obfuscation.cpp | 5 ++--- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/magisk_module/post-fs-data.sh b/core/magisk_module/post-fs-data.sh index 9cfecedb..8627d068 100644 --- a/core/magisk_module/post-fs-data.sh +++ b/core/magisk_module/post-fs-data.sh @@ -20,4 +20,5 @@ MODDIR=${0%/*} rm -f "/data/local/tmp/daemon.apk" +cd "$MODDIR" unshare -m sh -c "$MODDIR/daemon &" diff --git a/core/magisk_module/service.sh b/core/magisk_module/service.sh index 3d4e7d32..4d737305 100644 --- a/core/magisk_module/service.sh +++ b/core/magisk_module/service.sh @@ -18,5 +18,6 @@ # MODDIR=${0%/*} +cd "$MODDIR" # post-fs-data.sh may be blocked by other modules. retry to start this unshare -m "$MODDIR/daemon" --from-service "$@"& diff --git a/daemon/src/main/cpp/Android.mk b/daemon/src/main/cpp/Android.mk index 97bcfa4a..76403638 100644 --- a/daemon/src/main/cpp/Android.mk +++ b/daemon/src/main/cpp/Android.mk @@ -3,11 +3,11 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := daemon LOCAL_C_INCLUDES := ../core/src/main/cpp/main/include/ -LOCAL_SRC_FILES := logcat.cpp obfuscation.cpp ../../../../core/src/main/cpp/main/api/config.cpp +LOCAL_SRC_FILES := logcat.cpp obfuscation.cpp LOCAL_STATIC_LIBRARIES := cxx dex_builder LOCAL_ALLOW_UNDEFINED_SYMBOLS := true LOCAL_LDLIBS := -llog -landroid include $(BUILD_SHARED_LIBRARY) include ../core/src/main/cpp/external/DexBuilder/Android.mk -$(call import-module,prefab/cxx) \ No newline at end of file +$(call import-module,prefab/cxx) diff --git a/daemon/src/main/cpp/obfuscation.cpp b/daemon/src/main/cpp/obfuscation.cpp index 6e796acf..ab6c5c14 100644 --- a/daemon/src/main/cpp/obfuscation.cpp +++ b/daemon/src/main/cpp/obfuscation.cpp @@ -33,7 +33,6 @@ #include #include "slicer/reader.h" #include "slicer/writer.h" -#include "config.h" #include "obfuscation.h" extern "C" @@ -136,7 +135,7 @@ Java_org_lsposed_lspd_service_ObfuscationManager_preloadDex(JNIEnv *, jclass ) { using namespace std::string_literals; std::lock_guard lg(dex_lock); if (lspdDex != -1) return lspdDex; - std::string dex_path = "/data/adb/modules/"s + lspd::moduleName + "/" + lspd::kDexPath; + std::string dex_path = "framework/lspd.dex"; std::unique_ptr f{fopen(dex_path.data(), "rb"), &fclose}; @@ -145,7 +144,7 @@ Java_org_lsposed_lspd_service_ObfuscationManager_preloadDex(JNIEnv *, jclass ) { return -1; } fseek(f.get(), 0, SEEK_END); - auto size = ftell(f.get()); + size_t size = ftell(f.get()); rewind(f.get()); LOGD("Loaded %s with size %zu", dex_path.data(), size);