diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
index cb8d1c4..e9f3534 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
@@ -43,6 +43,7 @@
 import com.android.launcher3.Hotseat;
 import com.android.launcher3.InvariantDeviceProfile;
 import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherAppState;
 import com.android.launcher3.LauncherSettings;
 import com.android.launcher3.LauncherState;
 import com.android.launcher3.R;
@@ -56,6 +57,7 @@
 import com.android.launcher3.dragndrop.DragOptions;
 import com.android.launcher3.icons.IconCache;
 import com.android.launcher3.logging.FileLog;
+import com.android.launcher3.model.PredictionModel;
 import com.android.launcher3.model.data.AppInfo;
 import com.android.launcher3.model.data.FolderInfo;
 import com.android.launcher3.model.data.ItemInfo;
@@ -69,6 +71,7 @@
 import com.android.launcher3.uioverrides.QuickstepLauncher;
 import com.android.launcher3.userevent.nano.LauncherLogProto;
 import com.android.launcher3.util.ComponentKey;
+import com.android.launcher3.util.IntArray;
 
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
@@ -93,8 +96,6 @@
     //TODO: replace this with AppTargetEvent.ACTION_UNPIN (b/144119543)
     private static final int APPTARGET_ACTION_UNPIN = 4;
 
-    private static final String PREDICTED_ITEMS_CACHE_KEY = "predicted_item_keys";
-
     private static final String APP_LOCATION_HOTSEAT = "hotseat";
     private static final String APP_LOCATION_WORKSPACE = "workspace";
 
@@ -115,11 +116,13 @@
 
     private DynamicItemCache mDynamicItemCache;
 
+    private final PredictionModel mPredictionModel;
     private AppPredictor mAppPredictor;
     private AllAppsStore mAllAppsStore;
     private AnimatorSet mIconRemoveAnimators;
     private boolean mUIUpdatePaused = false;
-    private boolean mRequiresCacheUpdate = false;
+    private boolean mRequiresCacheUpdate = true;
+    private boolean mIsCacheEmpty;
 
     private HotseatEduController mHotseatEduController;
 
@@ -138,15 +141,16 @@
         mLauncher = launcher;
         mHotseat = launcher.getHotseat();
         mAllAppsStore = mLauncher.getAppsView().getAppsStore();
+        mPredictionModel = LauncherAppState.INSTANCE.get(launcher).getPredictionModel();
         mAllAppsStore.addUpdateListener(this);
         mDynamicItemCache = new DynamicItemCache(mLauncher, this::fillGapsWithPrediction);
         mHotSeatItemsCount = mLauncher.getDeviceProfile().inv.numHotseatIcons;
         launcher.getDeviceProfile().inv.addOnChangeListener(this);
         mHotseat.addOnAttachStateChangeListener(this);
+        mIsCacheEmpty = mPredictionModel.getPredictionComponentKeys().isEmpty();
         if (mHotseat.isAttachedToWindow()) {
             onViewAttachedToWindow(mHotseat);
         }
