DO NOT MERGE - Fix 2941495: Launcher short-cut icons don't work for apps on SD card after reboot

Bug: 2941495
Change-Id: Ie8e0e0c62259f8cf933e53b7aa2dc28a835110ae
diff --git a/src/com/android/launcher2/IconCache.java b/src/com/android/launcher2/IconCache.java
index 4bb7d08..81a786c 100644
--- a/src/com/android/launcher2/IconCache.java
+++ b/src/com/android/launcher2/IconCache.java
@@ -124,6 +124,10 @@
         }
     }
 
+    public boolean isDefaultIcon(Bitmap icon) {
+        return mDefaultIcon == icon;
+    }
+
     private CacheEntry cacheLocked(ComponentName componentName, ResolveInfo info) {
         CacheEntry entry = mCache.get(componentName);
         if (entry == null) {
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java
index 797bf68..1e363d1 100644
--- a/src/com/android/launcher2/LauncherModel.java
+++ b/src/com/android/launcher2/LauncherModel.java
@@ -1566,7 +1566,7 @@
         // into the DB.  We do this so when we're loading, if the
         // package manager can't find an icon (for example because
         // the app is on SD) then we can use that instead.
-        if (info.onExternalStorage && !info.customIcon && !info.usingFallbackIcon) {
+        if (!info.customIcon && !info.usingFallbackIcon) {
             boolean needSave;
             byte[] data = c.getBlob(iconIndex);
             try {
diff --git a/src/com/android/launcher2/ShortcutInfo.java b/src/com/android/launcher2/ShortcutInfo.java
index b0da3a5..72f2d51 100644
--- a/src/com/android/launcher2/ShortcutInfo.java
+++ b/src/com/android/launcher2/ShortcutInfo.java
@@ -52,11 +52,6 @@
     boolean usingFallbackIcon;
 
     /**
-     * Indicates whether the shortcut is on external storage and may go away at any time.
-     */
-    boolean onExternalStorage;
-
-    /**
      * If isShortcut=true and customIcon=false, this contains a reference to the
      * shortcut icon as an application's resource.
      */
@@ -99,6 +94,7 @@
     public Bitmap getIcon(IconCache iconCache) {
         if (mIcon == null) {
             mIcon = iconCache.getIcon(this.intent);
+            this.usingFallbackIcon = iconCache.isDefaultIcon(mIcon);
         }
         return mIcon;
     }
@@ -133,7 +129,7 @@
                     LauncherSettings.BaseLauncherColumns.ICON_TYPE_BITMAP);
             writeBitmap(values, mIcon);
         } else {
-            if (onExternalStorage && !usingFallbackIcon) {
+            if (!usingFallbackIcon) {
                 writeBitmap(values, mIcon);
             }
             values.put(LauncherSettings.BaseLauncherColumns.ICON_TYPE,