Skip to content

Commit

Permalink
fix: replace whale so file to fix crash on x86_64
Browse files Browse the repository at this point in the history
fix: hook art::OatFileManager::SetOnlyUseSystemOatFiles on AndroidQ
  • Loading branch information
imlk0 authored and solohsu committed Nov 4, 2019
1 parent c677b62 commit 7ea869e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@
/release
.externalNativeBuild
elf-cleaner.sh

# vscode
.project
.classpath
.settings/
.vscode/

dalvikdx/bin/
dexmaker/bin/
Binary file modified edxp-common/template_override/system_x86/lib64/libwhale.edxp.so
Binary file not shown.
26 changes: 26 additions & 0 deletions edxp-core/src/main/cpp/main/include/art/runtime/oat_file_manager.h
Original file line number Diff line number Diff line change
@@ -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");

}
};

}

}
3 changes: 3 additions & 0 deletions edxp-core/src/main/cpp/main/src/native_hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "art/runtime/class_linker.h"
#include "art/runtime/gc/heap.h"
#include "art/runtime/hidden_api.h"
#include "art/runtime/oat_file_manager.h"
#include "framework/fd_utils.h"

namespace edxp {
Expand Down Expand Up @@ -88,6 +89,8 @@ namespace edxp {
art::ClassLinker::Setup(art_handle, hook_func);
art::mirror::Class::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;
LOGI("ART hooks installed");
}
Expand Down
Binary file modified hiddenapi-stubs/libs/framework-stub.jar
Binary file not shown.

0 comments on commit 7ea869e

Please sign in to comment.