X-Git-Url: https://git.ralfj.de/noFUDroid.git/blobdiff_plain/a31b5c5c81994e70d0e8e0d1ecaedfa321183d9a..678a29432330ea2bc7f2b478c448ac9071166530:/app/src/main/java/de/ralfj/xposed/nofudroid/Mod5.java diff --git a/app/src/main/java/de/ralfj/xposed/nofudroid/Mod5.java b/app/src/main/java/de/ralfj/xposed/nofudroid/Mod5.java new file mode 100644 index 0000000..2b75ec6 --- /dev/null +++ b/app/src/main/java/de/ralfj/xposed/nofudroid/Mod5.java @@ -0,0 +1,37 @@ +package de.ralfj.xposed.nofudroid; + +import de.robv.android.xposed.IXposedHookLoadPackage; +import de.robv.android.xposed.XC_MethodReplacement; +import de.robv.android.xposed.XposedBridge; +import de.robv.android.xposed.XposedHelpers; +import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam; + +/* "Network May Be Monitored" blocker for Android 5. */ + +public class Mod5 implements IXposedHookLoadPackage { + // Just a helper function, useful to figure out package names + private void tryToLoad(String className, ClassLoader loader) { + try { + XposedHelpers.findClass(className, loader); + XposedBridge.log(" Found " + className); + } + catch (Throwable t) {} + } + + public void handleLoadPackage(LoadPackageParam lpparam) throws Throwable { + if (!lpparam.packageName.equals("android")) + return; + + final Class userHandle = XposedHelpers.findClass("android.os.UserHandle", lpparam.classLoader); + final Class notifyTask = XposedHelpers.findClass("com.android.server.devicepolicy.DevicePolicyManagerService$MonitoringCertNotificationTask", lpparam.classLoader); + + XposedHelpers.findAndHookMethod(notifyTask, "manageNotification", userHandle, + new XC_MethodReplacement() { + @Override + protected Object replaceHookedMethod(MethodHookParam methodHookParam) throws Throwable { + XposedBridge.log("Not showing FUD notification"); + return null; + } + }); + } +}