diff --git a/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
index f22cc48..5259e04 100644
--- a/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
@@ -50,6 +50,8 @@
 import com.android.launcher3.anim.PropertyListBuilder;
 import com.android.launcher3.dragndrop.DragLayer;
 import com.android.launcher3.graphics.DrawableFactory;
+import com.android.launcher3.shortcuts.DeepShortcutTextView;
+import com.android.launcher3.shortcuts.DeepShortcutView;
 import com.android.quickstep.RecentsAnimationInterpolator;
 import com.android.quickstep.RecentsAnimationInterpolator.TaskWindowBounds;
 import com.android.quickstep.RecentsView;
@@ -78,7 +80,7 @@
             "android.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS";
 
     private static final int RECENTS_LAUNCH_DURATION = 336;
-    private static final int LAUNCHER_RESUME_START_DELAY = 150;
+    private static final int LAUNCHER_RESUME_START_DELAY = 100;
     private static final int CLOSING_TRANSITION_DURATION_MS = 350;
 
     // Progress = 0: All apps is fully pulled up, Progress = 1: All apps is fully pulled down.
@@ -494,7 +496,7 @@
      * @return Animator that controls the icon used to launch the target.
      */
     private AnimatorSet getIconAnimator(View v) {
-        boolean isBubbleTextView = v instanceof BubbleTextView;
+        final boolean isBubbleTextView = v instanceof BubbleTextView;
         mFloatingView = new View(mLauncher);
         if (isBubbleTextView && v.getTag() instanceof ItemInfoWithIcon ) {
             // Create a copy of the app icon
@@ -506,14 +508,24 @@
 
         // Position the floating view exactly on top of the original
         Rect rect = new Rect();
-        mDragLayer.getDescendantRectRelativeToSelf(v, rect);
-        int viewLocationStart = mIsRtl
+        final boolean isDeepShortcutTextView = v instanceof DeepShortcutTextView
+                && v.getParent() != null && v.getParent() instanceof DeepShortcutView;
+        if (isDeepShortcutTextView) {
+            // Deep shortcut views have their icon drawn in a sibling view.
+            DeepShortcutView view = (DeepShortcutView) v.getParent();
+            mDragLayer.getDescendantRectRelativeToSelf(view.getIconView(), rect);
+        } else {
+            mDragLayer.getDescendantRectRelativeToSelf(v, rect);
+        }
+        final int viewLocationStart = mIsRtl
                 ? mDeviceProfile.widthPx - rect.right
                 : rect.left;
-        int viewLocationTop = rect.top;
+        final int viewLocationTop = rect.top;
 
-        if (isBubbleTextView) {
+        if (isBubbleTextView && !isDeepShortcutTextView) {
             ((BubbleTextView) v).getIconBounds(rect);
+        } else {
+            rect.set(0, 0, rect.width(), rect.height());
         }
         LayoutParams lp = new LayoutParams(rect.width(), rect.height());
         lp.ignoreInsets = true;
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 053dc35..acad901 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -60,7 +60,6 @@
 import com.android.launcher3.provider.LauncherDbUtils;
 import com.android.launcher3.provider.LauncherDbUtils.SQLiteTransaction;
 import com.android.launcher3.provider.RestoreDbTask;
-import com.android.launcher3.util.ManagedProfileHeuristic;
 import com.android.launcher3.util.NoLocaleSqliteContext;
 import com.android.launcher3.util.Preconditions;
 import com.android.launcher3.util.Thunk;
@@ -629,10 +628,6 @@
 
             // Set the flag for empty DB
             Utilities.getPrefs(mContext).edit().putBoolean(EMPTY_DATABASE_CREATED, true).commit();
-
-            // When a new DB is created, remove all previously stored managed profile information.
-            ManagedProfileHeuristic.processAllUsers(Collections.<UserHandle>emptyList(),
-                    mContext);
         }
 
         public long getDefaultUserSerial() {
@@ -796,7 +791,7 @@
                 case 23:
                     // No-op
                 case 24:
-                    ManagedProfileHeuristic.markExistingUsersForNoFolderCreation(mContext);
+                    // No-op
                 case 25:
                     convertShortcutsToLauncherActivities(db);
                 case 26:
diff --git a/src/com/android/launcher3/SessionCommitReceiver.java b/src/com/android/launcher3/SessionCommitReceiver.java
index edb7ff5..b0da6b9 100644
--- a/src/com/android/launcher3/SessionCommitReceiver.java
+++ b/src/com/android/launcher3/SessionCommitReceiver.java
@@ -67,11 +67,9 @@
         SessionInfo info = intent.getParcelableExtra(PackageInstaller.EXTRA_SESSION);
         UserHandle user = intent.getParcelableExtra(Intent.EXTRA_USER);
 
-        if (Process.myUserHandle().equals(user)) {
-            if (TextUtils.isEmpty(info.getAppPackageName()) ||
-                    info.getInstallReason() != PackageManager.INSTALL_REASON_USER) {
-                return;
-            }
+        if (TextUtils.isEmpty(info.getAppPackageName()) ||
+                info.getInstallReason() != PackageManager.INSTALL_REASON_USER) {
+            return;
         }
 
         queueAppIconAddition(context, info.getAppPackageName(), user);
diff --git a/src/com/android/launcher3/compat/UserManagerCompat.java b/src/com/android/launcher3/compat/UserManagerCompat.java
index 62055dc..03e3861 100644
--- a/src/com/android/launcher3/compat/UserManagerCompat.java
+++ b/src/com/android/launcher3/compat/UserManagerCompat.java
@@ -58,7 +58,6 @@
     public abstract long getSerialNumberForUser(UserHandle user);
     public abstract UserHandle getUserForSerialNumber(long serialNumber);
     public abstract CharSequence getBadgedLabelForUser(CharSequence label, UserHandle user);
-    public abstract long getUserCreationTime(UserHandle user);
     public abstract boolean isQuietModeEnabled(UserHandle user);
     public abstract boolean isUserUnlocked(UserHandle user);
 
diff --git a/src/com/android/launcher3/compat/UserManagerCompatVL.java b/src/com/android/launcher3/compat/UserManagerCompatVL.java
index e57786d..1ff6981 100644
--- a/src/com/android/launcher3/compat/UserManagerCompatVL.java
+++ b/src/com/android/launcher3/compat/UserManagerCompatVL.java
@@ -23,7 +23,6 @@
 import android.os.UserManager;
 import android.util.ArrayMap;
 import com.android.launcher3.util.LongArrayMap;
-import com.android.launcher3.util.ManagedProfileHeuristic;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -127,15 +126,5 @@
         }
         return mPm.getUserBadgedLabel(label, user);
     }
-
-    @Override
-    public long getUserCreationTime(UserHandle user) {
-        SharedPreferences prefs = ManagedProfileHeuristic.prefs(mContext);
-        String key = USER_CREATION_TIME_KEY + getSerialNumberForUser(user);
-        if (!prefs.contains(key)) {
-            prefs.edit().putLong(key, System.currentTimeMillis()).apply();
-        }
-        return prefs.getLong(key, 0);
-    }
 }
 
diff --git a/src/com/android/launcher3/compat/UserManagerCompatVM.java b/src/com/android/launcher3/compat/UserManagerCompatVM.java
index 75c1877..cf74b37 100644
--- a/src/com/android/launcher3/compat/UserManagerCompatVM.java
+++ b/src/com/android/launcher3/compat/UserManagerCompatVM.java
@@ -27,9 +27,4 @@
     UserManagerCompatVM(Context context) {
         super(context);
     }
-
-    @Override
-    public long getUserCreationTime(UserHandle user) {
-        return mUserManager.getUserCreationTime(user);
-    }
 }
diff --git a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
index a33a039..fefe07d 100644
--- a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
+++ b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
@@ -17,10 +17,7 @@
 
 import android.content.Context;
 import android.content.Intent;
-import android.content.pm.LauncherActivityInfo;
-import android.os.Process;
 import android.os.UserHandle;
-import android.util.ArrayMap;
 import android.util.LongSparseArray;
 import android.util.Pair;
 import com.android.launcher3.AllAppsList;
@@ -37,7 +34,6 @@
 import com.android.launcher3.ShortcutInfo;
 import com.android.launcher3.Utilities;
 import com.android.launcher3.util.GridOccupancy;
-import com.android.launcher3.util.ManagedProfileHeuristic.UserFolderInfo;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -64,7 +60,6 @@
 
         final ArrayList<ItemInfo> addedItemsFinal = new ArrayList<>();
         final ArrayList<Long> addedWorkspaceScreensFinal = new ArrayList<>();
-        ArrayMap<UserHandle, UserFolderInfo> userFolderMap = new ArrayMap<>();
 
         // Get the list of workspace screens.  We need to append to this list and
         // can not use sBgWorkspaceScreens because loadWorkspace() may not have been
@@ -87,21 +82,6 @@
                     if (item instanceof AppInfo) {
                         item = ((AppInfo) item).makeShortcut();
                     }
