How do I differentiate between a system app and a normal app ? I looked through android PackageManager
and could not find any.
Edit: I want
A simple function:
public boolean isUserApp(ApplicationInfo ai,boolean getUpdatedSystemApps){
if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
if(getUpdatedSystemApps==true){
if((ai.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0){
return true;
} else {
return false;
}
}
return false;
} else {
return true;
}
}
you can use above function like:
PackageManager pm = getPackageManager();
List allApps = pm.getInstalledApplications(0);
for (ApplicationInfo ai: allApps) {
if (isUserApp(ai,true)) {
// User app or Updated SystemApp - do something here
...
} else {
// System app
}
}