判断Xposed框架
1: 根据包名判断
列举一些常用的应用判断是否安装,来判断.
private static List<String> asList = Arrays.asList("de.robv.android.xposed", "com.topjohnwu.magisk", "io.va.exposed", "org.meowcat.edxposed.manager", "com.saurik.substrate", "me.weishu.exp");
PackageManager获取对应的包信息,如果能够获取到,说明存在.
public static boolean isXposedAppExits(PackageManager packageManager) {for (String s : asList) {try {PackageInfo packageInfo = packageManager.getPackageInfo(s, 0);// 如果能够获取到包信息,则说明该应用已安装Log.d(TAG, "onCreate: " + s + " exists");return true;} catch (PackageManager.NameNotFoundException e) {// 如果捕获到NameNotFoundException,则说明该应用未安装}}return false;}