Last active
August 24, 2020 09:19
-
-
Save LeadroyaL/cc1ec2fe8c0818da2436818f1e8dc122 to your computer and use it in GitHub Desktop.
使用xposed跳过oppo USB安装应用确认
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.leadroyal.oppousb; | |
import de.robv.android.xposed.IXposedHookLoadPackage; | |
import de.robv.android.xposed.XC_MethodHook; | |
import de.robv.android.xposed.XposedBridge; | |
import de.robv.android.xposed.XposedHelpers; | |
import de.robv.android.xposed.callbacks.XC_LoadPackage; | |
public class Entry implements IXposedHookLoadPackage { | |
@Override | |
public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam lpparam) throws Throwable { | |
if (lpparam.packageName.equals("android")) { | |
ClassLoader classLoader = lpparam.classLoader; | |
XposedBridge.log("Patch oppo usb alert START"); | |
XposedHelpers.findAndHookMethod("com.android.server.pm.ColorPackageInstallInterceptManager", classLoader, "allowInterceptAdbInstallInInstallStage", int.class, "android.content.pm.PackageInstaller$SessionParams", "java.io.File", "java.lang.String", "android.content.pm.IPackageInstallObserver2", new XC_MethodHook() { | |
@Override | |
protected void beforeHookedMethod(MethodHookParam param) throws Throwable { | |
super.beforeHookedMethod(param); | |
param.setResult(false); | |
} | |
}); | |
XposedBridge.log("Patch oppo usb alert END"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment