我刚想通了.有一个PackageManager.getDefaultActivityIcon()方法返回一个Drawable.如果Drawable的Bitmap与应用程序图标Drawable的Bitmap匹配,则它是默认图标.
PackageManager pm = context.getPackageManager();
Drawable icon = pm.getApplicationIcon(apk.package_name);
Drawable default_icon = pm.getDefaultActivityIcon();
if (icon instanceof BitmapDrawable && default_icon instanceof BitmapDrawable) {
BitmapDrawable icon_bd = (BitmapDrawable)icon;
Bitmap icon_b = icon_bd.getBitmap();
BitmapDrawable default_bd = (BitmapDrawable)pm.getDefaultActivityIcon();
Bitmap default_b = default_bd.getBitmap();
if (icon_b == default_b) {
// It's the default icon
}
}