Aditya Soni
Aditya Soni

Reputation: 1

How to Exclude Plugin Apps from System Apps in Android PackageManager?

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.

👉 Is there any specific flag in ApplicationInfo that identifies plugin apps?
👉 What is the best way to reliably exclude plugin apps from system apps while keeping essential system apps?

Upvotes: 0

Views: 10

Answers (0)

Related Questions