Merge branch 'master' into android_r
# Conflicts: # appveyor.yml # edxp-core/build.gradle # edxp-core/src/main/cpp/external/yahfa/src/HookMain.c # edxp-core/src/main/cpp/external/yahfa/src/env.h # edxp-core/src/main/cpp/main/include/android_build.h # edxp-core/src/main/cpp/main/include/art/runtime/oat_file_manager.h # edxp-core/src/main/cpp/main/include/config.h # edxp-core/src/main/cpp/main/src/native_hook.cpp
This commit is contained in:
commit
1a7957e2ad
|
|
@ -25,6 +25,8 @@ artifacts:
|
|||
pull_requests:
|
||||
do_not_increment_build_number: true
|
||||
|
||||
skip_tags: true
|
||||
|
||||
only_commits:
|
||||
files:
|
||||
- dalvikdx/
|
||||
|
|
@ -39,4 +41,4 @@ only_commits:
|
|||
- build.gradle
|
||||
- settings.gradle
|
||||
- gradle.properties
|
||||
- appveyor.yml
|
||||
- appveyor.yml
|
||||
|
|
|
|||
|
|
@ -8,17 +8,34 @@ dependencies {
|
|||
sourceCompatibility = "7"
|
||||
targetCompatibility = "7"
|
||||
|
||||
task findDx {
|
||||
if (OperatingSystem.current().isWindows()){
|
||||
return true
|
||||
}
|
||||
doLast {
|
||||
new ByteArrayOutputStream().withStream { os ->
|
||||
exec {
|
||||
commandLine "which", "dx"
|
||||
standardOutput os
|
||||
}
|
||||
rootProject.ext.dxPath = os.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task dexInJar(type: Jar) {
|
||||
dependsOn jar
|
||||
dependsOn findDx
|
||||
doFirst {
|
||||
exec {
|
||||
workingDir jar.destinationDir
|
||||
if (OperatingSystem.current().isWindows())
|
||||
if (OperatingSystem.current().isWindows()){
|
||||
executable "dx.bat"
|
||||
else
|
||||
executable "dx"
|
||||
args "--dex", "--output", "classes.dex", "${jar.archiveName}"
|
||||
args "--dex", "--output", "classes.dex", "${jar.archiveName}"
|
||||
} else {
|
||||
executable "bash"
|
||||
args rootProject.ext.dxPath.trim(), "--dex", "--output", "classes.dex", "${jar.archiveName}"
|
||||
}
|
||||
}
|
||||
}
|
||||
from "${jar.destinationDir}/classes.dex"
|
||||
|
|
|
|||
|
|
@ -19,11 +19,13 @@ task dexInJar(type: Jar) {
|
|||
doFirst {
|
||||
exec {
|
||||
workingDir jar.destinationDir
|
||||
if (OperatingSystem.current().isWindows())
|
||||
if (OperatingSystem.current().isWindows()){
|
||||
executable "dx.bat"
|
||||
else
|
||||
executable "dx"
|
||||
args "--dex", "--output", "classes.dex", "${jar.archiveName}"
|
||||
args "--dex", "--output", "classes.dex", "${jar.archiveName}"
|
||||
} else {
|
||||
executable "bash"
|
||||
args rootProject.ext.dxPath.trim(), "--dex", "--output", "classes.dex", "${jar.archiveName}"
|
||||
}
|
||||
}
|
||||
}
|
||||
from "${jar.destinationDir}/classes.dex"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class Yahfa {
|
|||
// JNI.ToReflectedMethod() could return either Method or Constructor
|
||||
public static native Object findMethodNative(Class targetClass, String methodName, String methodSig);
|
||||
|
||||
public static native void init(int SDK_version);
|
||||
public static native void init(int sdkVersion);
|
||||
|
||||
public static native void setMethodNonCompilable(Member member);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include <stdbool.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "env.h"
|
||||
#include "trampoline.h"
|
||||
#include "HookMain.h"
|
||||
|
||||
|
|
@ -24,10 +23,6 @@ static int kAccFastInterpreterToInterpreterInvoke = 0x40000000;
|
|||
|
||||
static jfieldID fieldArtMethod = NULL;
|
||||
|
||||
static inline uint16_t read16(void *addr) {
|
||||
return *((uint16_t *) addr);
|
||||
}
|
||||
|
||||
static inline uint32_t read32(void *addr) {
|
||||
return *((uint32_t *) addr);
|
||||
}
|
||||
|
|
@ -36,17 +31,21 @@ static inline void write32(void *addr, uint32_t value) {
|
|||
*((uint32_t *) addr) = value;
|
||||
}
|
||||
|
||||
static inline void* readAddr(void *addr) {
|
||||
return *((void**) addr);
|
||||
}
|
||||
|
||||
void Java_lab_galaxy_yahfa_HookMain_init(JNIEnv *env, jclass clazz, jint sdkVersion) {
|
||||
int i;
|
||||
SDKVersion = sdkVersion;
|
||||
jclass classExecutable;
|
||||
LOGI("init to SDK %d", sdkVersion);
|
||||
switch (sdkVersion) {
|
||||
case ANDROID_R:
|
||||
case __ANDROID_API_R__:
|
||||
classExecutable = (*env)->FindClass(env, "java/lang/reflect/Executable");
|
||||
fieldArtMethod = (*env)->GetFieldID(env, classExecutable, "artMethod", "J");
|
||||
case ANDROID_Q:
|
||||
case ANDROID_P:
|
||||
case __ANDROID_API_Q__:
|
||||
case __ANDROID_API_P__:
|
||||
kAccCompileDontBother = 0x02000000;
|
||||
OFFSET_ArtMehod_in_Object = 0;
|
||||
OFFSET_access_flags_in_ArtMethod = 4;
|
||||
|
|
@ -56,9 +55,9 @@ void Java_lab_galaxy_yahfa_HookMain_init(JNIEnv *env, jclass clazz, jint sdkVers
|
|||
roundUpToPtrSize(4 * 4 + 2 * 2) + pointer_size;
|
||||
ArtMethodSize = roundUpToPtrSize(4 * 4 + 2 * 2) + pointer_size * 2;
|
||||
break;
|
||||
case ANDROID_O2:
|
||||
case __ANDROID_API_O_MR1__:
|
||||
kAccCompileDontBother = 0x02000000;
|
||||
case ANDROID_O:
|
||||
case __ANDROID_API_O__:
|
||||
OFFSET_ArtMehod_in_Object = 0;
|
||||
OFFSET_access_flags_in_ArtMethod = 4;
|
||||
OFFSET_dex_method_index_in_ArtMethod = 4 * 3;
|
||||
|
|
@ -68,8 +67,8 @@ void Java_lab_galaxy_yahfa_HookMain_init(JNIEnv *env, jclass clazz, jint sdkVers
|
|||
roundUpToPtrSize(4 * 4 + 2 * 2) + pointer_size * 2;
|
||||
ArtMethodSize = roundUpToPtrSize(4 * 4 + 2 * 2) + pointer_size * 3;
|
||||
break;
|
||||
case ANDROID_N2:
|
||||
case ANDROID_N:
|
||||
case __ANDROID_API_N_MR1__:
|
||||
case __ANDROID_API_N__:
|
||||
OFFSET_ArtMehod_in_Object = 0;
|
||||
OFFSET_access_flags_in_ArtMethod = 4; // sizeof(GcRoot<mirror::Class>) = 4
|
||||
OFFSET_dex_method_index_in_ArtMethod = 4 * 3;
|
||||
|
|
@ -82,7 +81,7 @@ void Java_lab_galaxy_yahfa_HookMain_init(JNIEnv *env, jclass clazz, jint sdkVers
|
|||
|
||||
ArtMethodSize = roundUpToPtrSize(4 * 4 + 2 * 2) + pointer_size * 4;
|
||||
break;
|
||||
case ANDROID_M:
|
||||
case __ANDROID_API_M__:
|
||||
OFFSET_ArtMehod_in_Object = 0;
|
||||
OFFSET_entry_point_from_interpreter_in_ArtMethod = roundUpToPtrSize(4 * 7);
|
||||
OFFSET_entry_point_from_quick_compiled_code_in_ArtMethod =
|
||||
|
|
@ -92,7 +91,7 @@ void Java_lab_galaxy_yahfa_HookMain_init(JNIEnv *env, jclass clazz, jint sdkVers
|
|||
OFFSET_array_in_PointerArray = 4 * 3;
|
||||
ArtMethodSize = roundUpToPtrSize(4 * 7) + pointer_size * 3;
|
||||
break;
|
||||
case ANDROID_L2:
|
||||
case __ANDROID_API_L_MR1__:
|
||||
OFFSET_ArtMehod_in_Object = 4 * 2;
|
||||
OFFSET_entry_point_from_interpreter_in_ArtMethod = roundUpToPtrSize(
|
||||
OFFSET_ArtMehod_in_Object + 4 * 7);
|
||||
|
|
@ -103,7 +102,7 @@ void Java_lab_galaxy_yahfa_HookMain_init(JNIEnv *env, jclass clazz, jint sdkVers
|
|||
OFFSET_array_in_PointerArray = 12;
|
||||
ArtMethodSize = OFFSET_entry_point_from_interpreter_in_ArtMethod + pointer_size * 3;
|
||||
break;
|
||||
case ANDROID_L:
|
||||
case __ANDROID_API_L__:
|
||||
OFFSET_ArtMehod_in_Object = 4 * 2;
|
||||
OFFSET_entry_point_from_interpreter_in_ArtMethod = OFFSET_ArtMehod_in_Object + 4 * 4;
|
||||
OFFSET_entry_point_from_quick_compiled_code_in_ArtMethod =
|
||||
|
|
@ -123,7 +122,7 @@ void Java_lab_galaxy_yahfa_HookMain_init(JNIEnv *env, jclass clazz, jint sdkVers
|
|||
}
|
||||
|
||||
void setNonCompilable(void *method) {
|
||||
if (SDKVersion < ANDROID_N) {
|
||||
if (SDKVersion < __ANDROID_API_N__) {
|
||||
return;
|
||||
}
|
||||
int access_flags = read32((char *) method + OFFSET_access_flags_in_ArtMethod);
|
||||
|
|
@ -138,7 +137,7 @@ bool setNativeFlag(void *method, bool isNative) {
|
|||
int old_access_flags = access_flags;
|
||||
if (isNative) {
|
||||
access_flags |= kAccNative;
|
||||
if (SDKVersion >= ANDROID_Q) {
|
||||
if (SDKVersion >= __ANDROID_API_Q__) {
|
||||
// On API 29 whether to use the fast path or not is cached in the ART method structure
|
||||
access_flags &= ~kAccFastInterpreterToInterpreterInvoke;
|
||||
}
|
||||
|
|
@ -168,7 +167,7 @@ static int doBackupAndHook(JNIEnv *env, void *targetMethod, void *hookMethod, vo
|
|||
|
||||
// set kAccCompileDontBother for a method we do not want the compiler to compile
|
||||
// so that we don't need to worry about hotness_count_
|
||||
if (SDKVersion >= ANDROID_N) {
|
||||
if (SDKVersion >= __ANDROID_API_N__) {
|
||||
setNonCompilable(targetMethod);
|
||||
setNonCompilable(hookMethod);
|
||||
}
|
||||
|
|
@ -205,9 +204,8 @@ static int doBackupAndHook(JNIEnv *env, void *targetMethod, void *hookMethod, vo
|
|||
}
|
||||
|
||||
// set the target method to native so that Android O wouldn't invoke it with interpreter
|
||||
if (SDKVersion >= ANDROID_O) {
|
||||
if (SDKVersion >= __ANDROID_API_O__) {
|
||||
setNativeFlag(targetMethod, true);
|
||||
LOGI("access flags is 0x%x", access_flags);
|
||||
}
|
||||
|
||||
LOGI("hook and backup done");
|
||||
|
|
@ -241,7 +239,7 @@ static void ensureMethodCached(void *hookMethod, void *backupMethod,
|
|||
}
|
||||
|
||||
// finally the addr of backup method is put at the corresponding location in cached methods array
|
||||
if (SDKVersion >= ANDROID_O2) {
|
||||
if (SDKVersion >= __ANDROID_API_O_MR1__) {
|
||||
// array of MethodDexCacheType is used as dexCacheResolvedMethods in Android 8.1
|
||||
// struct:
|
||||
// struct NativeDexCachePair<T> = { T*, size_t idx }
|
||||
|
|
@ -272,7 +270,7 @@ static void *getArtMethod(JNIEnv *env, jobject jmethod) {
|
|||
return artMethod;
|
||||
}
|
||||
|
||||
if(SDKVersion == ANDROID_R) {
|
||||
if(SDKVersion == __ANDROID_API_R__) {
|
||||
artMethod = (void *) (*env)->GetLongField(env, jmethod, fieldArtMethod);
|
||||
}
|
||||
else {
|
||||
|
|
@ -348,11 +346,11 @@ static void *getResolvedMethodsAddr(JNIEnv *env, jobject hook) {
|
|||
jobject dexCacheObj = (*env)->GetObjectField(env, backupClass, dexCacheFid);
|
||||
// get resolvedMethods address
|
||||
jclass dexCacheClass = (*env)->GetObjectClass(env, dexCacheObj);
|
||||
if (SDKVersion >= ANDROID_N) {
|
||||
if (SDKVersion >= __ANDROID_API_N__) {
|
||||
jfieldID resolvedMethodsFid = (*env)->GetFieldID(env, dexCacheClass, "resolvedMethods",
|
||||
"J");
|
||||
return (void *) (*env)->GetLongField(env, dexCacheObj, resolvedMethodsFid);
|
||||
} else if (SDKVersion >= ANDROID_L) {
|
||||
} else if (SDKVersion >= __ANDROID_API_L__) {
|
||||
LOGE("this should has been done in java world: %d", SDKVersion);
|
||||
return 0;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -26,4 +26,7 @@
|
|||
#endif // DEBUG
|
||||
#endif // LOG_DISABLED
|
||||
|
||||
#define pointer_size sizeof(void*)
|
||||
#define roundUpToPtrSize(v) (v + pointer_size - 1 - ((v + pointer_size - 1) & (pointer_size - 1)))
|
||||
|
||||
#endif //YAHFA_COMMON_H
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
//
|
||||
// Created by liuruikai756 on 05/07/2017.
|
||||
//
|
||||
|
||||
#ifndef YAHFA_ENV_H
|
||||
#define YAHFA_ENV_H
|
||||
|
||||
#define ANDROID_L 21
|
||||
#define ANDROID_L2 22
|
||||
#define ANDROID_M 23
|
||||
#define ANDROID_N 24
|
||||
#define ANDROID_N2 25
|
||||
#define ANDROID_O 26
|
||||
#define ANDROID_O2 27
|
||||
#define ANDROID_P 28
|
||||
#define ANDROID_Q 29
|
||||
#define ANDROID_R 30
|
||||
|
||||
#define roundUpTo4(v) ((v+4-1) - ((v+4-1)&3))
|
||||
#define roundUpTo8(v) ((v+8-1) - ((v+8-1)&7))
|
||||
|
||||
#if defined(__i386__) || defined(__arm__)
|
||||
#define pointer_size 4
|
||||
#define readAddr(addr) read32(addr)
|
||||
#define roundUpToPtrSize(x) roundUpTo4(x)
|
||||
#elif defined(__aarch64__) || defined(__x86_64__)
|
||||
#define pointer_size 8
|
||||
#define readAddr(addr) read64(addr)
|
||||
#define roundUpToPtrSize(x) roundUpTo8(x)
|
||||
#else
|
||||
#error Unsupported architecture
|
||||
#endif
|
||||
|
||||
#endif //YAHFA_ENV_H
|
||||
|
|
@ -12,7 +12,6 @@
|
|||
#include <sys/syscall.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "env.h"
|
||||
#include "trampoline.h"
|
||||
|
||||
static unsigned char *trampolineCode; // place where trampolines are saved
|
||||
|
|
@ -89,6 +88,9 @@ void *genTrampoline(void *hookMethod) {
|
|||
|
||||
#elif defined(__aarch64__)
|
||||
memcpy(targetAddr + 12, &hookMethod, pointer_size);
|
||||
|
||||
#else
|
||||
#error Unsupported architecture
|
||||
#endif
|
||||
|
||||
return targetAddr;
|
||||
|
|
@ -106,6 +108,8 @@ void setupTrampoline() {
|
|||
((unsigned char) OFFSET_entry_point_from_quick_compiled_code_in_ArtMethod) << 4;
|
||||
trampoline[6] |=
|
||||
((unsigned char) OFFSET_entry_point_from_quick_compiled_code_in_ArtMethod) >> 4;
|
||||
#else
|
||||
#error Unsupported architecture
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +123,7 @@ int doInitHookCap(unsigned int cap) {
|
|||
}
|
||||
unsigned int allSize = trampolineSize * cap;
|
||||
unsigned char *buf = mmap(NULL, allSize, PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||
MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
|
||||
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
|
||||
if (buf == MAP_FAILED) {
|
||||
LOGE("mmap failed, errno = %s", strerror(errno));
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -5,24 +5,6 @@
|
|||
#include <cstdlib>
|
||||
#include <sys/system_properties.h>
|
||||
|
||||
#define ANDROID_ICE_CREAM_SANDWICH 14
|
||||
#define ANDROID_ICE_CREAM_SANDWICH_MR1 15
|
||||
#define ANDROID_JELLY_BEAN 16
|
||||
#define ANDROID_JELLY_BEAN_MR1 17
|
||||
#define ANDROID_JELLY_BEAN_MR2 18
|
||||
#define ANDROID_KITKAT 19
|
||||
#define ANDROID_KITKAT_WATCH 20
|
||||
#define ANDROID_LOLLIPOP 21
|
||||
#define ANDROID_LOLLIPOP_MR1 22
|
||||
#define ANDROID_M 23
|
||||
#define ANDROID_N 24
|
||||
#define ANDROID_N_MR1 25
|
||||
#define ANDROID_O 26
|
||||
#define ANDROID_O_MR1 27
|
||||
#define ANDROID_P 28
|
||||
#define ANDROID_Q 29
|
||||
#define ANDROID_R 30
|
||||
|
||||
static inline int32_t GetAndroidApiLevel() {
|
||||
char prop_value[PROP_VALUE_MAX];
|
||||
__system_property_get("ro.build.version.sdk", prop_value);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace art {
|
|||
|
||||
HOOK_FUNC(FixupStaticTrampolines,
|
||||
"_ZN3art11ClassLinker22FixupStaticTrampolinesENS_6ObjPtrINS_6mirror5ClassEEE");
|
||||
if (GetAndroidApiLevel() >= ANDROID_R) {
|
||||
if (GetAndroidApiLevel() >= __ANDROID_API_R__) {
|
||||
HOOK_FUNC(ShouldUseInterpreterEntrypoint,
|
||||
"_ZN3art11ClassLinker30ShouldUseInterpreterEntrypointEPNS_9ArtMethodEPKv");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ namespace art {
|
|||
|
||||
static void DisableHiddenApi(void *handle, HookFunType hook_func) {
|
||||
const int api_level = GetAndroidApiLevel();
|
||||
if (api_level < ANDROID_P) {
|
||||
if (api_level < __ANDROID_API_P__) {
|
||||
return;
|
||||
}
|
||||
if (api_level == ANDROID_P) {
|
||||
if (api_level == __ANDROID_API_P__) {
|
||||
HOOK_FUNC(GetMethodActionImpl,
|
||||
"_ZN3art9hiddenapi6detail19GetMemberActionImplINS_9ArtMethodEEENS0_"
|
||||
"6ActionEPT_NS_20HiddenApiAccessFlags7ApiListES4_NS0_12AccessMethodE");
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ namespace art {
|
|||
// 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) {
|
||||
if (api_level >= __ANDROID_API_P__) {
|
||||
HOOK_FUNC(SetOnlyUseSystemOatFiles,
|
||||
"_ZN3art14OatFileManager24SetOnlyUseSystemOatFilesEv", // 9 & 11
|
||||
"_ZN3art14OatFileManager24SetOnlyUseSystemOatFilesEbb"); // 10
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ namespace edxp {
|
|||
};
|
||||
|
||||
ConfigManager::ConfigManager() {
|
||||
use_prot_storage_ = GetAndroidApiLevel() >= ANDROID_N;
|
||||
use_prot_storage_ = GetAndroidApiLevel() >= __ANDROID_API_N__;
|
||||
last_user_ = 0;
|
||||
UpdateConfigPath(last_user_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace edxp {
|
|||
}
|
||||
LOGI("Start to install inline hooks");
|
||||
int api_level = GetAndroidApiLevel();
|
||||
if (UNLIKELY(api_level < ANDROID_LOLLIPOP)) {
|
||||
if (UNLIKELY(api_level < __ANDROID_API_L__)) {
|
||||
LOGE("API level not supported: %d, skip inline hooks", api_level);
|
||||
return;
|
||||
}
|
||||
|
|
@ -69,7 +69,7 @@ namespace edxp {
|
|||
}
|
||||
hook_func = reinterpret_cast<HookFunType>(hook_func_symbol);
|
||||
|
||||
if (api_level >= ANDROID_Q) {
|
||||
if (api_level >= __ANDROID_API_Q__) {
|
||||
InstallLinkerHooks(kLinkerPath.c_str());
|
||||
} else {
|
||||
ScopedDlHandle art_handle(kLibArtLegacyPath.c_str());
|
||||
|
|
|
|||
|
|
@ -14,10 +14,16 @@
|
|||
namespace edxp {
|
||||
|
||||
static int api_level = 0;
|
||||
|
||||
//Max length of property values
|
||||
//Ref https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/os/SystemProperties.java
|
||||
//static const int PROP_VALUE_MAX = 91;
|
||||
|
||||
NEW_FUNC_DEF(int, __system_property_get, const char *key, char *value) {
|
||||
int res = old___system_property_get(key, value);
|
||||
|
||||
if (key) {
|
||||
/*
|
||||
if (strcmp(kPropKeyCompilerFilter, key) == 0) {
|
||||
strcpy(value, kPropValueCompilerFilter);
|
||||
LOGI("system_property_get: %s -> %s", key, value);
|
||||
|
|
@ -25,7 +31,30 @@ namespace edxp {
|
|||
strcpy(value, kPropValueCompilerFlags);
|
||||
LOGI("system_property_get: %s -> %s", key, value);
|
||||
}
|
||||
if (api_level == ANDROID_O_MR1) {
|
||||
*/
|
||||
|
||||
if(strcmp(kPropKeyCompilerFlags, key) == 0) {
|
||||
if(strcmp(value,"") == 0)
|
||||
strcpy(value, kPropValueCompilerFlags);
|
||||
else {
|
||||
if(strstr(value,kPropValueCompilerFlags) == NULL) {
|
||||
if(strlen(value) + strlen(kPropValueCompilerFlagsWS) > PROP_VALUE_MAX) {
|
||||
//just fallback,why not
|
||||
LOGI("Cannot add option to disable inline opt!Fall back to replace..");
|
||||
strcpy(value, kPropValueCompilerFlags);
|
||||
}else {
|
||||
strcat(value,kPropValueCompilerFlagsWS);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(strstr(value,kPropValueCompilerFlags) != NULL)
|
||||
LOGI("system_property_get: %s -> %s", key, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (api_level == __ANDROID_API_O_MR1__) {
|
||||
// https://android.googlesource.com/platform/art/+/f5516d38736fb97bfd0435ad03bbab17ddabbe4e
|
||||
// Android 8.1 add a fatal check for debugging (removed in Android 9.0),
|
||||
// which will be triggered by EdXposed in cases where target method is hooked
|
||||
|
|
@ -48,6 +77,7 @@ namespace edxp {
|
|||
const std::string &key, const std::string &default_value) {
|
||||
std::string res = old__ZN7android4base11GetPropertyERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_(
|
||||
key, default_value);
|
||||
/*
|
||||
if (strcmp(kPropKeyCompilerFilter, key.c_str()) == 0) {
|
||||
res = kPropValueCompilerFilter;
|
||||
LOGI("android::base::GetProperty: %s -> %s", key.c_str(), res.c_str());
|
||||
|
|
@ -55,7 +85,28 @@ namespace edxp {
|
|||
res = kPropValueCompilerFlags;
|
||||
LOGI("android::base::GetProperty: %s -> %s", key.c_str(), res.c_str());
|
||||
}
|
||||
if (api_level == ANDROID_O_MR1) {
|
||||
*/
|
||||
|
||||
if(strcmp(kPropKeyCompilerFlags, key.c_str()) == 0) {
|
||||
if(strcmp(res.c_str(),"") == 0)
|
||||
res = kPropValueCompilerFlags;
|
||||
else{
|
||||
if(strstr(res.c_str(),kPropValueCompilerFlags) == NULL) {
|
||||
if(strlen(res.c_str()) + strlen(kPropValueCompilerFlagsWS) > PROP_VALUE_MAX) {
|
||||
//just fallback,why not
|
||||
LOGI("Cannot add option to disable inline opt!Fall back to replace..");
|
||||
res = kPropValueCompilerFlags;
|
||||
}else {
|
||||
res.append(kPropValueCompilerFlagsWS);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(strstr(res.c_str(),kPropValueCompilerFlags) != NULL)
|
||||
LOGI("android::base::GetProperty: %s -> %s", key.c_str(), res.c_str());
|
||||
}
|
||||
|
||||
|
||||
if (api_level == __ANDROID_API_O_MR1__) {
|
||||
// see __system_property_get hook above for explanations
|
||||
if (strcmp(kPropKeyUseJitProfiles, key.c_str()) == 0) {
|
||||
res = "false";
|
||||
|
|
@ -75,7 +126,7 @@ namespace edxp {
|
|||
|
||||
XHOOK_REGISTER(__system_property_get);
|
||||
|
||||
if (GetAndroidApiLevel() >= ANDROID_P) {
|
||||
if (GetAndroidApiLevel() >= __ANDROID_API_P__) {
|
||||
XHOOK_REGISTER(
|
||||
_ZN7android4base11GetPropertyERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_);
|
||||
}
|
||||
|
|
@ -88,4 +139,4 @@ namespace edxp {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ namespace edxp {
|
|||
static constexpr const char *kPropValueCompilerFilter = "quicken";
|
||||
static constexpr const char *kPropValuePmBgDexopt = "speed";
|
||||
static constexpr const char *kPropValueCompilerFlags = "--inline-max-code-units=0";
|
||||
static constexpr const char *kPropValueCompilerFlagsWS = " --inline-max-code-units=0";
|
||||
|
||||
|
||||
void InstallRiruHooks();
|
||||
|
|
|
|||
|
|
@ -85,6 +85,19 @@ if [[ -f ${DISABLE_VERBOSE_LOG_FILE} ]]; then
|
|||
LOG_VERBOSE=false
|
||||
fi
|
||||
|
||||
# If logcat client is kicked out by klogd server, we'll restart it.
|
||||
# However, if it is killed manually or by EdXposed Manager, we'll exit.
|
||||
# Refer to https://github.com/ElderDrivers/EdXposed/pull/575 for more information.
|
||||
loop_logcat() {
|
||||
while true
|
||||
do
|
||||
logcat $*
|
||||
if [[ $? -ne 1 ]]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
start_log_cather () {
|
||||
LOG_FILE_NAME=$1
|
||||
LOG_TAG_FILTERS=$2
|
||||
|
|
@ -126,7 +139,7 @@ start_log_cather () {
|
|||
echo "Riru version: ${RIRU_VERSION} (${RIRU_VERCODE})">>${LOG_FILE}
|
||||
echo "Riru api: ${RIRU_APICODE}">>${LOG_FILE}
|
||||
echo "Magisk: ${MAGISK_VERSION%:*} (${MAGISK_VERCODE})">>${LOG_FILE}
|
||||
logcat -f ${LOG_FILE} *:S ${LOG_TAG_FILTERS} &
|
||||
loop_logcat -f ${LOG_FILE} *:S ${LOG_TAG_FILTERS} &
|
||||
LOG_PID=$!
|
||||
echo "${LOG_PID}">"${LOG_PATH}/${LOG_FILE_NAME}.pid"
|
||||
}
|
||||
|
|
@ -167,4 +180,4 @@ fi
|
|||
chcon -R u:object_r:system_file:s0 "${MODDIR}"
|
||||
chcon -R ${PATH_CONTEXT} "${LOG_PATH}"
|
||||
chown -R ${PATH_OWNER} "${LOG_PATH}"
|
||||
chmod -R 666 "${LOG_PATH}"
|
||||
chmod -R 666 "${LOG_PATH}"
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
dalvik.vm.dex2oat-filter=quicken
|
||||
#dalvik.vm.dex2oat-filter=quicken
|
||||
dalvik.vm.dex2oat-flags=--inline-max-code-units=0
|
||||
#dalvik.vm.image-dex2oat-flags=--inline-max-code-units=0 --compiler-filter=speed
|
||||
#dalvik.vm.image-dex2oat-flags=--inline-max-code-units=0 --compiler-filter=speed
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ android {
|
|||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
multiDexEnabled true
|
||||
multiDexEnabled false
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
@ -62,8 +62,10 @@ afterEvaluate {
|
|||
|
||||
task("makeAndCopy${variantNameCapped}", type: Jar, dependsOn: "assemble${variantNameCapped}") {
|
||||
dependsOn tasks.getByPath(":edxp-common:copyCommonProperties")
|
||||
from "${buildDir}/intermediates/transforms/dexMerger/${variantNameLowered}/0/",
|
||||
"${projectDir}/src/main/resources/"
|
||||
def dexOutPath = variant.name.contains("release") ?
|
||||
"${buildDir}/intermediates/transforms/dexMerger/${variantNameLowered}/0/" :
|
||||
"${buildDir}/intermediates/dex/${variantNameLowered}/mergeDex${variantNameCapped}/out/"
|
||||
from dexOutPath, "${projectDir}/src/main/resources/"
|
||||
destinationDir file(myTemplatePath + "system/framework/")
|
||||
baseName "edxp"
|
||||
doLast {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ android {
|
|||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
multiDexEnabled true
|
||||
multiDexEnabled false
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
@ -61,8 +61,10 @@ afterEvaluate {
|
|||
|
||||
task("makeAndCopy${variantNameCapped}", type: Jar, dependsOn: "assemble${variantNameCapped}") {
|
||||
dependsOn tasks.getByPath(":edxp-common:copyCommonProperties")
|
||||
from "${buildDir}/intermediates/transforms/dexMerger/${variantNameLowered}/0/",
|
||||
"${projectDir}/src/main/resources/"
|
||||
def dexOutPath = variant.name.contains("release") ?
|
||||
"${buildDir}/intermediates/transforms/dexMerger/${variantNameLowered}/0/" :
|
||||
"${buildDir}/intermediates/dex/${variantNameLowered}/mergeDex${variantNameCapped}/out/"
|
||||
from dexOutPath, "${projectDir}/src/main/resources/"
|
||||
destinationDir file(myTemplatePath + "system/framework/")
|
||||
baseName "edxp"
|
||||
doLast {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ android {
|
|||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
multiDexEnabled true
|
||||
multiDexEnabled false
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
|
@ -61,8 +61,10 @@ afterEvaluate {
|
|||
|
||||
task("makeAndCopy${variantNameCapped}", type: Jar, dependsOn: "assemble${variantNameCapped}") {
|
||||
dependsOn tasks.getByPath(":edxp-common:copyCommonProperties")
|
||||
from "${buildDir}/intermediates/transforms/dexMerger/${variantNameLowered}/0/",
|
||||
"${projectDir}/src/main/resources/"
|
||||
def dexOutPath = variant.name.contains("release") ?
|
||||
"${buildDir}/intermediates/transforms/dexMerger/${variantNameLowered}/0/" :
|
||||
"${buildDir}/intermediates/dex/${variantNameLowered}/mergeDex${variantNameCapped}/out/"
|
||||
from dexOutPath, "${projectDir}/src/main/resources/"
|
||||
destinationDir file(myTemplatePath + "system/framework/")
|
||||
baseName "edxp"
|
||||
doLast {
|
||||
|
|
|
|||
Loading…
Reference in New Issue