[core] Print version to logcat (#375)

* [core] Print version to logcat

* [core] Check module id on init
This commit is contained in:
tehcneko 2021-03-19 21:21:11 +08:00 committed by GitHub
parent 441e82bde0
commit 39aa9952b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 4 deletions

View File

@ -95,7 +95,8 @@ android {
cFlags("-std=c11 -ffixed-x18 -Qunused-arguments -fno-rtti -fno-exceptions -fomit-frame-pointer -fpie -fPIC")
arguments("-DRIRU_MODULE_API_VERSION=$moduleMaxRiruApiVersion",
"-DRIRU_MODULE_VERSION=$verCode",
"-DRIRU_MODULE_VERSION_NAME:STRING=\"$verName\"")
"-DRIRU_MODULE_VERSION_NAME:STRING=\"$verName\"",
"-DMODULE_NAME:STRING=riru_$riruModuleId")
targets("lspd")
}
}

View File

@ -35,6 +35,7 @@ add_definitions(-DRIRU_MODULE)
add_definitions(-DRIRU_MODULE_API_VERSION=${RIRU_MODULE_API_VERSION})
add_definitions(-DRIRU_MODULE_VERSION=${RIRU_MODULE_VERSION})
add_definitions(-DRIRU_MODULE_VERSION_NAME=${RIRU_MODULE_VERSION_NAME})
add_definitions(-DMODULE_NAME=${MODULE_NAME})
add_subdirectory(main)
add_subdirectory(external)

View File

@ -36,6 +36,7 @@ namespace lspd {
void onModuleLoaded() {
LOGI("onModuleLoaded: welcome to LSPosed!");
LOGI("onModuleLoaded: version %s (%d)", RIRU_MODULE_VERSION_NAME, RIRU_MODULE_VERSION);
// rirud must be used in onModuleLoaded
Context::GetInstance()->PreLoadDex(magiskPath + '/' + kDexPath);
InitSymbolCache();
@ -112,9 +113,13 @@ namespace lspd {
}
__attribute__((noinline)) RIRU_EXPORT RiruVersionedModuleInfo *init(Riru *riru) {
LOGD("Using riru %d", riru->riruApiVersion);
LOGD("using riru %d", riru->riruApiVersion);
LOGD("module path: %s", riru->magiskModulePath);
lspd::magiskPath = riru->magiskModulePath;
if (lspd::magiskPath.find(STRINGIFY(MODULE_NAME)) == std::string::npos) {
LOGE("who am i");
return nullptr;
}
lspd::allowUnload = riru->allowUnload;
return &lspd::module;
}

View File

@ -20,10 +20,13 @@
package org.lsposed.lspd.service;
import android.content.Context;
import android.os.Build;
import android.os.IBinder;
import android.os.Looper;
import android.util.Log;
import org.lsposed.lspd.BuildConfig;
public class ServiceManager {
private static LSPosedService mainService = null;
private static LSPModuleService moduleService = null;
@ -49,6 +52,7 @@ public class ServiceManager {
// call by ourselves
public static void start() {
Log.i(TAG, "starting server...");
Log.i(TAG, String.format("version %s (%s)", BuildConfig.VERSION_NAME, BuildConfig.VERSION_NAME));
Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
Log.e(TAG, Log.getStackTraceString(e));

View File

@ -31,8 +31,9 @@ abortC() {
POUNDS="*********************************************************"
VERSION=$(grep_prop version "${TMPDIR}/module.prop")
VERSION_CODE=$(grep_prop versionCode "${TMPDIR}/module.prop")
ui_print "- LSPosed version ${VERSION}"
ui_print "- LSPosed version ${VERSION} (${VERSION_CODE})"
# Extract verify.sh
ui_print "- Extracting verify.sh"
@ -137,4 +138,4 @@ if [ ! -e /data/adb/lspd/config/verbose_log ]; then
fi
set_perm_recursive "${MODPATH}" 0 0 0755 0644
ui_print "- Welcome to LSPosed ${VERSION}!"
ui_print "- Welcome to LSPosed!"