@@ -86,22 +86,11 @@ static void loadDex(JNIEnv *env, jstring jdexPath, jstring jodexPath, jstring jc
86
86
LOGD (" target method(%s) not found" , methodName);
87
87
return ;
88
88
}
89
-
89
+
90
90
env->CallStaticVoidMethod (javaClientClass, targetMethod, jarg1);
91
91
}
92
92
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) {
105
94
char *cAppDataDir = jstringToC (env, *appDataDir);
106
95
if (cAppDataDir == NULL ) {
107
96
LOGD (" MEM ERR" );
@@ -120,25 +109,43 @@ EXPORT void nativeForkAndSpecializePre(
120
109
}
121
110
}
122
111
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 );
129
116
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,
135
122
env->NewStringUTF (dexPath),
136
123
env->NewStringUTF (appCacheDir),
137
124
env->NewStringUTF (" com.yyxx.wechatfp.xposed.plugin.XposedWeChatPlugin" ),
138
125
" main" ,
139
126
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);
142
149
} else {
143
150
// in zygote process, res is child pid
144
151
// 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(
150
157
JNIEnv *env, jclass clazz, jint *_uid, jint *gid, jintArray *gids, jint *runtimeFlags,
151
158
jobjectArray *rlimits, jint *mountExternal, jstring *seInfo, jstring *niceName,
152
159
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);
157
164
}
158
165
159
166
EXPORT __attribute__ ((visibility(" default" ))) int specializeAppProcessPost(
160
167
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);
162
170
return 0 ;
163
171
}
164
172
0 commit comments