Here you can find the source of isSystemApplication(Context context, String packageName)
public static boolean isSystemApplication(Context context, String packageName)
//package com.java2s; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; public class Main { public static boolean isSystemApplication(Context context, String packageName) { PackageManager manager = context.getPackageManager(); try {/*from w ww . ja va2s . c o m*/ PackageInfo packageInfo = manager.getPackageInfo(packageName, PackageManager.GET_CONFIGURATIONS); if (packageInfo != null && (packageInfo.applicationInfo.flags & android.content.pm.ApplicationInfo.FLAG_SYSTEM) != 0) { return true; } } catch (Exception e) { e.printStackTrace(); } return false; } }