Reputation: 5767
I try to track the system app before updating and I use:
public static boolean isSystemApplication(Context ctx, IContent content) {
android.content.pm.PackageManager pm = ctx.getPackageManager();
List<android.content.pm.ApplicationInfo> apps = pm.getInstalledApplications(0);
for (android.content.pm.ApplicationInfo app : apps) {
if (app.packageName.equals(content.getContentPackage())) {
return (app.sourceDir.startsWith("/system/app/") && ((app.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP ) != 1));
}
}
return false;
}
but it seems that (app.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP ) != 1) returns always true even the system app was updated.
Upvotes: 3
Views: 1964
Reputation: 774
if a system application has update, both (app.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP ) != 0)
and (app.flags & ApplicationInfo.FLAG_SYSTEM ) != 0)
would return true.
Upvotes: 2