Skip to content

Commit

Permalink
SandHook: remove useless logic
Browse files Browse the repository at this point in the history
  • Loading branch information
swift_gan authored and solohsu committed Mar 22, 2019
1 parent 8c437cd commit 0f1674b
Showing 1 changed file with 4 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ public class Router {

private static volatile AtomicBoolean bootstrapHooked = new AtomicBoolean(false);

static boolean useSandHook;

static {
useSandHook = EdXpConfigGlobal.getHookProvider() instanceof SandHookProvider;
}


public static void prepare(boolean isSystem) {
// this flag is needed when loadModules
Expand Down Expand Up @@ -86,46 +80,18 @@ public static void startBootstrapHook(boolean isSystem) {
Utils.logD("startBootstrapHook starts: isSystem = " + isSystem);
ClassLoader classLoader = XposedBridge.BOOTCLASSLOADER;
if (isSystem) {
if (useSandHook) {
XposedCompat.addHookers(classLoader, SysBootstrapHookInfo.hookItems);
} else {
HookMain.doHookDefault(
Router.class.getClassLoader(),
classLoader,
SysBootstrapHookInfo.class.getName());
}
XposedCompat.addHookers(classLoader, SysBootstrapHookInfo.hookItems);
} else {
if (useSandHook) {
XposedCompat.addHookers(classLoader, AppBootstrapHookInfo.hookItems);
} else {
HookMain.doHookDefault(
Router.class.getClassLoader(),
classLoader,
AppBootstrapHookInfo.class.getName());
}
XposedCompat.addHookers(classLoader, AppBootstrapHookInfo.hookItems);
}
}

public static void startSystemServerHook() {
if (useSandHook) {
XposedCompat.addHookers(SystemMainHooker.systemServerCL, SysInnerHookInfo.hookItems);
} else {
HookMain.doHookDefault(
Router.class.getClassLoader(),
SystemMainHooker.systemServerCL,
SysInnerHookInfo.class.getName());
}
XposedCompat.addHookers(SystemMainHooker.systemServerCL, SysInnerHookInfo.hookItems);
}

public static void startWorkAroundHook() {
if (useSandHook) {
XposedCompat.addHookers(XposedBridge.BOOTCLASSLOADER, WorkAroundHookInfo.hookItems);
} else {
HookMain.doHookDefault(
Router.class.getClassLoader(),
XposedBridge.BOOTCLASSLOADER,
WorkAroundHookInfo.class.getName());
}
XposedCompat.addHookers(XposedBridge.BOOTCLASSLOADER, WorkAroundHookInfo.hookItems);
}

public static void onEnterChildProcess() {
Expand Down

0 comments on commit 0f1674b

Please sign in to comment.