We would like to know how to get System APK Path Map.
// w ww .j a v a 2 s.c om import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; public class Main { public static Map<String, PackageInfo> getSystemApkPathMap(Context context) { Map<String, PackageInfo> apkMap = new HashMap<String, PackageInfo>(); List<PackageInfo> packageList = getAllPackages(context); if (packageList != null && packageList.size() > 0) { for (PackageInfo pkg : packageList) { if ((pkg.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) { apkMap.put(pkg.packageName, pkg); } } } return apkMap; } public static List<PackageInfo> getAllPackages(Context context) { List<PackageInfo> packageList = new ArrayList<PackageInfo>(); PackageManager pm = context.getPackageManager(); packageList = pm.getInstalledPackages(0); return packageList; } }