OSDN Git Service

Fix for #1855127. When Home cannot decode an icon, it should not interrupt the loadin...
authorRomain Guy <romainguy@android.com>
Fri, 15 May 2009 00:43:39 +0000 (17:43 -0700)
committerRomain Guy <romainguy@android.com>
Fri, 15 May 2009 00:43:39 +0000 (17:43 -0700)
src/com/android/launcher/LauncherModel.java

index 3a7fac6..19f6e9b 100644 (file)
@@ -1169,9 +1169,14 @@ public class LauncherModel {
                 break;
             case LauncherSettings.Favorites.ICON_TYPE_BITMAP:
                 byte[] data = c.getBlob(iconIndex);
-                Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
-                info.icon = new FastBitmapDrawable(
-                        Utilities.createBitmapThumbnail(bitmap, launcher));
+                try {
+                    Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
+                    info.icon = new FastBitmapDrawable(
+                            Utilities.createBitmapThumbnail(bitmap, launcher));
+                } catch (Exception e) {
+                    packageManager = launcher.getPackageManager();
+                    info.icon = packageManager.getDefaultActivityIcon();
+                }
                 info.filtered = true;
                 info.customIcon = true;
                 break;