I'm trying to build a module using xposed that will make a sort of blacklist of package names that will be blocked for installation through all options (google play, adb, package installer) Apparently the most efficient way is to connect to class android.content.pm.packageinstaller
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
if (!lpparam.packageName.equals("com.google.android.packageinstaller"))
return;
hookPackageNameClass(lpparam);
}
private void hookPackageNameClass(XC_LoadPackage.LoadPackageParam lpparam) {
Class <?> RecentsviewView = XposedHelpers.findClass("android.content.pm.PackageInstaller.SessionParams", lpparam.classLoader);
findAndHookMethod(RecentsviewView, "setAppPackageName", String.class, new XC_MethodHook() {
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
XposedBridge.log("----1111 Obj hook----: " + param.thisObject);
XposedBridge.log("----1111 Method hook----: " + param.method);
XposedBridge.log("----1111 Args hook----: " + param.args);
XposedBridge.log("----1111 result hook----: " + param.getResult().toString());
}
});
}
You're right, The question is flawed I'm trying to connect to this function as you can see in the code to try to take the current package name sent for installation (and then compare it with some list and block the installation process if necessary...) But the value I get from param.getResult is null or some random number.... I'm pretty desperate, can't find another function to hook into to get the package name in the current install process.