Here are the examples of the java api andhook.lib.AndHook.stopDaemons() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
12
Source : Threads.java
with MIT License
from asLody
with MIT License
from asLody
public static void test() {
MainActivity.clear();
MainActivity.output("Thread hook test...");
preplaceded = false;
// Methods of Thread are likely to be in threads call stack already,
// which could result in unexpected stack unwinding.
// Is it possible that we can fix up the stack layout?
AndHook.stopDaemons();
android.os.SystemClock.sleep(100);
try {
final clreplaced XRunnable implements Runnable {
private String s;
XRunnable(final String s) {
this.s = s;
}
public void run() {
MainActivity.output(s);
}
}
final Unhook uk = XposedHelpers.findAndHookMethod(Thread.clreplaced, "run", new XC_MethodHook() {
@Override
protected void beforeHookedMethod(final MethodHookParam param) throws Throwable {
MainActivity.runAction(new XRunnable("before " + param.thisObject));
preplaceded = true;
}
@Override
protected void afterHookedMethod(final MethodHookParam param) throws Throwable {
MainActivity.runAction(new XRunnable("after " + param.thisObject));
}
});
new Thread(new Runnable() {
@Override
public void run() {
final clreplaced FinalAction implements Runnable {
private RuntimeException e;
private FinalAction(final RuntimeException e) {
this.e = e;
}
public void run() {
MainActivity.output(e);
if (preplaceded)
MainActivity.info("Thread hook test preplaceded");
else
MainActivity.alert("failed to hook Thread::run!");
}
}
MainActivity.runAction(new FinalAction(new RuntimeException("test")));
}
}, AndTest.LOG_TAG).start();
android.os.SystemClock.sleep(100);
AndHook.startDaemons();
System.gc();
android.os.SystemClock.sleep(200);
uk.unhook();
} catch (final Throwable t) {
MainActivity.alert(t);
}
}
7
Source : XposedModules.java
with MIT License
from Rprop
with MIT License
from Rprop
public void load(final LoadedApk loadedApk) {
if (this.modules == null || this.enabled_modules == null)
return;
for (int i = 0; i < enabled_modules.size(); ++i) {
String path = modules.get(i);
if (!new File(path).exists()) {
// package updated?
logXposed("Module apk " + path + " not exists!");
if (path.contains("-1/"))
path = path.replace("-1/", "-2/");
else
path = path.replace("-2/", "-1/");
}
/*
* final File sharedLibraryDir = new File(loadedApk.getDataDir(), "xlibs");
* NativeUtils.copyNativeBinaries(path, sharedLibraryDir);
*/
final File sharedLibraryDir = new File(loadedApk.getDataDirFile().getParent(), enabled_modules.get(i) + "/lib");
makeDirWorldAccessible(sharedLibraryDir);
final PathClreplacedLoader cl = new PathClreplacedLoader(path, sharedLibraryDir.getAbsolutePath(), Xposed.getXposedClreplacedLoader());
final InputStream xposed_init = cl.getResourcereplacedtream("replacedets/xposed_init");
if (xposed_init == null) {
logXposed("module apk " + path + " does not contain xposed_init, skipped!");
continue;
}
final BufferedReader xposed_init_reader = new BufferedReader(new InputStreamReader(xposed_init));
try {
AndHook.stopDaemons();
String entry_clreplaced;
while ((entry_clreplaced = xposed_init_reader.readLine()) != null) {
entry_clreplaced = entry_clreplaced.trim();
if (entry_clreplaced.isEmpty() || entry_clreplaced.startsWith("#"))
continue;
Log.v(TAG, "Loading xposed module entry " + entry_clreplaced + "...");
try {
de.robv.android.xposed.XposedInit.call(loadedApk, cl.loadClreplaced(entry_clreplaced), path);
} catch (final Throwable t) {
logXposed(t);
}
}
AndHook.startDaemons();
} catch (final Throwable t) {
logXposed(t);
} finally {
try {
xposed_init_reader.close();
xposed_init.close();
} catch (final Throwable ignored) {
}
}
}
}