|
10 | 10 |
|
11 | 11 | #include <riru.h> |
12 | 12 |
|
13 | | -#include "fingerprint.h" |
14 | 13 | #include "log.h" |
| 14 | +#include "fingerprint.h" |
| 15 | +#include "resource_extractor.h" |
15 | 16 |
|
16 | 17 | static bool sHookEnable = false; |
17 | 18 | static char *sAppDataDir = NULL; |
@@ -138,16 +139,22 @@ void fingerprintPost(JNIEnv *env, const char *pluginTypeName) { |
138 | 139 | char appCacheDir[PATH_MAX] = {0}; |
139 | 140 | snprintf(appCacheDir, PATH_MAX - 1, "%s/cache", sAppDataDir); |
140 | 141 | if (access(appCacheDir, 0) != 0) mkdir(appCacheDir, 0755); |
141 | | - |
142 | | - const char *dexPath = "/data/local/tmp/lib" MODULE_NAME ".debug.dex"; |
| 142 | + char appFilesDir[PATH_MAX] = {0}; |
| 143 | + snprintf(appFilesDir, PATH_MAX - 1, "%s/files", sAppDataDir); |
| 144 | + if (access(appFilesDir, 0) != 0) mkdir(appFilesDir, 0755); |
| 145 | + |
| 146 | + char dexPath[PATH_MAX] = {0}; |
| 147 | + snprintf(dexPath, PATH_MAX - 1, "%s/" MODULE_NAME ".dex", appFilesDir); |
| 148 | +#ifdef NDEBUG |
| 149 | + extractDexResource(dexPath); |
| 150 | +#else |
| 151 | + LOGD("======================================================="); |
| 152 | + LOGD("==================== DEBUG MODE ON ===================="); |
| 153 | + LOGD("======================================================="); |
143 | 154 | if (access(dexPath, 0) != 0) { |
144 | | - dexPath = "/system/framework/lib" MODULE_NAME ".dex"; |
145 | | - } |
146 | | - //https://github.com/eritpchy/FingerprintPay/issues/107 |
147 | | - if (access(dexPath, 0) != 0) { |
148 | | - LOGE("Error: dexPath:%s is not accessible", dexPath); |
149 | | - dexPath = "/data/local/tmp/lib" MODULE_NAME ".dex"; |
| 155 | + extractDexResource(dexPath); |
150 | 156 | } |
| 157 | +#endif |
151 | 158 | if (access(dexPath, 0) != 0) { |
152 | 159 | LOGE("Error: dexPath:%s is not accessible", dexPath); |
153 | 160 | return; |
|
0 commit comments