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

Commit df0ae04

Browse files
committed
+ 3.9.11 适配 Android 10 for some devices.
1 parent 0ea946b commit df0ae04

File tree

7 files changed

+49
-38
lines changed

7 files changed

+49
-38
lines changed

module.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
ext {
22
moduleId = "module_xfingerprint_pay_wechat"
3-
riruApiVersion = 4
3+
riruApiVersion = 7
4+
riruMinVersionName = "v21.2"
45

56
moduleProp = [
67
name : "指纹支付 - 微信",
7-
version : "v3.9.10",
8+
version : "v3.9.11",
89
versionCode: "1",
910
author : "Jason Eric",
1011
description: "让微信支持指纹支付 Fingerprint pay for WeChat.",

module/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ android.libraryVariants.all { variant ->
6868
filter { line ->
6969
line.replaceAll('%%%RIRU_MODULE_ID%%%', moduleId)
7070
.replaceAll('%%%RIRU_MIN_API_VERSION%%%', riruApiVersion.toString())
71+
.replaceAll('%%%RIRU_MIN_VERSION_NAME%%%', riruMinVersionName)
7172
}
7273
filter(FixCrLfFilter.class,
7374
eol: FixCrLfFilter.CrLf.newInstance("lf"))
0 Bytes
Binary file not shown.

module/src/main/cpp/main.cpp

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,11 @@ static void loadDex(JNIEnv *env, jstring jdexPath, jstring jodexPath, jstring jc
8686
LOGD("target method(%s) not found", methodName);
8787
return;
8888
}
89-
89+
9090
env->CallStaticVoidMethod(javaClientClass, targetMethod, jarg1);
9191
}
9292

93-
94-
// You can remove functions you don't need
95-
96-
extern "C" {
97-
#define EXPORT __attribute__((visibility("default"))) __attribute__((used))
98-
EXPORT void nativeForkAndSpecializePre(
99-
JNIEnv *env, jclass clazz, jint *_uid, jint *gid, jintArray *gids, jint *runtimeFlags,
100-
jobjectArray *rlimits, jint *mountExternal, jstring *seInfo, jstring *niceName,
101-
jintArray *fdsToClose, jintArray *fdsToIgnore, jboolean *is_child_zygote,
102-
jstring *instructionSet, jstring *appDataDir, jstring *packageName,
103-
jobjectArray *packagesForUID, jstring *sandboxId) {
104-
// packageName, packagesForUID, sandboxId are added from Android Q beta 2, removed from beta 5
93+
static void pre(JNIEnv *env, jstring *appDataDir, jstring *niceName) {
10594
char *cAppDataDir = jstringToC(env, *appDataDir);
10695
if (cAppDataDir == NULL) {
10796
LOGD("MEM ERR");
@@ -120,25 +109,43 @@ EXPORT void nativeForkAndSpecializePre(
120109
}
121110
}
122111

123-
EXPORT int nativeForkAndSpecializePost(JNIEnv *env, jclass clazz, jint res) {
124-
if (res == 0) {
125-
// in app process
126-
if (sHookEnable) {
127-
char appCacheDir[PATH_MAX] = {0};
128-
snprintf(appCacheDir, PATH_MAX - 1, "%s/cache", sAppDataDir);
112+
static void post(JNIEnv *env) {
113+
if (sHookEnable) {
114+
char appCacheDir[PATH_MAX] = {0};
115+
snprintf(appCacheDir, PATH_MAX - 1, "%s/cache", sAppDataDir);
129116

130-
const char *dexPath = "/data/local/tmp/libriru_module_xfingerprint_pay_wechat.dex";
131-
if (access(dexPath, 0) != 0) {
132-
dexPath = "/system/framework/libriru_module_xfingerprint_pay_wechat.dex";
133-
}
134-
loadDex(env,
117+
const char *dexPath = "/data/local/tmp/libriru_module_xfingerprint_pay_wechat.dex";
118+
if (access(dexPath, 0) != 0) {
119+
dexPath = "/system/framework/libriru_module_xfingerprint_pay_wechat.dex";
120+
}
121+
loadDex(env,
135122
env->NewStringUTF(dexPath),
136123
env->NewStringUTF(appCacheDir),
137124
env->NewStringUTF("com.yyxx.wechatfp.xposed.plugin.XposedWeChatPlugin"),
138125
"main",
139126
env->NewStringUTF(sAppDataDir)
140-
);
141-
}
127+
);
128+
}
129+
}
130+
131+
// You can remove functions you don't need
132+
133+
extern "C" {
134+
#define EXPORT __attribute__((visibility("default"))) __attribute__((used))
135+
EXPORT void nativeForkAndSpecializePre(
136+
JNIEnv *env, jclass clazz, jint *_uid, jint *gid, jintArray *gids, jint *runtimeFlags,
137+
jobjectArray *rlimits, jint *mountExternal, jstring *seInfo, jstring *niceName,
138+
jintArray *fdsToClose, jintArray *fdsToIgnore, jboolean *is_child_zygote,
139+
jstring *instructionSet, jstring *appDataDir, jboolean *isTopApp, jobjectArray *pkgDataInfoList,
140+
jobjectArray *whitelistedDataInfoList, jboolean *bindMountAppDataDirs, jboolean *bindMountAppStorageDirs) {
141+
// packageName, packagesForUID, sandboxId are added from Android Q beta 2, removed from beta 5
142+
pre(env, appDataDir, niceName);
143+
}
144+
145+
EXPORT int nativeForkAndSpecializePost(JNIEnv *env, jclass clazz, jint res) {
146+
if (res == 0) {
147+
// in app process
148+
post(env);
142149
} else {
143150
// in zygote process, res is child pid
144151
// don't print log here, see https://github.com/RikkaApps/Riru/blob/77adfd6a4a6a81bfd20569c910bc4854f2f84f5e/riru-core/jni/main/jni_native_method.cpp#L55-L66
@@ -150,15 +157,16 @@ EXPORT __attribute__((visibility("default"))) void specializeAppProcessPre(
150157
JNIEnv *env, jclass clazz, jint *_uid, jint *gid, jintArray *gids, jint *runtimeFlags,
151158
jobjectArray *rlimits, jint *mountExternal, jstring *seInfo, jstring *niceName,
152159
jboolean *startChildZygote, jstring *instructionSet, jstring *appDataDir,
153-
jstring *packageName, jobjectArray *packagesForUID, jstring *sandboxId) {
154-
// this is added from Android Q beta, but seems Google disabled this in following updates
155-
156-
// packageName, packagesForUID, sandboxId are added from Android Q beta 2, removed from beta 5
160+
jboolean *isTopApp, jobjectArray *pkgDataInfoList, jobjectArray *whitelistedDataInfoList,
161+
jboolean *bindMountAppDataDirs, jboolean *bindMountAppStorageDirs) {
162+
// added from Android 10, but disabled at least in Google Pixel devices
163+
pre(env, appDataDir, niceName);
157164
}
158165

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

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include ':module'
1+
include ':module'

template/magisk_module/riru.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ RIRU_PATH="/data/misc/riru"
33
RIRU_MODULE_ID="%%%RIRU_MODULE_ID%%%"
44
RIRU_MODULE_PATH="$RIRU_PATH/modules/$RIRU_MODULE_ID"
55
RIRU_MIN_API_VERSION=%%%RIRU_MIN_API_VERSION%%%
6+
RIRU_MIN_VERSION_NAME="%%%RIRU_MIN_VERSION_NAME%%%"
67

78
abort_clean() {
89
rm -rf "$MODPATH"
@@ -13,16 +14,16 @@ check_riru_version() {
1314
if [ ! -f "$RIRU_PATH/api_version" ] && [ ! -f "$RIRU_PATH/api_version.new" ]; then
1415
ui_print "*********************************************************"
1516
ui_print "! Riru is not installed"
16-
ui_print "! Please install Riru (Riru - Core) from Magisk Manager or https://github.com/RikkaApps/Riru/releases"
17+
ui_print "! Please install Riru from Magisk Manager or https://github.com/RikkaApps/Riru/releases"
1718
abort_clean "*********************************************************"
1819
fi
1920
RIRU_API_VERSION=$(cat "$RIRU_PATH/api_version.new") || RIRU_API_VERSION=$(cat "$RIRU_PATH/api_version") || RIRU_API_VERSION=0
2021
[ "$RIRU_API_VERSION" -eq "$RIRU_API_VERSION" ] || RIRU_API_VERSION=0
2122
ui_print "- Riru API version: $RIRU_API_VERSION"
2223
if [ "$RIRU_API_VERSION" -lt $RIRU_MIN_API_VERSION ]; then
2324
ui_print "*********************************************************"
24-
ui_print "! The latest version of Riru is required"
25-
ui_print "! Please install Riru (Riru - Core) from Magisk Manager or https://github.com/RikkaApps/Riru/releases"
25+
ui_print "! Riru $RIRU_MIN_VERSION_NAME or above is required"
26+
ui_print "! Please upgrade Riru from Magisk Manager or https://github.com/RikkaApps/Riru/releases"
2627
abort_clean "*********************************************************"
2728
fi
2829
}

template/magisk_module/verify.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mkdir "$TMPDIR_FOR_VERIFY"
33

44
abort_verify() {
55
ui_print "*********************************************************"
6-
ui_print "! $1"
6+
ui_print "! $1"
77
ui_print "! This zip may be corrupted, please try downloading again"
88
abort "*********************************************************"
99
}

0 commit comments

Comments
 (0)