fix: replace whale so file to fix crash on x86_64

fix: hook art::OatFileManager::SetOnlyUseSystemOatFiles on AndroidQ
This commit is contained in:
imlk 2019-10-30 18:00:58 +08:00 committed by solohsu
parent c677b622b3
commit 7ea869e600
5 changed files with 38 additions and 0 deletions

9
.gitignore vendored
View File

@ -12,3 +12,12 @@
/release /release
.externalNativeBuild .externalNativeBuild
elf-cleaner.sh elf-cleaner.sh
# vscode
.project
.classpath
.settings/
.vscode/
dalvikdx/bin/
dexmaker/bin/

View File

@ -0,0 +1,26 @@
#pragma once
#include "base/object.h"
namespace art {
namespace oat_file_manager {
CREATE_HOOK_STUB_ENTRIES(void, SetOnlyUseSystemOatFiles) {
return;
}
// http://androidxref.com/9.0.0_r3/xref/art/runtime/oat_file_manager.cc#637
static void DisableOnlyUseSystemOatFiles(void *handle, HookFunType hook_func) {
const int api_level = GetAndroidApiLevel();
if (api_level == ANDROID_P) {
HOOK_FUNC(SetOnlyUseSystemOatFiles,
"_ZN3art14OatFileManager24SetOnlyUseSystemOatFilesEv");
}
};
}
}

View File

@ -16,6 +16,7 @@
#include "art/runtime/class_linker.h" #include "art/runtime/class_linker.h"
#include "art/runtime/gc/heap.h" #include "art/runtime/gc/heap.h"
#include "art/runtime/hidden_api.h" #include "art/runtime/hidden_api.h"
#include "art/runtime/oat_file_manager.h"
#include "framework/fd_utils.h" #include "framework/fd_utils.h"
namespace edxp { namespace edxp {
@ -88,6 +89,8 @@ namespace edxp {
art::ClassLinker::Setup(art_handle, hook_func); art::ClassLinker::Setup(art_handle, hook_func);
art::mirror::Class::Setup(art_handle, hook_func); art::mirror::Class::Setup(art_handle, hook_func);
art::JNIEnvExt::Setup(art_handle, hook_func); art::JNIEnvExt::Setup(art_handle, hook_func);
art::oat_file_manager::DisableOnlyUseSystemOatFiles(art_handle, hook_func);
art_hooks_installed = true; art_hooks_installed = true;
LOGI("ART hooks installed"); LOGI("ART hooks installed");
} }