[core] Fix Android O MR1 (#544)
This commit is contained in:
parent
3fae782f0c
commit
5f68cbea36
|
|
@ -33,10 +33,13 @@
|
|||
namespace lspd {
|
||||
using namespace std::literals::string_literals;
|
||||
|
||||
static inline int32_t GetAndroidApiLevel() {
|
||||
inline int32_t GetAndroidApiLevel() {
|
||||
static int32_t api_level = []() {
|
||||
char prop_value[PROP_VALUE_MAX];
|
||||
__system_property_get("ro.build.version.sdk", prop_value);
|
||||
return atoi(prop_value);
|
||||
}();
|
||||
return api_level;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,9 @@ namespace lspd {
|
|||
(real_path &&
|
||||
std::string_view(real_path).find(kLibArtName) != std::string_view::npos)) {
|
||||
auto art = SandHook::ElfImg(real_path);
|
||||
if ((sym_openDexFileNative = reinterpret_cast<void *>(art.getSymbAddress(
|
||||
auto api_level = GetAndroidApiLevel();
|
||||
if (api_level < __ANDROID_API_P__ || (
|
||||
(sym_openDexFileNative = reinterpret_cast<void *>(art.getSymbAddress(
|
||||
"_ZN3artL25DexFile_openDexFileNativeEP7_JNIEnvP7_jclassP8_jstringS5_iP8_jobjectP13_jobjectArray"))) &&
|
||||
(
|
||||
(sym_openInMemoryDexFilesNative = reinterpret_cast<void *>(art.getSymbAddress(
|
||||
|
|
@ -137,7 +139,7 @@ namespace lspd {
|
|||
)
|
||||
) &&
|
||||
(sym_setTrusted = reinterpret_cast<void *>(art.getSymbAddress(
|
||||
"_ZN3artL18DexFile_setTrustedEP7_JNIEnvP7_jclassP8_jobject"))))
|
||||
"_ZN3artL18DexFile_setTrustedEP7_JNIEnvP7_jclassP8_jobject")))))
|
||||
return soinfo->to_handle();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue