具体看如下图,获取所有的开机自动启动程序,并且可以修改它是否为开机自启动。这个怎么整?完全无从下手,大神们快来搭救我吧! |
|
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权限 |