-        showCachedItems();
     }
 
     /**
@@ -185,6 +189,11 @@
             return;
         }
         List<WorkspaceItemInfo> predictedApps = mapToWorkspaceItemInfo(mComponentKeyMappers);
+        if (mComponentKeyMappers.isEmpty() != predictedApps.isEmpty()) {
+            // Safely ignore update as AppsList is not ready yet. This will called again once
+            // apps are ready (HotseatPredictionController#onAppsUpdated)
+            return;
+        }
         int predictionIndex = 0;
         ArrayList<WorkspaceItemInfo> newItems = new ArrayList<>();
         // make sure predicted icon removal and filling predictions don't step on each other
@@ -305,14 +314,23 @@
         mAppPredictor.requestPredictionUpdate();
     }
 
-    private void showCachedItems() {
-        ArrayList<ComponentKey> componentKeys = getCachedComponentKeys();
+    /**
+     * Create WorkspaceItemInfo objects and binds PredictedAppIcon views for cached predicted items.
+     */
+    public void showCachedItems(List<AppInfo> apps, IntArray ranks) {
+        int count = Math.min(ranks.size(), apps.size());
+        List<WorkspaceItemInfo> items = new ArrayList<>(count);
+        for (int i = 0; i < count; i++) {
+            WorkspaceItemInfo item = new WorkspaceItemInfo(apps.get(i));
+            preparePredictionInfo(item, ranks.get(i));
+            items.add(item);
+        }
         mComponentKeyMappers.clear();
-        for (ComponentKey key : componentKeys) {
+        for (ComponentKey key : mPredictionModel.getPredictionComponentKeys()) {
             mComponentKeyMappers.add(new ComponentKeyMapper(key, mDynamicItemCache));
         }
         updateDependencies();
-        fillGapsWithPrediction();
+        bindItems(items, false, null);
     }
 
     private Bundle getAppPredictionContextExtra() {
@@ -390,41 +408,20 @@
         predictionLog.append("]");
         if (Utilities.IS_DEBUG_DEVICE) FileLog.d(TAG, predictionLog.toString());
         updateDependencies();
-            fillGapsWithPrediction();
+        fillGapsWithPrediction();
         if (!isEduSeen() && mHotseatEduController != null) {
             mHotseatEduController.setPredictedApps(mapToWorkspaceItemInfo(mComponentKeyMappers));
         }
-        // should invalidate cache if AiAi sends empty list of AppTargets
-        if (appTargets.isEmpty()) {
-            mRequiresCacheUpdate = true;
-        }
-        cachePredictionComponentKeys(componentKeys);
+        cachePredictionComponentKeysIfNecessary(componentKeys);
     }
 
-    private void cachePredictionComponentKeys(ArrayList<ComponentKey> componentKeys) {
-        if (!mRequiresCacheUpdate) return;
-        StringBuilder builder = new StringBuilder();
-        for (ComponentKey componentKey : componentKeys) {
-            builder.append(componentKey);
-            builder.append("\n");
-        }
-        mLauncher.getDevicePrefs().edit().putString(PREDICTED_ITEMS_CACHE_KEY,
-                builder.toString()).apply();
+    private void cachePredictionComponentKeysIfNecessary(ArrayList<ComponentKey> componentKeys) {
+        if (!mRequiresCacheUpdate && componentKeys.isEmpty() == mIsCacheEmpty) return;
+        mPredictionModel.cachePredictionComponentKeys(componentKeys);
+        mIsCacheEmpty = componentKeys.isEmpty();
         mRequiresCacheUpdate = false;
     }
 
-    private ArrayList<ComponentKey> getCachedComponentKeys() {
-        String cachedBlob = mLauncher.getDevicePrefs().getString(PREDICTED_ITEMS_CACHE_KEY, "");
-        ArrayList<ComponentKey> results = new ArrayList<>();
-        for (String line : cachedBlob.split("\n")) {
-            ComponentKey key = ComponentKey.fromString(line);
-            if (key != null) {
-                results.add(key);
-            }
-        }
-        return results;
-    }
-
     private void updateDependencies() {
         mDynamicItemCache.updateDependencies(mComponentKeyMappers, mAllAppsStore, this,
                 mHotSeatItemsCount);
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index a2d9e17..eaf9f61 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -44,6 +44,7 @@
 import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.folder.Folder;
 import com.android.launcher3.hybridhotseat.HotseatPredictionController;
+import com.android.launcher3.model.data.AppInfo;
 import com.android.launcher3.model.data.ItemInfo;
 import com.android.launcher3.model.data.WorkspaceItemInfo;
 import com.android.launcher3.popup.SystemShortcut;
@@ -58,6 +59,7 @@
 import com.android.launcher3.uioverrides.touchcontrollers.StatusBarTouchController;
 import com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchController;
 import com.android.launcher3.uioverrides.touchcontrollers.TransposedQuickSwitchTouchController;
+import com.android.launcher3.util.IntArray;
 import com.android.launcher3.util.TouchController;
 import com.android.launcher3.util.UiThreadHelper;
 import com.android.launcher3.util.UiThreadHelper.AsyncCommand;
@@ -70,6 +72,7 @@
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.stream.Stream;
 
 public class QuickstepLauncher extends BaseQuickstepLauncher {
@@ -178,6 +181,14 @@
     }
 
     @Override
+    public void bindPredictedItems(List<AppInfo> appInfos, IntArray ranks) {
+        super.bindPredictedItems(appInfos, ranks);
+        if (mHotseatPredictionController != null) {
+            mHotseatPredictionController.showCachedItems(appInfos, ranks);
+        }
+    }
+
+    @Override
     public void onDestroy() {
         super.onDestroy();
         if (mHotseatPredictionController != null) {
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index c75bd95..1d9c0c3 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2225,6 +2225,9 @@
         workspace.requestLayout();
     }
 
+    @Override
+    public void bindPredictedItems(List<AppInfo> appInfos, IntArray ranks) { }
+
     /**
      * Add the views for a widget to the workspace.
      */
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java
index 2f38037..14e604d 100644
--- a/src/com/android/launcher3/LauncherAppState.java
+++ b/src/com/android/launcher3/LauncherAppState.java
@@ -33,6 +33,7 @@
 import com.android.launcher3.icons.IconCache;
 import com.android.launcher3.icons.IconProvider;
 import com.android.launcher3.icons.LauncherIcons;
+import com.android.launcher3.model.PredictionModel;
 import com.android.launcher3.notification.NotificationListener;
 import com.android.launcher3.pm.InstallSessionHelper;
 import com.android.launcher3.pm.InstallSessionTracker;
@@ -57,6 +58,7 @@
     private final IconCache mIconCache;
     private final WidgetPreviewLoader mWidgetCache;
     private final InvariantDeviceProfile mInvariantDeviceProfile;
+    private final PredictionModel mPredictionModel;
 
     private SecureSettingsObserver mNotificationDotsObserver;
     private InstallSessionTracker mInstallSessionTracker;
@@ -127,6 +129,7 @@
         mIconCache = new IconCache(mContext, mInvariantDeviceProfile, iconCacheFileName);
         mWidgetCache = new WidgetPreviewLoader(mContext, mIconCache);
         mModel = new LauncherModel(this, mIconCache, AppFilter.newInstance(mContext));
+        mPredictionModel = new PredictionModel(mContext);
     }
 
     protected void onNotificationSettingsChanged(boolean areNotificationDotsEnabled) {
@@ -182,6 +185,10 @@
         return mModel;
     }
 
+    public PredictionModel getPredictionModel() {
+        return mPredictionModel;
+    }
+
     public WidgetPreviewLoader getWidgetCache() {
         return mWidgetCache;
     }
diff --git a/src/com/android/launcher3/model/BaseLoaderResults.java b/src/com/android/launcher3/model/BaseLoaderResults.java
index c98be56..1465100 100644
--- a/src/com/android/launcher3/model/BaseLoaderResults.java
+++ b/src/com/android/launcher3/model/BaseLoaderResults.java
@@ -17,6 +17,7 @@
 package com.android.launcher3.model;
 
 import static com.android.launcher3.model.ModelUtils.filterCurrentWorkspaceItems;
+import static com.android.launcher3.model.ModelUtils.getMissingHotseatRanks;
 import static com.android.launcher3.model.ModelUtils.sortWorkspaceItemsSpatially;
 
 import android.util.Log;
@@ -196,6 +197,10 @@
             // Load items on the current page.
             bindWorkspaceItems(currentWorkspaceItems, mainExecutor);
             bindAppWidgets(currentAppWidgets, mainExecutor);
+
+            // Locate available spots for prediction using currentWorkspaceItems
+            IntArray gaps = getMissingHotseatRanks(currentWorkspaceItems, idp.numHotseatIcons);
+            bindPredictedItems(gaps, mainExecutor);
             // In case of validFirstPage, only bind the first screen, and defer binding the
             // remaining screens after first onDraw (and an optional the fade animation whichever
             // happens later).
@@ -247,6 +252,11 @@
             }
         }
 
+        private void bindPredictedItems(IntArray ranks, final Executor executor) {
+            executeCallbacksTask(
+                    c -> c.bindPredictedItems(mBgDataModel.cachedPredictedItems, ranks), executor);
+        }
+
         protected void executeCallbacksTask(CallbackTask task, Executor executor) {
             executor.execute(() -> {
                 if (mMyBindingId != mBgDataModel.lastBindId) {
diff --git a/src/com/android/launcher3/model/BgDataModel.java b/src/com/android/launcher3/model/BgDataModel.java
index f79a9d1..2522a49 100644
--- a/src/com/android/launcher3/model/BgDataModel.java
+++ b/src/com/android/launcher3/model/BgDataModel.java
@@ -93,6 +93,11 @@
     public final Map<ShortcutKey, MutableInt> pinnedShortcutCounts = new HashMap<>();
 
     /**
+     * List of all cached predicted items visible on home screen
+     */
+    public final ArrayList<AppInfo> cachedPredictedItems = new ArrayList<>();
+
+    /**
      * True if the launcher has permission to access deep shortcuts.
      */
     public boolean hasShortcutHostPermission;
@@ -366,5 +371,10 @@
         void bindDeepShortcutMap(HashMap<ComponentKey, Integer> deepShortcutMap);
 
         void bindAllApplications(AppInfo[] apps);
+
+        /**
+         * Binds predicted appInfos at at available prediction slots.
+         */
+        void bindPredictedItems(List<AppInfo> appInfos, IntArray ranks);
     }
 }
diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java
index 4c02837..90aaf44 100644
--- a/src/com/android/launcher3/model/LoaderTask.java
+++ b/src/com/android/launcher3/model/LoaderTask.java
@@ -179,6 +179,7 @@
         try (LauncherModel.LoaderTransaction transaction = mApp.getModel().beginLoader(this)) {
             List<ShortcutInfo> allShortcuts = new ArrayList<>();
             loadWorkspace(allShortcuts);
+            loadCachedPredictions();
             logger.addSplit("loadWorkspace");
 
             verifyNotStopped();
@@ -849,6 +850,23 @@
         }
     }
 
+    private List<AppInfo> loadCachedPredictions() {
+        List<ComponentKey> componentKeys = mApp.getPredictionModel().getPredictionComponentKeys();
+        List<AppInfo> results = new ArrayList<>();
+        if (componentKeys == null) return results;
+        List<LauncherActivityInfo> l;
+        mBgDataModel.cachedPredictedItems.clear();
+        for (ComponentKey key : componentKeys) {
+            l = mLauncherApps.getActivityList(key.componentName.getPackageName(), key.user);
+            if (l.size() == 0) continue;
+            boolean quietMode = mUserManager.isQuietModeEnabled(key.user);
+            AppInfo info = new AppInfo(l.get(0), key.user, quietMode);
+            mBgDataModel.cachedPredictedItems.add(info);
+            mIconCache.getTitleAndIcon(info, false);
+        }
+        return results;
+    }
+
     private List<LauncherActivityInfo> loadAllApps() {
         final List<UserHandle> profiles = mUserCache.getUserProfiles();
         List<LauncherActivityInfo> allActivityList = new ArrayList<>();
@@ -880,6 +898,14 @@
                         PackageInstallInfo.fromInstallingState(info));
             }
         }
