[core] use proper dobby interface (#356)
This commit is contained in:
parent
5297a8d543
commit
85b252c1b8
|
|
@ -41,8 +41,6 @@
|
||||||
#include "art/runtime/thread_list.h"
|
#include "art/runtime/thread_list.h"
|
||||||
#include "art/runtime/gc/scoped_gc_critical_section.h"
|
#include "art/runtime/gc/scoped_gc_critical_section.h"
|
||||||
|
|
||||||
std::vector<soinfo_t> linker_get_solist(); // Dobby but not in .h
|
|
||||||
|
|
||||||
namespace lspd {
|
namespace lspd {
|
||||||
|
|
||||||
static volatile bool installed = false;
|
static volatile bool installed = false;
|
||||||
|
|
@ -68,17 +66,16 @@ namespace lspd {
|
||||||
if (api_level >= __ANDROID_API_Q__) {
|
if (api_level >= __ANDROID_API_Q__) {
|
||||||
// From Riru v22 we can't get ART handle by hooking dlopen, so we get libart.so from soinfo.
|
// From Riru v22 we can't get ART handle by hooking dlopen, so we get libart.so from soinfo.
|
||||||
// Ref: https://android.googlesource.com/platform/bionic/+/master/linker/linker_soinfo.h
|
// Ref: https://android.googlesource.com/platform/bionic/+/master/linker/linker_soinfo.h
|
||||||
auto solist = linker_get_solist();
|
linker_iterate_soinfo([](auto soinfo) {
|
||||||
bool found = false;
|
const char *real_path = linker_soinfo_get_realpath(soinfo);
|
||||||
for (auto & it : solist) {
|
if (real_path != nullptr &&
|
||||||
const char* real_path = linker_soinfo_get_realpath(it);
|
strstr(real_path, kLibArtName.c_str()) != nullptr){
|
||||||
if (real_path != nullptr && std::string(real_path).find(kLibArtName) != std::string::npos) {
|
InstallArtHooks(soinfo);
|
||||||
found = true;
|
return 1;
|
||||||
InstallArtHooks(it);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
return 0;
|
||||||
if(!found) {
|
});
|
||||||
|
if (!art_hooks_installed) {
|
||||||
LOGE("Android 10+ detected and libart.so can't be found in memory.");
|
LOGE("Android 10+ detected and libart.so can't be found in memory.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue