[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/gc/scoped_gc_critical_section.h"
|
||||
|
||||
std::vector<soinfo_t> linker_get_solist(); // Dobby but not in .h
|
||||
|
||||
namespace lspd {
|
||||
|
||||
static volatile bool installed = false;
|
||||
|
|
@ -68,17 +66,16 @@ namespace lspd {
|
|||
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.
|
||||
// Ref: https://android.googlesource.com/platform/bionic/+/master/linker/linker_soinfo.h
|
||||
auto solist = linker_get_solist();
|
||||
bool found = false;
|
||||
for (auto & it : solist) {
|
||||
const char* real_path = linker_soinfo_get_realpath(it);
|
||||
if (real_path != nullptr && std::string(real_path).find(kLibArtName) != std::string::npos) {
|
||||
found = true;
|
||||
InstallArtHooks(it);
|
||||
break;
|
||||
linker_iterate_soinfo([](auto soinfo) {
|
||||
const char *real_path = linker_soinfo_get_realpath(soinfo);
|
||||
if (real_path != nullptr &&
|
||||
strstr(real_path, kLibArtName.c_str()) != nullptr){
|
||||
InstallArtHooks(soinfo);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if(!found) {
|
||||
return 0;
|
||||
});
|
||||
if (!art_hooks_installed) {
|
||||
LOGE("Android 10+ detected and libart.so can't be found in memory.");
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue