public static boolean isSystemApplication(PackageManager packageManager,String packageName){
  if (packageManager == null || packageName == null || packageName.length() == 0) {
    return false;
  }
  try {
    ApplicationInfo app=packageManager.getApplicationInfo(packageName,0);
    return (app != null && (app.flags & ApplicationInfo.FLAG_SYSTEM) > 0);
  }
 catch (  NameNotFoundException e) {
    Logger.e(e);
  }
  return false;
}

public static boolean isSystemApplication ( PackageManager packageManager , String packageName ) { if ( packageManager == null || packageName == null || packageName . length ( ) == 0 ) { return false ; } try { ApplicationInfo app = packageManager . getApplicationInfo ( packageName , 0 ) ; return ( app != null && ( app . flags & ApplicationInfo . FLAG_SYSTEM ) > 0 ) ; } catch ( NameNotFoundException e ) { Logger . e ( e ) ; } return false ; }
whether packagename is system application