+        for (AppInfo item : mBgDataModel.cachedPredictedItems) {
+            List<LauncherActivityInfo> l = mLauncherApps.getActivityList(
+                    item.componentName.getPackageName(), item.user);
+            for (LauncherActivityInfo info : l) {
+                boolean quietMode = mUserManager.isQuietModeEnabled(item.user);
+                mBgAllAppsList.add(new AppInfo(info, item.user, quietMode), info);
+            }
+        }
 
         mBgAllAppsList.getAndResetChangeFlag();
         return allActivityList;
diff --git a/src/com/android/launcher3/model/ModelUtils.java b/src/com/android/launcher3/model/ModelUtils.java
index ef7e828..4efeba5 100644
--- a/src/com/android/launcher3/model/ModelUtils.java
+++ b/src/com/android/launcher3/model/ModelUtils.java
@@ -19,11 +19,14 @@
 import com.android.launcher3.LauncherSettings;
 import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.model.data.ItemInfo;
+import com.android.launcher3.util.IntArray;
 import com.android.launcher3.util.IntSet;
 
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.List;
+import java.util.stream.IntStream;
 
 /**
  * Utils class for {@link com.android.launcher3.LauncherModel}.
@@ -109,4 +112,17 @@
             }
         });
     }
+
+    /**
+     * Iterates though current workspace items and returns available hotseat ranks for prediction.
+     */
+    public static IntArray getMissingHotseatRanks(List<ItemInfo> items, int len) {
+        IntSet seen = new IntSet();
+        items.stream().filter(
+                info -> info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT)
+                .forEach(i -> seen.add(i.screenId));
+        IntArray result = new IntArray(len);
+        IntStream.range(0, len).filter(i -> !seen.contains(i)).forEach(result::add);
+        return result;
+    }
 }
