Skip to content
This repository has been archived by the owner on Sep 1, 2021. It is now read-only.

Commit

Permalink
+ 3.9.11 适配 Android 10 for some devices.
Browse files Browse the repository at this point in the history
  • Loading branch information
eritpchy committed May 12, 2020
1 parent 0ea946b commit df0ae04
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 38 deletions.
5 changes: 3 additions & 2 deletions module.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
ext {
moduleId = "module_xfingerprint_pay_wechat"
riruApiVersion = 4
riruApiVersion = 7
riruMinVersionName = "v21.2"

moduleProp = [
name : "指纹支付 - 微信",
version : "v3.9.10",
version : "v3.9.11",
versionCode: "1",
author : "Jason Eric",
description: "让微信支持指纹支付 Fingerprint pay for WeChat.",
Expand Down
1 change: 1 addition & 0 deletions module/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ android.libraryVariants.all { variant ->
filter { line ->
line.replaceAll('%%%RIRU_MODULE_ID%%%', moduleId)
.replaceAll('%%%RIRU_MIN_API_VERSION%%%', riruApiVersion.toString())
.replaceAll('%%%RIRU_MIN_VERSION_NAME%%%', riruMinVersionName)
}
filter(FixCrLfFilter.class,
eol: FixCrLfFilter.CrLf.newInstance("lf"))
Expand Down
Binary file modified module/libs/fingerprint-pay-wechat-magisk.apk
Binary file not shown.
70 changes: 39 additions & 31 deletions module/src/main/cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,11 @@ static void loadDex(JNIEnv *env, jstring jdexPath, jstring jodexPath, jstring jc
LOGD("target method(%s) not found", methodName);
return;
}

env->CallStaticVoidMethod(javaClientClass, targetMethod, jarg1);
}


// You can remove functions you don't need

extern "C" {
#define EXPORT __attribute__((visibility("default"))) __attribute__((used))
EXPORT void nativeForkAndSpecializePre(
JNIEnv *env, jclass clazz, jint *_uid, jint *gid, jintArray *gids, jint *runtimeFlags,
jobjectArray *rlimits, jint *mountExternal, jstring *seInfo, jstring *niceName,
jintArray *fdsToClose, jintArray *fdsToIgnore, jboolean *is_child_zygote,
jstring *instructionSet, jstring *appDataDir, jstring *packageName,
jobjectArray *packagesForUID, jstring *sandboxId) {
// packageName, packagesForUID, sandboxId are added from Android Q beta 2, removed from beta 5
static void pre(JNIEnv *env, jstring *appDataDir, jstring *niceName) {
char *cAppDataDir = jstringToC(env, *appDataDir);
if (cAppDataDir == NULL) {
LOGD("MEM ERR");
Expand All @@ -120,25 +109,43 @@ EXPORT void nativeForkAndSpecializePre(
}
}

EXPORT int nativeForkAndSpecializePost(JNIEnv *env, jclass clazz, jint res) {
if (res == 0) {
// in app process
if (sHookEnable) {
char appCacheDir[PATH_MAX] = {0};
snprintf(appCacheDir, PATH_MAX - 1, "%s/cache", sAppDataDir);
static void post(JNIEnv *env) {
if (sHookEnable) {
char appCacheDir[PATH_MAX] = {0};
snprintf(appCacheDir, PATH_MAX - 1, "%s/cache", sAppDataDir);

const char *dexPath = "/data/local/tmp/libriru_module_xfingerprint_pay_wechat.dex";
if (access(dexPath, 0) != 0) {
dexPath = "/system/framework/libriru_module_xfingerprint_pay_wechat.dex";
}
loadDex(env,
const char *dexPath = "/data/local/tmp/libriru_module_xfingerprint_pay_wechat.dex";
if (access(dexPath, 0) != 0) {
dexPath = "/system/framework/libriru_module_xfingerprint_pay_wechat.dex";
}
loadDex(env,
env->NewStringUTF(dexPath),
env->NewStringUTF(appCacheDir),
env->NewStringUTF("com.yyxx.wechatfp.xposed.plugin.XposedWeChatPlugin"),
"main",
env->NewStringUTF(sAppDataDir)
);
}
);
}
}

// You can remove functions you don't need

extern "C" {
#define EXPORT __attribute__((visibility("default"))) __attribute__((used))
EXPORT void nativeForkAndSpecializePre(
JNIEnv *env, jclass clazz, jint *_uid, jint *gid, jintArray *gids, jint *runtimeFlags,
jobjectArray *rlimits, jint *mountExternal, jstring *seInfo, jstring *niceName,
jintArray *fdsToClose, jintArray *fdsToIgnore, jboolean *is_child_zygote,
jstring *instructionSet, jstring *appDataDir, jboolean *isTopApp, jobjectArray *pkgDataInfoList,
jobjectArray *whitelistedDataInfoList, jboolean *bindMountAppDataDirs, jboolean *bindMountAppStorageDirs) {
// packageName, packagesForUID, sandboxId are added from Android Q beta 2, removed from beta 5
pre(env, appDataDir, niceName);
}

EXPORT int nativeForkAndSpecializePost(JNIEnv *env, jclass clazz, jint res) {
if (res == 0) {
// in app process
post(env);
} else {
// in zygote process, res is child pid
// don't print log here, see https://github.com/RikkaApps/Riru/blob/77adfd6a4a6a81bfd20569c910bc4854f2f84f5e/riru-core/jni/main/jni_native_method.cpp#L55-L66
Expand All @@ -150,15 +157,16 @@ EXPORT __attribute__((visibility("default"))) void specializeAppProcessPre(
JNIEnv *env, jclass clazz, jint *_uid, jint *gid, jintArray *gids, jint *runtimeFlags,
jobjectArray *rlimits, jint *mountExternal, jstring *seInfo, jstring *niceName,
jboolean *startChildZygote, jstring *instructionSet, jstring *appDataDir,
jstring *packageName, jobjectArray *packagesForUID, jstring *sandboxId) {
// this is added from Android Q beta, but seems Google disabled this in following updates

// packageName, packagesForUID, sandboxId are added from Android Q beta 2, removed from beta 5
jboolean *isTopApp, jobjectArray *pkgDataInfoList, jobjectArray *whitelistedDataInfoList,
jboolean *bindMountAppDataDirs, jboolean *bindMountAppStorageDirs) {
// added from Android 10, but disabled at least in Google Pixel devices
pre(env, appDataDir, niceName);
}

EXPORT __attribute__((visibility("default"))) int specializeAppProcessPost(
JNIEnv *env, jclass clazz) {
// this is added from Android Q beta, but seems Google disabled this in following updates
// added from Android 10, but disabled at least in Google Pixel devices
post(env);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':module'
include ':module'
7 changes: 4 additions & 3 deletions template/magisk_module/riru.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ RIRU_PATH="/data/misc/riru"
RIRU_MODULE_ID="%%%RIRU_MODULE_ID%%%"
RIRU_MODULE_PATH="$RIRU_PATH/modules/$RIRU_MODULE_ID"
RIRU_MIN_API_VERSION=%%%RIRU_MIN_API_VERSION%%%
RIRU_MIN_VERSION_NAME="%%%RIRU_MIN_VERSION_NAME%%%"

abort_clean() {
rm -rf "$MODPATH"
Expand All @@ -13,16 +14,16 @@ check_riru_version() {
if [ ! -f "$RIRU_PATH/api_version" ] && [ ! -f "$RIRU_PATH/api_version.new" ]; then
ui_print "*********************************************************"
ui_print "! Riru is not installed"
ui_print "! Please install Riru (Riru - Core) from Magisk Manager or https://github.com/RikkaApps/Riru/releases"
ui_print "! Please install Riru from Magisk Manager or https://github.com/RikkaApps/Riru/releases"
abort_clean "*********************************************************"
fi
RIRU_API_VERSION=$(cat "$RIRU_PATH/api_version.new") || RIRU_API_VERSION=$(cat "$RIRU_PATH/api_version") || RIRU_API_VERSION=0
[ "$RIRU_API_VERSION" -eq "$RIRU_API_VERSION" ] || RIRU_API_VERSION=0
ui_print "- Riru API version: $RIRU_API_VERSION"
if [ "$RIRU_API_VERSION" -lt $RIRU_MIN_API_VERSION ]; then
ui_print "*********************************************************"
ui_print "! The latest version of Riru is required"
ui_print "! Please install Riru (Riru - Core) from Magisk Manager or https://github.com/RikkaApps/Riru/releases"
ui_print "! Riru $RIRU_MIN_VERSION_NAME or above is required"
ui_print "! Please upgrade Riru from Magisk Manager or https://github.com/RikkaApps/Riru/releases"
abort_clean "*********************************************************"
fi
}
Expand Down
2 changes: 1 addition & 1 deletion template/magisk_module/verify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mkdir "$TMPDIR_FOR_VERIFY"

abort_verify() {
ui_print "*********************************************************"
ui_print "! $1"
ui_print "! $1"
ui_print "! This zip may be corrupted, please try downloading again"
abort "*********************************************************"
}
Expand Down

0 comments on commit df0ae04

Please sign in to comment.