admin管理员组

文章数量:1291315

I'm developing an Android app that categorizes installed applications into system apps and user apps using PackageManager. My current filtering logic for system apps is:

PackageManager packageManager = getPackageManager();
List<ApplicationInfo> apps = packageManager.getInstalledApplications(PackageManager.GET_META_DATA);

List<ApplicationInfo> systemApps = new ArrayList<>();
List<ApplicationInfo> userApps = new ArrayList<>();

for (ApplicationInfo appInfo : apps) {
    if ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
        systemApps.add(appInfo);
    } else {
        userApps.add(appInfo);
    }
}

This correctly separates system apps from user apps. However, some plugin apps (e.g. Wifi Resources, GnssDebugReport, MDML Sample etc) are also appearing in the system apps list.

本文标签: How to Exclude Plugin Apps from System Apps in Android PackageManagerStack Overflow