diff --git a/src/com/android/launcher3/model/PredictionModel.java b/src/com/android/launcher3/model/PredictionModel.java
new file mode 100644
index 0000000..6aa41eb
--- /dev/null
+++ b/src/com/android/launcher3/model/PredictionModel.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.launcher3.model;
+
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.UserHandle;
+
+import com.android.launcher3.Utilities;
+import com.android.launcher3.model.data.AppInfo;
+import com.android.launcher3.util.ComponentKey;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Model helper for app predictions in workspace
+ */
+public class PredictionModel {
+    private static final String CACHED_ITEMS_KEY = "predicted_item_keys";
+    private static final int MAX_CACHE_ITEMS = 5;
+
+    private final Context mContext;
+    private final SharedPreferences mDevicePrefs;
+    private ArrayList<ComponentKey> mCachedComponentKeys;
+
+    public PredictionModel(Context context) {
+        mContext = context;
+        mDevicePrefs = Utilities.getDevicePrefs(mContext);
+    }
+
+    /**
+     * Formats and stores a list of component key in device preferences.
+     */
+    public void cachePredictionComponentKeys(List<ComponentKey> componentKeys) {
+        StringBuilder builder = new StringBuilder();
+        int count = Math.min(componentKeys.size(), MAX_CACHE_ITEMS);
+        for (int i = 0; i < count; i++) {
+            builder.append(componentKeys.get(i));
+            builder.append("\n");
+        }
+        mDevicePrefs.edit().putString(CACHED_ITEMS_KEY, builder.toString()).apply();
+        mCachedComponentKeys = null;
+    }
+
+    /**
+     * parses and returns ComponentKeys saved by
+     * {@link PredictionModel#cachePredictionComponentKeys(List)}
+     */
+    public List<ComponentKey> getPredictionComponentKeys() {
+        if (mCachedComponentKeys == null) {
+            mCachedComponentKeys = new ArrayList<>();
+
+            String cachedBlob = mDevicePrefs.getString(CACHED_ITEMS_KEY, "");
+            for (String line : cachedBlob.split("\n")) {
+                ComponentKey key = ComponentKey.fromString(line);
+                if (key != null) {
+                    mCachedComponentKeys.add(key);
+                }
+            }
+        }
+        return mCachedComponentKeys;
+    }
+
+    /**
+     * Remove uninstalled applications from model
+     */
+    public void removePackage(String pkgName, UserHandle user, ArrayList<AppInfo> ids) {
+        for (int i = ids.size() - 1; i >= 0; i--) {
+            AppInfo info = ids.get(i);
+            if (info.user.equals(user) && pkgName.equals(info.componentName.getPackageName())) {
+                ids.remove(i);
+            }
+        }
+        cachePredictionComponentKeys(getPredictionComponentKeys().stream()
+                .filter(cn -> !(cn.user.equals(user) && cn.componentName.getPackageName().equals(
+                        pkgName))).collect(Collectors.toList()));
+    }
+}
diff --git a/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java b/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java
index dd6fc49..4a15af1 100644
--- a/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java
+++ b/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java
@@ -196,6 +196,9 @@
     public void bindItems(List<ItemInfo> shortcuts, boolean forceAnimateIcons) { }
 
     @Override
+    public void bindPredictedItems(List<AppInfo> appInfos, IntArray ranks) { }
+
+    @Override
     public void bindScreens(IntArray orderedScreenIds) { }
 
     @Override
