use restored icon for restored app shortcuts

Bug: 10778992
Change-Id: Ie430a6587d49dc0d78b87b81582c0cef7c281017
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index f4fa10f..007fd7a 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -318,10 +318,16 @@
                     public void run() {
                         Callbacks cb = mCallbacks != null ? mCallbacks.get() : null;
                         if (callbacks == cb && cb != null) {
-                            callbacks.bindAppsAdded(null, null, null, allAppsApps);
                             if (!restoredAppsFinal.isEmpty()) {
+                                for (AppInfo info : restoredAppsFinal) {
+                                    final Intent intent = info.getIntent();
+                                    if (intent != null) {
+                                        mIconCache.deletePreloadedIcon(intent.getComponent());
+                                    }
+                                }
                                 callbacks.bindAppsUpdated(restoredAppsFinal);
                             }
+                            callbacks.bindAppsAdded(null, null, null, allAppsApps);
                         }
                     }
                 });
@@ -2667,6 +2673,7 @@
                 case OP_ADD:
                     for (int i=0; i<N; i++) {
                         if (DEBUG_LOADERS) Log.d(TAG, "mAllAppsList.addPackage " + packages[i]);
+                        mIconCache.remove(packages[i]);
                         mBgAllAppsList.addPackage(context, packages[i]);
                     }
                     break;
@@ -2862,13 +2869,12 @@
      */
     public ShortcutInfo getRestoredItemInfo(Cursor cursor, int titleIndex, Intent intent) {
         final ShortcutInfo info = new ShortcutInfo();
-        info.usingFallbackIcon = true;
-        info.setIcon(getFallbackIcon());
         if (cursor != null) {
             info.title =  cursor.getString(titleIndex);
         } else {
             info.title = "";
         }
+        info.setIcon(mIconCache.getIcon(intent, info.title.toString()));
         info.itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
         info.restoredIntent = intent;
         return info;