20分 |
获取所有开机启动应用
public List<String> listBootApps(){ List<String> bootAppNames = new ArrayList<String>(); PackageManager pm = this.getPackageManager(); //获取所有安装的App的信息 List<ApplicationInfo> appInfos = pm.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES); for(ApplicationInfo appInfo : appInfos){ int iBoot = pm.checkPermission(permName, appInfo.packageName); if(iBoot == PackageManager.PERMISSION_GRANTED ){ String appName = pm.getApplicationLabel(appInfo).toString(); bootAppNames.add(appName); } } return bootAppNames; } 修改权限:PackageManager的 public abstract void revokePermission(String packageName, String permissionName); 不过好像需要system权限 |