Skip to content

Instantly share code, notes, and snippets.

@LeadroyaL

LeadroyaL/Entry.java

Last active Aug 24, 2020
Embed
What would you like to do?
使用xposed跳过oppo USB安装应用确认

使用xposed跳过oppo USB安装应用确认

Screenshot_2020-08-24-15-34-55-86

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