-->

加速器加速所有应用

废话不多说!利用xposed模块给加速器添加白名单
不想写ui界面的可利用隐藏应用列表模块来配置白名单或黑名单,隐藏应用列表只需要给加速器启用黑名单或白名单即可
直接上代码
 
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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<PackageInfo> 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);
    }
}

 

这段代码是一个Xposed模块,它钩入了android.net.VpnService.Builder类,并允许所有已安装的应用程序建立***连接。当调用VpnService.Builder类的establish方法时,该模块将所有已安装应用程序的包名添加到允许应..
posted @ 2024-01-24 15:47  角刀牛Java  阅读(88)  评论(0编辑  收藏  举报