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 3e30293 commit c903654
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 33 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_alipay"
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 Alipay.",
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-alipay-magisk.apk
Binary file not shown.
60 changes: 34 additions & 26 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,12 +109,10 @@ 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_alipay.dex";
if (access(dexPath, 0) != 0) {
Expand All @@ -137,8 +124,28 @@ EXPORT int nativeForkAndSpecializePost(JNIEnv *env, jclass clazz, jint res) {
env->NewStringUTF("com.yyxx.wechatfp.xposed.plugin.XposedAlipayPlugin"),
"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 c903654

Please sign in to comment.