Skip to content

Commit

Permalink
v42: Hack to get Xposed fully working on MIUI
Browse files Browse the repository at this point in the history
See XposedBridge v36 log message for more details.
  • Loading branch information
rovo89 committed Oct 9, 2013
1 parent 7214b7e commit 4ea334d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions xposed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ bool xposedOnVmCreated(JNIEnv* env, const char* className) {
if (access(XPOSED_DIR "conf/do_not_hook_dvmCheckMethodAccess", F_OK) != 0)
patchReturnTrue((void*) &dvmCheckMethodAccess);

jclass miuiResourcesClass = env->FindClass(MIUI_RESOURCES_CLASS);
if (miuiResourcesClass != NULL) {
ClassObject* clazz = (ClassObject*)dvmDecodeIndirectRef(dvmThreadSelf(), miuiResourcesClass);
if (dvmIsFinalClass(clazz)) {
ALOGD("Removing final flag for class '%s'", MIUI_RESOURCES_CLASS);
clazz->accessFlags &= ~ACC_FINAL;
}
}
env->ExceptionClear();

xposedClass = env->FindClass(XPOSED_CLASS);
xposedClass = reinterpret_cast<jclass>(env->NewGlobalRef(xposedClass));

Expand Down
3 changes: 2 additions & 1 deletion xposed.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ namespace android {
#define XPOSED_CLASS "de/robv/android/xposed/XposedBridge"
#define XPOSED_CLASS_DOTS "de.robv.android.xposed.XposedBridge"
#define XRESOURCES_CLASS "android/content/res/XResources"
#define XPOSED_VERSION "41"
#define MIUI_RESOURCES_CLASS "android/content/res/MiuiResources"
#define XPOSED_VERSION "42"

#ifndef ALOGD
#define ALOGD LOGD
Expand Down

0 comments on commit 4ea334d

Please sign in to comment.