【请大家一定添加我们微信客服:sx-980】
软件失效,资源失效,求资源,反馈问题,防失联等
【所有软件均来源于网络以及投稿人提供】
【如被骗自行负责,请勿相信任何软件内推广信息】
简介
利用xposed模块给加速器添加白名单
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);
}
}