Add resources hooking support for MIUI
This commit is contained in:
parent
7d5a72b683
commit
aba57dc40f
|
|
@ -26,7 +26,22 @@ public class InlinedMethodCallers {
|
||||||
*/
|
*/
|
||||||
private static final String[][] BOOT_IMAGE = {
|
private static final String[][] BOOT_IMAGE = {
|
||||||
// callers of Application#attach(Context)
|
// callers of Application#attach(Context)
|
||||||
{"android.app.Instrumentation", "newApplication", "(Ljava/lang/ClassLoader;Ljava/lang/String;Landroid/content/Context;)Landroid/app/Application;"}
|
{"android.app.Instrumentation", "newApplication", "(Ljava/lang/ClassLoader;Ljava/lang/String;Landroid/content/Context;)Landroid/app/Application;"},
|
||||||
|
|
||||||
|
// for MIUI resources hooking
|
||||||
|
{"android.content.res.MiuiResources", "init", "(Ljava/lang/String;)V"},
|
||||||
|
{"android.content.res.MiuiResources", "updateMiuiImpl", "()V"},
|
||||||
|
{"android.content.res.MiuiResources", "setImpl", "(Landroid/content/res/ResourcesImpl;)V"},
|
||||||
|
{"android.content.res.MiuiResources", "loadOverlayValue", "(Landroid/util/TypedValue;I)V"},
|
||||||
|
{"android.content.res.MiuiResources", "getThemeString", "(I)Ljava/lang/CharSequence;"},
|
||||||
|
{"android.content.res.MiuiResources", "<init>", "(Ljava/lang/ClassLoader;)V"},
|
||||||
|
{"android.content.res.MiuiResources", "<init>", "()V"},
|
||||||
|
{"android.content.res.MiuiResources", "<init>", "(Landroid/content/res/AssetManager;Landroid/util/DisplayMetrics;Landroid/content/res/Configuration;)V"},
|
||||||
|
{"android.miui.ResourcesManager", "initMiuiResource", "(Landroid/content/res/Resources;Ljava/lang/String;)V"},
|
||||||
|
{"android.app.LoadedApk", "getResources", "()Landroid/content/res/Resources;"},
|
||||||
|
{"android.content.res.Resources", "getSystem", "()Landroid/content/res/Resources;"},
|
||||||
|
{"android.app.ApplicationPackageManager", "getResourcesForApplication", "(Landroid/content/pm/ApplicationInfo;)Landroid/content/res/Resources;"},
|
||||||
|
{"android.app.ContextImpl", "setResources", "(Landroid/content/res/Resources;)V"},
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final String[][] SYSTEM_SERVER = {};
|
private static final String[][] SYSTEM_SERVER = {};
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,12 @@ public class PrebuiltMethodsDeopter {
|
||||||
}
|
}
|
||||||
for (String[] caller : callers) {
|
for (String[] caller : callers) {
|
||||||
try {
|
try {
|
||||||
|
Class clazz = XposedHelpers.findClassIfExists(caller[0], cl);
|
||||||
|
if (clazz == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Object method = EdXpConfigGlobal.getHookProvider().findMethodNative(
|
Object method = EdXpConfigGlobal.getHookProvider().findMethodNative(
|
||||||
XposedHelpers.findClass(caller[0], cl), caller[1], caller[2]);
|
clazz, caller[1], caller[2]);
|
||||||
if (method != null) {
|
if (method != null) {
|
||||||
EdXpConfigGlobal.getHookProvider().deoptMethodNative(method);
|
EdXpConfigGlobal.getHookProvider().deoptMethodNative(method);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,13 @@ static bool onIsInSamePackageCalled(void *thiz, void *that) {
|
||||||
|| strstr(thatDesc, "com/elderdrivers/riru/") != nullptr) {
|
|| strstr(thatDesc, "com/elderdrivers/riru/") != nullptr) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// for MIUI resources hooking
|
||||||
|
if (strstr(thisDesc, "android/content/res/MiuiTypedArray") != nullptr
|
||||||
|
|| strstr(thatDesc, "android/content/res/MiuiTypedArray") != nullptr
|
||||||
|
|| strstr(thisDesc, "android/content/res/XResources$XTypedArray") != nullptr
|
||||||
|
|| strstr(thatDesc, "android/content/res/XResources$XTypedArray") != nullptr) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return (*isInSamePackageBackup)(thiz, that);
|
return (*isInSamePackageBackup)(thiz, that);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue