Remove useless codes

This commit is contained in:
LoveSy 2021-01-28 18:01:26 +08:00
parent 6b4e7f5515
commit 3bd7c46984
9 changed files with 7 additions and 232 deletions

View File

@ -1,31 +0,0 @@
package com.elderdrivers.riru.edxp._hooker.yahfa;
import com.elderdrivers.riru.common.KeepMembers;
import com.elderdrivers.riru.edxp._hooker.impl.HandleBindApp;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.annotation.ApiSensitive;
import de.robv.android.xposed.annotation.Level;
@ApiSensitive(Level.LOW)
public class HandleBindAppHooker implements KeepMembers {
public static String className = "android.app.ActivityThread";
public static String methodName = "handleBindApplication";
public static String methodSig = "(Landroid/app/ActivityThread$AppBindData;)V";
public static void hook(final Object thiz, final Object bindData) throws Throwable {
final XC_MethodHook methodHook = new HandleBindApp();
final XC_MethodHook.MethodHookParam param = new XC_MethodHook.MethodHookParam();
param.thisObject = thiz;
param.args = new Object[]{bindData};
methodHook.callBeforeHookedMethod(param);
if (!param.returnEarly) {
backup(thiz, bindData);
}
methodHook.callAfterHookedMethod(param);
}
public static void backup(Object thiz, Object bindData) {
}
}

View File

@ -1,47 +0,0 @@
package com.elderdrivers.riru.edxp._hooker.yahfa;
import android.app.ActivityThread;
import android.content.pm.ApplicationInfo;
import android.content.res.CompatibilityInfo;
import com.elderdrivers.riru.common.KeepMembers;
import com.elderdrivers.riru.edxp._hooker.impl.LoadedApkCstr;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.annotation.ApiSensitive;
import de.robv.android.xposed.annotation.Level;
@ApiSensitive(Level.LOW)
public class LoadedApkConstructorHooker implements KeepMembers {
public static String className = "android.app.LoadedApk";
public static String methodName = "<init>";
public static String methodSig = "(Landroid/app/ActivityThread;" +
"Landroid/content/pm/ApplicationInfo;" +
"Landroid/content/res/CompatibilityInfo;" +
"Ljava/lang/ClassLoader;ZZZ)V";
public static void hook(Object thiz, ActivityThread activityThread,
ApplicationInfo aInfo, CompatibilityInfo compatInfo,
ClassLoader baseLoader, boolean securityViolation,
boolean includeCode, boolean registerPackage) throws Throwable {
final XC_MethodHook methodHook = new LoadedApkCstr();
final XC_MethodHook.MethodHookParam param = new XC_MethodHook.MethodHookParam();
param.thisObject = thiz;
param.args = new Object[]{activityThread, aInfo, compatInfo, baseLoader, securityViolation,
includeCode, registerPackage};
methodHook.callBeforeHookedMethod(param);
if (!param.returnEarly) {
backup(thiz, activityThread, aInfo, compatInfo, baseLoader, securityViolation,
includeCode, registerPackage);
}
methodHook.callAfterHookedMethod(param);
}
public static void backup(Object thiz, ActivityThread activityThread,
ApplicationInfo aInfo, CompatibilityInfo compatInfo,
ClassLoader baseLoader, boolean securityViolation,
boolean includeCode, boolean registerPackage) {
}
}

View File

@ -1,28 +0,0 @@
package com.elderdrivers.riru.edxp._hooker.yahfa;
import com.elderdrivers.riru.common.KeepMembers;
import com.elderdrivers.riru.edxp._hooker.impl.StartBootstrapServices;
import de.robv.android.xposed.XC_MethodHook;
public class StartBootstrapServicesHooker implements KeepMembers {
public static String className = "com.android.server.SystemServer";
public static String methodName = "startBootstrapServices";
public static String methodSig = "()V";
public static void hook(Object systemServer) throws Throwable {
final XC_MethodHook methodHook = new StartBootstrapServices();
final XC_MethodHook.MethodHookParam param = new XC_MethodHook.MethodHookParam();
param.thisObject = systemServer;
param.args = new Object[]{};
methodHook.callBeforeHookedMethod(param);
if (!param.returnEarly) {
backup(systemServer);
}
methodHook.callAfterHookedMethod(param);
}
public static void backup(Object systemServer) {
}
}

View File

@ -1,31 +0,0 @@
package com.elderdrivers.riru.edxp._hooker.yahfa;
import com.elderdrivers.riru.common.KeepMembers;
import com.elderdrivers.riru.edxp._hooker.impl.StartBootstrapServices;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.annotation.ApiSensitive;
import de.robv.android.xposed.annotation.Level;
@ApiSensitive(Level.LOW)
public class StartBootstrapServicesHooker11 implements KeepMembers {
public static String className = "com.android.server.SystemServer";
public static String methodName = "startBootstrapServices";
public static String methodSig = "(Lcom/android/server/utils/TimingsTraceAndSlog;)V";
public static void hook(Object systemServer, Object traceAndSlog) throws Throwable {
final XC_MethodHook methodHook = new StartBootstrapServices();
final XC_MethodHook.MethodHookParam param = new XC_MethodHook.MethodHookParam();
param.thisObject = systemServer;
param.args = new Object[]{traceAndSlog};
methodHook.callBeforeHookedMethod(param);
if (!param.returnEarly) {
backup(systemServer, traceAndSlog);
}
methodHook.callAfterHookedMethod(param);
}
public static void backup(Object systemServer, Object traceAndSlog) {
}
}

View File

@ -1,35 +0,0 @@
package com.elderdrivers.riru.edxp._hooker.yahfa;
import android.app.ActivityThread;
import com.elderdrivers.riru.common.KeepMembers;
import com.elderdrivers.riru.edxp._hooker.impl.SystemMain;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.annotation.ApiSensitive;
import de.robv.android.xposed.annotation.Level;
@ApiSensitive(Level.LOW)
public class SystemMainHooker implements KeepMembers {
public static String className = "android.app.ActivityThread";
public static String methodName = "systemMain";
public static String methodSig = "()Landroid/app/ActivityThread;";
public static ActivityThread hook() throws Throwable {
final XC_MethodHook methodHook = new SystemMain();
final XC_MethodHook.MethodHookParam param = new XC_MethodHook.MethodHookParam();
param.thisObject = null;
param.args = new Object[]{};
methodHook.callBeforeHookedMethod(param);
if (!param.returnEarly) {
param.setResult(backup());
}
methodHook.callAfterHookedMethod(param);
return (ActivityThread) param.getResult();
}
public static ActivityThread backup() {
return null;
}
}

View File

@ -1,12 +0,0 @@
package com.elderdrivers.riru.edxp.entry.yahfa;
import com.elderdrivers.riru.common.KeepMembers;
import com.elderdrivers.riru.edxp._hooker.yahfa.HandleBindAppHooker;
import com.elderdrivers.riru.edxp._hooker.yahfa.LoadedApkConstructorHooker;
public class AppBootstrapHookInfo implements KeepMembers {
public static String[] hookItemNames = {
HandleBindAppHooker.class.getName(),
LoadedApkConstructorHooker.class.getName(),
};
}

View File

@ -1,14 +0,0 @@
package com.elderdrivers.riru.edxp.entry.yahfa;
import com.elderdrivers.riru.common.KeepMembers;
import com.elderdrivers.riru.edxp._hooker.yahfa.HandleBindAppHooker;
import com.elderdrivers.riru.edxp._hooker.yahfa.LoadedApkConstructorHooker;
import com.elderdrivers.riru.edxp._hooker.yahfa.SystemMainHooker;
public class SysBootstrapHookInfo implements KeepMembers {
public static String[] hookItemNames = {
HandleBindAppHooker.class.getName(),
SystemMainHooker.class.getName(),
LoadedApkConstructorHooker.class.getName(),
};
}

View File

@ -1,19 +0,0 @@
package com.elderdrivers.riru.edxp.entry.yahfa;
import com.elderdrivers.riru.common.KeepMembers;
import com.elderdrivers.riru.edxp._hooker.yahfa.StartBootstrapServicesHooker;
import com.elderdrivers.riru.edxp._hooker.yahfa.StartBootstrapServicesHooker11;
import com.elderdrivers.riru.edxp.util.Versions;
public class SysInnerHookInfo implements KeepMembers {
public static Class<?> getSysInnerHookerClass() {
return Versions.hasR() ?
StartBootstrapServicesHooker11.class :
StartBootstrapServicesHooker.class;
}
public static String[] hookItemNames = {
getSysInnerHookerClass().getName()
};
}

View File

@ -9,14 +9,6 @@ import com.elderdrivers.riru.edxp._hooker.impl.HandleBindApp;
import com.elderdrivers.riru.edxp._hooker.impl.LoadedApkCstr;
import com.elderdrivers.riru.edxp._hooker.impl.StartBootstrapServices;
import com.elderdrivers.riru.edxp._hooker.impl.SystemMain;
import com.elderdrivers.riru.edxp._hooker.yahfa.HandleBindAppHooker;
import com.elderdrivers.riru.edxp._hooker.yahfa.LoadedApkConstructorHooker;
import com.elderdrivers.riru.edxp._hooker.yahfa.StartBootstrapServicesHooker;
import com.elderdrivers.riru.edxp._hooker.yahfa.SystemMainHooker;
import com.elderdrivers.riru.edxp.core.yahfa.HookMain;
import com.elderdrivers.riru.edxp.entry.yahfa.AppBootstrapHookInfo;
import com.elderdrivers.riru.edxp.entry.yahfa.SysBootstrapHookInfo;
import com.elderdrivers.riru.edxp.entry.yahfa.SysInnerHookInfo;
import com.elderdrivers.riru.edxp.util.Utils;
import com.elderdrivers.riru.edxp.util.Versions;
@ -80,14 +72,14 @@ public abstract class BaseRouter implements Router {
Utils.logD("startBootstrapHook starts: isSystem = " + isSystem);
ClassLoader classLoader = BaseRouter.class.getClassLoader();
if (isSystem) {
XposedHelpers.findAndHookMethod(SystemMainHooker.className, classLoader,
SystemMainHooker.methodName, new SystemMain());
XposedHelpers.findAndHookMethod("android.app.ActivityThread", classLoader,
"systemMain", new SystemMain());
}
XposedHelpers.findAndHookMethod(HandleBindAppHooker.className, classLoader,
HandleBindAppHooker.methodName,
XposedHelpers.findAndHookMethod("android.app.ActivityThread", classLoader,
"handleBindApplication",
"android.app.ActivityThread$AppBindData",
new HandleBindApp());
XposedHelpers.findAndHookConstructor(LoadedApkConstructorHooker.className, classLoader,
XposedHelpers.findAndHookConstructor("android.app.LoadedApk", classLoader,
ActivityThread.class, ApplicationInfo.class, CompatibilityInfo.class,
ClassLoader.class, boolean.class, boolean.class, boolean.class,
new LoadedApkCstr());
@ -98,8 +90,8 @@ public abstract class BaseRouter implements Router {
Object[] paramTypesAndCallback = Versions.hasR() ?
new Object[]{"com.android.server.utils.TimingsTraceAndSlog", sbsHooker} :
new Object[]{sbsHooker};
XposedHelpers.findAndHookMethod(StartBootstrapServicesHooker.className,
XposedHelpers.findAndHookMethod("com.android.server.SystemServer",
SystemMain.systemServerCL,
StartBootstrapServicesHooker.methodName, paramTypesAndCallback);
"startBootstrapServices", paramTypesAndCallback);
}
}