不想写ui界面的可利用隐藏应用列表模块来配置白名单或黑名单,隐藏应用列表只需要给加速器启用黑名单或白名单即可
直接上代码
[Java] 纯文本查看 复制代码import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
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;
import android.app.AndroidAppHelper;
import java.util.List;
public class AllowAllApps implements IXposedHookLoadPackage {
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
ClassLoader classLoader = lpparam.classLoader;
XC_MethodHook hook = new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
Object builder = param.thisObject;
PackageManager pm = AndroidAppHelper.currentApplication().getPackageManager();
List packages = pm.getInstalledPackages(PackageManager.GET_META_DATA);
for (PackageInfo packageInfo : packages) {
XposedHelpers.callMethod(builder, "addAllowedApplication", packageInfo.packageName);
}
super.beforeHookedMethod(param);
}
};
XposedHelpers.findAndHookMethod("android.net.VpnService$Builder", classLoader, "establish", hook);
}
}