-
-                    if (!Process.myUserHandle().equals(item.user)) {
-                        // Check if this belongs to a work folder.
-                        if (!(entry.second instanceof LauncherActivityInfo)) {
-                            continue;
-                        }
-
-                        UserFolderInfo userFolderInfo = userFolderMap.get(item.user);
-                        if (userFolderInfo == null) {
-                            userFolderInfo = new UserFolderInfo(context, item.user, dataModel);
-                            userFolderMap.put(item.user, userFolderInfo);
-                        }
-                        item = userFolderInfo.convertToWorkspaceItem(
-                                (ShortcutInfo) item, (LauncherActivityInfo) entry.second);
-                    }
                 }
                 if (item != null) {
                     filteredItems.add(item);
@@ -160,10 +140,6 @@
                 }
             });
         }
-
-        for (UserFolderInfo userFolderInfo : userFolderMap.values()) {
-            userFolderInfo.applyPendingState(getModelWriter());
-        }
     }
 
     protected void updateScreens(Context context, ArrayList<Long> workspaceScreens) {
diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java
index 00dd3aa..c615050 100644
--- a/src/com/android/launcher3/model/LoaderTask.java
+++ b/src/com/android/launcher3/model/LoaderTask.java
@@ -62,7 +62,6 @@
 import com.android.launcher3.shortcuts.ShortcutKey;
 import com.android.launcher3.util.ComponentKey;
 import com.android.launcher3.util.LooperIdleLock;
-import com.android.launcher3.util.ManagedProfileHeuristic;
 import com.android.launcher3.util.MultiHashMap;
 import com.android.launcher3.util.PackageManagerHelper;
 import com.android.launcher3.util.Provider;
@@ -812,8 +811,6 @@
                 // This builds the icon bitmaps.
                 mBgAllAppsList.add(new AppInfo(app, user, quietMode), app);
             }
-
-            ManagedProfileHeuristic.onAllAppsLoaded(mApp.getContext(), apps, user);
         }
 
         if (FeatureFlags.LAUNCHER3_PROMISE_APPS_IN_ALL_APPS) {
diff --git a/src/com/android/launcher3/util/ManagedProfileHeuristic.java b/src/com/android/launcher3/util/ManagedProfileHeuristic.java
deleted file mode 100644
index 009aee7..0000000
--- a/src/com/android/launcher3/util/ManagedProfileHeuristic.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright (C) 2015 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.util;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.pm.LauncherActivityInfo;
-import android.os.Handler;
-import android.os.Process;
-import android.os.UserHandle;
-
-import com.android.launcher3.FolderInfo;
-import com.android.launcher3.InstallShortcutReceiver;
-import com.android.launcher3.ItemInfo;
-import com.android.launcher3.LauncherFiles;
-import com.android.launcher3.LauncherModel;
-import com.android.launcher3.MainThreadExecutor;
-import com.android.launcher3.R;
-import com.android.launcher3.SessionCommitReceiver;
-import com.android.launcher3.ShortcutInfo;
-import com.android.launcher3.Utilities;
-import com.android.launcher3.compat.UserManagerCompat;
-import com.android.launcher3.model.BgDataModel;
-import com.android.launcher3.model.ModelWriter;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-
-/**
- * Handles addition of app shortcuts for managed profiles.
- * Methods of class should only be called on {@link LauncherModel#sWorkerThread}.
- */
-public class ManagedProfileHeuristic {
-
-    private static final String USER_FOLDER_ID_PREFIX = "user_folder_";
-
-    /**
-     * Duration (in milliseconds) for which app shortcuts will be added to work folder.
-     */
-    private static final long AUTO_ADD_TO_FOLDER_DURATION = 8 * 60 * 60 * 1000;
-
-    public static void onAllAppsLoaded(final Context context,
-            List<LauncherActivityInfo> apps, UserHandle user) {
-        if (Process.myUserHandle().equals(user)) {
-            return;
-        }
-
-        UserFolderInfo ufi = new UserFolderInfo(context, user, null);
-        // We only handle folder creation once. Later icon additions are handled using package
-        // or session events.
-        if (ufi.folderAlreadyCreated) {
-            return;
-        }
-
-        if (Utilities.ATLEAST_OREO && !SessionCommitReceiver.isEnabled(context)) {
-            // Just mark the folder id preference to avoid new folder creation later.
-            ufi.prefs.edit().putLong(ufi.folderIdKey, ItemInfo.NO_ID).apply();
-            return;
-        }
-
-        InstallShortcutReceiver.enableInstallQueue(InstallShortcutReceiver.FLAG_BULK_ADD);
-        for (LauncherActivityInfo app : apps) {
-            // Queue all items which should go in the work folder.
-            if (app.getFirstInstallTime() < ufi.addIconToFolderTime) {
-                InstallShortcutReceiver.queueActivityInfo(app, context);
-            }
-        }
-        // Post the queue update on next frame, so that the loader gets finished.
-        new Handler(LauncherModel.getWorkerLooper()).post(new Runnable() {
-            @Override
-            public void run() {
-                InstallShortcutReceiver.disableAndFlushInstallQueue(
-                        InstallShortcutReceiver.FLAG_BULK_ADD, context);
-            }
-        });
-    }
-
-
-    /**
-     * Utility class to help workspace icon addition.
-     */
-    public static class UserFolderInfo {
-
-        final ArrayList<ShortcutInfo> pendingShortcuts = new ArrayList<>();
-
-        final UserHandle user;
-
-        final long userSerial;
-        // Time until which icons will be added to folder instead.
-        final long addIconToFolderTime;
-
-        final String folderIdKey;
-        final SharedPreferences prefs;
-
-        final boolean folderAlreadyCreated;
-        final FolderInfo folderInfo;
-
-        boolean folderPendingAddition;
-
-        public UserFolderInfo(Context context, UserHandle user, BgDataModel dataModel) {
-            this.user = user;
-
-            UserManagerCompat um = UserManagerCompat.getInstance(context);
-            userSerial = um.getSerialNumberForUser(user);
-            addIconToFolderTime = um.getUserCreationTime(user) + AUTO_ADD_TO_FOLDER_DURATION;
-
-            folderIdKey = USER_FOLDER_ID_PREFIX + userSerial;
-            prefs = prefs(context);
-
-            folderAlreadyCreated = prefs.contains(folderIdKey);
-            if (dataModel != null) {
-                if (folderAlreadyCreated) {
-                    long folderId = prefs.getLong(folderIdKey, ItemInfo.NO_ID);
-                    folderInfo = dataModel.folders.get(folderId);
-                } else {
-                    folderInfo = new FolderInfo();
-                    folderInfo.title = context.getText(R.string.work_folder_name);
-                    folderInfo.setOption(FolderInfo.FLAG_WORK_FOLDER, true, null);
-                    folderPendingAddition = true;
-                }
-            } else {
-                folderInfo = null;
-            }
-        }
-
-        /**
-         * Returns the ItemInfo which should be added to the workspace. In case the the provided
-         * {@link ShortcutInfo} or a wrapped {@link FolderInfo} or null.
-         */
-        public ItemInfo convertToWorkspaceItem(
-                ShortcutInfo shortcut, LauncherActivityInfo activityInfo) {
-            if (activityInfo.getFirstInstallTime() >= addIconToFolderTime) {
-                return shortcut;
-            }
-
-            if (folderAlreadyCreated) {
-                if (folderInfo == null) {
-                    // Work folder was deleted by user, add icon to home screen.
-                    return shortcut;
-                } else {
-                    // Add item to work folder instead. Nothing needs to be added
-                    // on the homescreen.
-                    pendingShortcuts.add(shortcut);
-                    return null;
-                }
-            }
-
-            pendingShortcuts.add(shortcut);
-            folderInfo.add(shortcut, false);
-            if (folderPendingAddition) {
-                folderPendingAddition = false;
-                return folderInfo;
-            } else {
-                // WorkFolder already requested to be added. Nothing new needs to be added.
-                return null;
-            }
-        }
-
-        public void applyPendingState(ModelWriter writer) {
-            if (folderInfo == null) {
-                return;
-            }
-
-            int startingRank = 0;
-            if (folderAlreadyCreated) {
-                startingRank = folderInfo.contents.size();
-            }
-
-            for (ShortcutInfo info : pendingShortcuts) {
-                info.rank = startingRank++;
-                writer.addItemToDatabase(info, folderInfo.id, 0, 0, 0);
-            }
-
-            if (folderAlreadyCreated) {
-                // FolderInfo could already be bound. We need to add shortcuts on the UI thread.
-                new MainThreadExecutor().execute(new Runnable() {
-
-                    @Override
-                    public void run() {
-                        folderInfo.prepareAutoUpdate();
-                        for (ShortcutInfo info : pendingShortcuts) {
-                            folderInfo.add(info, false);
-                        }
-                    }
-                });
-            } else {
-                prefs.edit().putLong(folderIdKey, folderInfo.id).apply();
-            }
-        }
-    }
-
-    /**
-     * Verifies that entries corresponding to {@param users} exist and removes all invalid entries.
-     */
-    public static void processAllUsers(List<UserHandle> users, Context context) {
-        UserManagerCompat userManager = UserManagerCompat.getInstance(context);
-        HashSet<String> validKeys = new HashSet<>();
-        for (UserHandle user : users) {
-            validKeys.add(USER_FOLDER_ID_PREFIX + userManager.getSerialNumberForUser(user));
-        }
-
-        SharedPreferences prefs = prefs(context);
-        SharedPreferences.Editor editor = prefs.edit();
-        for (String key : prefs.getAll().keySet()) {
-            if (!validKeys.contains(key)) {
-                editor.remove(key);
-            }
-        }
-        editor.apply();
-    }
-
-    /**
-     * For each user, if a work folder has not been created, mark it such that the folder will
-     * never get created.
-     */
-    public static void markExistingUsersForNoFolderCreation(Context context) {
-        UserManagerCompat userManager = UserManagerCompat.getInstance(context);
-        UserHandle myUser = Process.myUserHandle();
-
-        SharedPreferences prefs = null;
-        for (UserHandle user : userManager.getUserProfiles()) {
-            if (myUser.equals(user)) {
-                continue;
-            }
-            if (prefs == null) {
-                prefs = prefs(context);
-            }
-            String folderIdKey = USER_FOLDER_ID_PREFIX + userManager.getSerialNumberForUser(user);
-            if (!prefs.contains(folderIdKey)) {
-                prefs.edit().putLong(folderIdKey, ItemInfo.NO_ID).apply();
-            }
-        }
-    }
-
-    public static SharedPreferences prefs(Context context) {
-        return context.getSharedPreferences(
-                LauncherFiles.MANAGED_USER_PREFERENCES_KEY, Context.MODE_PRIVATE);
-    }
-}
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 1be33d2..9e55127 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -15,6 +15,9 @@
  */
 package com.android.launcher3.ui;
 
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
 import android.app.Instrumentation;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
@@ -34,7 +37,6 @@
 import android.support.test.uiautomator.UiObject2;
 import android.support.test.uiautomator.Until;
 import android.view.MotionEvent;
-
 import com.android.launcher3.LauncherAppState;
 import com.android.launcher3.LauncherAppWidgetProviderInfo;
 import com.android.launcher3.LauncherSettings;
@@ -46,17 +48,11 @@
 import com.android.launcher3.config.FeatureFlags;
 import com.android.launcher3.testcomponent.AppWidgetNoConfig;
 import com.android.launcher3.testcomponent.AppWidgetWithConfig;
-import com.android.launcher3.util.ManagedProfileHeuristic;
-
-import org.junit.Before;
-
 import java.util.Locale;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import org.junit.Before;
 
 /**
  * Base class for all instrumentation tests providing various utility methods.
@@ -221,7 +217,6 @@
             mMainThreadExecutor.execute(new Runnable() {
                 @Override
                 public void run() {
-                    ManagedProfileHeuristic.markExistingUsersForNoFolderCreation(mTargetContext);
                     LauncherAppState.getInstance(mTargetContext).getModel().forceReload();
                 }
             });
