Merge "Add originalView of the menu to SystemShortcut" into tm-dev
diff --git a/go/quickstep/src/com/android/launcher3/AppSharing.java b/go/quickstep/src/com/android/launcher3/AppSharing.java
index c252fba..c287446 100644
--- a/go/quickstep/src/com/android/launcher3/AppSharing.java
+++ b/go/quickstep/src/com/android/launcher3/AppSharing.java
@@ -77,11 +77,12 @@
         return FileProvider.getUriForFile(context, authority, pathFile, displayName);
     }
 
-    private SystemShortcut<Launcher> getShortcut(Launcher launcher, ItemInfo info) {
+    private SystemShortcut<Launcher> getShortcut(Launcher launcher, ItemInfo info,
+            View originalView) {
         if (TextUtils.isEmpty(mSharingComponent)) {
             return null;
         }
-        return new Share(launcher, info);
+        return new Share(launcher, info, originalView);
     }
 
     /**
@@ -104,8 +105,9 @@
         private final PopupDataProvider mPopupDataProvider;
         private final boolean mSharingEnabledForUser;
 
-        public Share(Launcher target, ItemInfo itemInfo) {
-            super(R.drawable.ic_share, R.string.app_share_drop_target_label, target, itemInfo);
+        public Share(Launcher target, ItemInfo itemInfo, View originalView) {
+            super(R.drawable.ic_share, R.string.app_share_drop_target_label, target, itemInfo,
+                    originalView);
             mPopupDataProvider = target.getPopupDataProvider();
 
             mSharingEnabledForUser = bluetoothSharingEnabled(target);
@@ -200,6 +202,7 @@
     /**
      * Shortcut factory for generating the Share App button
      */
-    public static final SystemShortcut.Factory<Launcher> SHORTCUT_FACTORY = (launcher, itemInfo) ->
-            (new AppSharing(launcher)).getShortcut(launcher, itemInfo);
+    public static final SystemShortcut.Factory<Launcher> SHORTCUT_FACTORY =
+            (launcher, itemInfo, originalView) ->
+                    (new AppSharing(launcher)).getShortcut(launcher, itemInfo, originalView);
 }
diff --git a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
index 85d9f01..62a8da7 100644
--- a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
+++ b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
@@ -409,11 +409,11 @@
     @Nullable
     @Override
     public SystemShortcut<QuickstepLauncher> getShortcut(QuickstepLauncher activity,
-            ItemInfo itemInfo) {
+            ItemInfo itemInfo, View originalView) {
         if (itemInfo.container != LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION) {
             return null;
         }
-        return new PinPrediction(activity, itemInfo);
+        return new PinPrediction(activity, itemInfo, originalView);
     }
 
     private void preparePredictionInfo(WorkspaceItemInfo itemInfo, int rank) {
@@ -498,9 +498,9 @@
 
     private class PinPrediction extends SystemShortcut<QuickstepLauncher> {
 
-        private PinPrediction(QuickstepLauncher target, ItemInfo itemInfo) {
+        private PinPrediction(QuickstepLauncher target, ItemInfo itemInfo, View originalView) {
             super(R.drawable.ic_pin, R.string.pin_prediction, target,
-                    itemInfo);
+                    itemInfo, originalView);
         }
 
         @Override
diff --git a/quickstep/src/com/android/launcher3/model/WellbeingModel.java b/quickstep/src/com/android/launcher3/model/WellbeingModel.java
index e489cb3..68ed682 100644
--- a/quickstep/src/com/android/launcher3/model/WellbeingModel.java
+++ b/quickstep/src/com/android/launcher3/model/WellbeingModel.java
@@ -40,6 +40,7 @@
 import android.text.TextUtils;
 import android.util.ArrayMap;
 import android.util.Log;
+import android.view.View;
 
 import androidx.annotation.MainThread;
 import androidx.annotation.Nullable;
@@ -193,7 +194,7 @@
 
     @MainThread
     private SystemShortcut getShortcutForApp(String packageName, int userId,
-            BaseDraggingActivity activity, ItemInfo info) {
+            BaseDraggingActivity activity, ItemInfo info, View originalView) {
         Preconditions.assertUIThread();
         // Work profile apps are not recognized by digital wellbeing.
         if (userId != UserHandle.myUserId()) {
@@ -217,7 +218,7 @@
                         "getShortcutForApp [" + packageName + "]: action: '" + action.getTitle()
                                 + "'");
             }
-            return new RemoteActionShortcut(action, activity, info);
+            return new RemoteActionShortcut(action, activity, info, originalView);
         }
     }
 
@@ -378,8 +379,8 @@
      * Shortcut factory for generating wellbeing action
      */
     public static final SystemShortcut.Factory<BaseDraggingActivity> SHORTCUT_FACTORY =
-            (activity, info) -> (info.getTargetComponent() == null) ? null : INSTANCE.get(activity)
-                    .getShortcutForApp(
+            (activity, info, originalView) -> (info.getTargetComponent() == null) ? null
+                    : INSTANCE.get(activity).getShortcutForApp(
                             info.getTargetComponent().getPackageName(), info.user.getIdentifier(),
-                            activity, info);
+                            activity, info, originalView);
 }
diff --git a/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java b/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java
index cc0072e..86310fa 100644
--- a/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java
+++ b/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java
@@ -34,8 +34,9 @@
 
     static SystemShortcut.Factory<BaseQuickstepLauncher> getSplitSelectShortcutByPosition(
             SplitPositionOption position) {
-        return (activity, itemInfo) -> new QuickstepSystemShortcut.SplitSelectSystemShortcut(
-                activity, itemInfo, position);
+        return (activity, itemInfo, originalView) ->
+                new QuickstepSystemShortcut.SplitSelectSystemShortcut(activity, itemInfo,
+                        originalView, position);
     }
 
     class SplitSelectSystemShortcut extends SystemShortcut<BaseQuickstepLauncher> {
@@ -43,8 +44,8 @@
         private final SplitPositionOption mPosition;
 
         public SplitSelectSystemShortcut(BaseQuickstepLauncher launcher, ItemInfo itemInfo,
-                SplitPositionOption position) {
-            super(position.iconResId, position.textResId, launcher, itemInfo);
+                View originalView, SplitPositionOption position) {
+            super(position.iconResId, position.textResId, launcher, itemInfo, originalView);
 
             mPosition = position;
         }
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java
index 1ccad78..c6dbc87 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java
@@ -159,7 +159,7 @@
                 mPopupDataProvider.getNotificationKeysForItem(item),
                 // TODO (b/198438631): add support for INSTALL shortcut factory
                 getSystemShortcuts()
-                        .map(s -> s.getShortcut(context, item))
+                        .map(s -> s.getShortcut(context, item, icon))
                         .filter(Objects::nonNull)
                         .collect(Collectors.toList()));
         container.requestFocus();
@@ -242,7 +242,8 @@
      */
     private SystemShortcut.Factory<BaseTaskbarContext> createSplitShortcutFactory(
             SplitPositionOption position) {
-        return (context, itemInfo) -> new TaskbarSplitShortcut(context, itemInfo, position);
+        return (context, itemInfo, originalView) -> new TaskbarSplitShortcut(context, itemInfo,
+                originalView, position);
     }
 
      /**
@@ -253,9 +254,9 @@
     private static class TaskbarSplitShortcut extends SystemShortcut<BaseTaskbarContext> {
         private final SplitPositionOption mPosition;
 
-        TaskbarSplitShortcut(BaseTaskbarContext context, ItemInfo itemInfo,
+        TaskbarSplitShortcut(BaseTaskbarContext context, ItemInfo itemInfo, View originalView,
                 SplitPositionOption position) {
-            super(position.iconResId, position.textResId, context, itemInfo);
+            super(position.iconResId, position.textResId, context, itemInfo, originalView);
             mPosition = position;
         }
 
diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
index 2d1f17c..d94e5f1 100644
--- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
+++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
@@ -118,8 +118,8 @@
      * * There aren't at least 2 tasks in overview to show split options for
      * * Device is in "Lock task mode"
      * * The taskView to show split options for is the focused task AND we haven't started
-     *   scrolling in overview (if we haven't scrolled, there's a split overview action button so
-     *   we don't need this menu option)
+     * scrolling in overview (if we haven't scrolled, there's a split overview action button so
+     * we don't need this menu option)
      */
     private static void addSplitOptions(List<SystemShortcut> outShortcuts,
             BaseDraggingActivity activity, TaskView taskView, DeviceProfile deviceProfile) {
@@ -156,13 +156,15 @@
      * Subclasses can attach any system listeners in this method, must be paired with
      * {@link #removeListeners()}
      */
-    public void initListeners() { }
+    public void initListeners() {
+    }
 
     /**
      * Subclasses should remove any system listeners in this method, must be paired with
      * {@link #initListeners()}
      */
-    public void removeListeners() { }
+    public void removeListeners() {
+    }
 
     /** Note that these will be shown in order from top to bottom, if available for the task. */
     private static final TaskShortcutFactory[] MENU_OPTIONS = new TaskShortcutFactory[]{
@@ -189,7 +191,7 @@
             mApplicationContext = taskThumbnailView.getContext().getApplicationContext();
             mThumbnailView = taskThumbnailView;
             mImageApi = new ImageActionsApi(
-                mApplicationContext, mThumbnailView::getThumbnail);
+                    mApplicationContext, mThumbnailView::getThumbnail);
         }
 
         protected T getActionsView() {
@@ -263,7 +265,8 @@
         /**
          * Gets the modal state system shortcut.
          */
-        public SystemShortcut getModalStateSystemShortcut(WorkspaceItemInfo itemInfo) {
+        public SystemShortcut getModalStateSystemShortcut(WorkspaceItemInfo itemInfo,
+                View original) {
             return null;
         }
 
@@ -277,9 +280,10 @@
          * Gets the system shortcut for the screenshot that will be added to the task menu.
          */
         public SystemShortcut getScreenshotShortcut(BaseDraggingActivity activity,
-                ItemInfo iteminfo) {
-            return new ScreenshotSystemShortcut(activity, iteminfo);
+                ItemInfo iteminfo, View originalView) {
+            return new ScreenshotSystemShortcut(activity, iteminfo, originalView);
         }
+
         /**
          * Gets the task snapshot as it is displayed on the screen.
          *
@@ -320,8 +324,10 @@
 
             private final BaseDraggingActivity mActivity;
 
-            ScreenshotSystemShortcut(BaseDraggingActivity activity, ItemInfo itemInfo) {
-                super(R.drawable.ic_screenshot, R.string.action_screenshot, activity, itemInfo);
+            ScreenshotSystemShortcut(BaseDraggingActivity activity, ItemInfo itemInfo,
+                    View originalView) {
+                super(R.drawable.ic_screenshot, R.string.action_screenshot, activity, itemInfo,
+                        originalView);
                 mActivity = activity;
             }
 
diff --git a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java
index e731b79..e807e26 100644
--- a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java
+++ b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java
@@ -49,7 +49,6 @@
 import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecCompat;
 import com.android.systemui.shared.recents.view.AppTransitionAnimationSpecsFuture;
 import com.android.systemui.shared.recents.view.RecentsTransition;
-import com.android.systemui.shared.system.ActivityCompat;
 import com.android.systemui.shared.system.ActivityManagerWrapper;
 import com.android.systemui.shared.system.ActivityOptionsCompat;
 import com.android.systemui.shared.system.WindowManagerWrapper;
@@ -78,7 +77,7 @@
                             TaskUtils.getTitle(taskView.getContext(), taskContainer.getTask()),
                             taskContainer.getA11yNodeId()
                     );
-            return new AppInfo(activity, taskContainer.getItemInfo(), accessibilityInfo);
+            return new AppInfo(activity, taskContainer.getItemInfo(), taskView, accessibilityInfo);
         }
 
         @Override
@@ -123,7 +122,7 @@
         private final SplitPositionOption mSplitPositionOption;
         public SplitSelectSystemShortcut(BaseDraggingActivity target, TaskView taskView,
                 SplitPositionOption option) {
-            super(option.iconResId, option.textResId, target, taskView.getItemInfo());
+            super(option.iconResId, option.textResId, target, taskView.getItemInfo(), taskView);
             mTaskView = taskView;
             mSplitPositionOption = option;
         }
@@ -147,7 +146,8 @@
         public MultiWindowSystemShortcut(int iconRes, int textRes, BaseDraggingActivity activity,
                 TaskIdAttributeContainer taskContainer, MultiWindowFactory factory,
                 LauncherEvent launcherEvent) {
-            super(iconRes, textRes, activity, taskContainer.getItemInfo());
+            super(iconRes, textRes, activity, taskContainer.getItemInfo(),
+                    taskContainer.getTaskView());
             mLauncherEvent = launcherEvent;
             mHandler = new Handler(Looper.getMainLooper());
             mTaskView = taskContainer.getTaskView();
@@ -320,7 +320,7 @@
         public PinSystemShortcut(BaseDraggingActivity target,
                 TaskIdAttributeContainer taskContainer) {
             super(R.drawable.ic_pin, R.string.recent_task_option_pin, target,
-                    taskContainer.getItemInfo());
+                    taskContainer.getItemInfo(), taskContainer.getTaskView());
             mTaskView = taskContainer.getTaskView();
         }
 
@@ -337,20 +337,23 @@
 
     TaskShortcutFactory INSTALL = (activity, taskContainer) ->
             InstantAppResolver.newInstance(activity).isInstantApp(activity,
-                 taskContainer.getTask().getTopComponent().getPackageName())
-                    ? new SystemShortcut.Install(activity, taskContainer.getItemInfo()) : null;
+                    taskContainer.getTask().getTopComponent().getPackageName())
+                    ? new SystemShortcut.Install(activity, taskContainer.getItemInfo(),
+                    taskContainer.getTaskView()) : null;
 
     TaskShortcutFactory WELLBEING = (activity, taskContainer) ->
-            WellbeingModel.SHORTCUT_FACTORY.getShortcut(activity, taskContainer.getItemInfo());
+            WellbeingModel.SHORTCUT_FACTORY.getShortcut(activity, taskContainer.getItemInfo(),
+                    taskContainer.getTaskView());
 
     TaskShortcutFactory SCREENSHOT = (activity, taskContainer) ->
             taskContainer.getThumbnailView().getTaskOverlay()
-                    .getScreenshotShortcut(activity, taskContainer.getItemInfo());
+                    .getScreenshotShortcut(activity, taskContainer.getItemInfo(),
+                            taskContainer.getTaskView());
 
     TaskShortcutFactory MODAL = (activity, taskContainer) -> {
         if (ENABLE_OVERVIEW_SELECTIONS.get()) {
-            return taskContainer.getThumbnailView()
-                    .getTaskOverlay().getModalStateSystemShortcut(taskContainer.getItemInfo());
+            return taskContainer.getThumbnailView().getTaskOverlay().getModalStateSystemShortcut(
+                    taskContainer.getItemInfo(), taskContainer.getTaskView());
         }
         return null;
     };
diff --git a/src/com/android/launcher3/popup/LauncherPopupLiveUpdateHandler.java b/src/com/android/launcher3/popup/LauncherPopupLiveUpdateHandler.java
index 72956b0..c0a04b1 100644
--- a/src/com/android/launcher3/popup/LauncherPopupLiveUpdateHandler.java
+++ b/src/com/android/launcher3/popup/LauncherPopupLiveUpdateHandler.java
@@ -45,8 +45,9 @@
 
     @Override
     public void onWidgetsBound() {
-        ItemInfo itemInfo = (ItemInfo) mPopupContainerWithArrow.getOriginalIcon().getTag();
-        SystemShortcut widgetInfo = SystemShortcut.WIDGETS.getShortcut(mContext, itemInfo);
+        BubbleTextView originalIcon = mPopupContainerWithArrow.getOriginalIcon();
+        SystemShortcut widgetInfo = SystemShortcut.WIDGETS.getShortcut(mContext,
+                (ItemInfo) originalIcon.getTag(), originalIcon);
         View widgetsView = getWidgetsView(mPopupContainerWithArrow);
         if (widgetsView == null && mPopupContainerWithArrow.getWidgetContainer() != null) {
             widgetsView = getWidgetsView(mPopupContainerWithArrow.getWidgetContainer());
diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
index bd3778a..484b879 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -218,7 +218,7 @@
                 popupDataProvider.getShortcutCountForItem(item),
                 popupDataProvider.getNotificationKeysForItem(item),
                 launcher.getSupportedShortcuts()
-                        .map(s -> s.getShortcut(launcher, item))
+                        .map(s -> s.getShortcut(launcher, item, icon))
                         .filter(Objects::nonNull)
                         .collect(Collectors.toList()));
         launcher.refreshAndBindWidgetsForPackageUser(PackageUserKey.fromItemInfo(item));
diff --git a/src/com/android/launcher3/popup/RemoteActionShortcut.java b/src/com/android/launcher3/popup/RemoteActionShortcut.java
index 7c393ad..e5e2c35 100644
--- a/src/com/android/launcher3/popup/RemoteActionShortcut.java
+++ b/src/com/android/launcher3/popup/RemoteActionShortcut.java
@@ -46,8 +46,8 @@
     private final RemoteAction mAction;
 
     public RemoteActionShortcut(RemoteAction action,
-            BaseDraggingActivity activity, ItemInfo itemInfo) {
-        super(0, R.id.action_remote_action_shortcut, activity, itemInfo);
+            BaseDraggingActivity activity, ItemInfo itemInfo, View originalView) {
+        super(0, R.id.action_remote_action_shortcut, activity, itemInfo, originalView);
         mAction = action;
     }
 
diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java
index 08d3779..0e25984c 100644
--- a/src/com/android/launcher3/popup/SystemShortcut.java
+++ b/src/com/android/launcher3/popup/SystemShortcut.java
@@ -46,18 +46,21 @@
 
     protected final T mTarget;
     protected final ItemInfo mItemInfo;
+    protected final View mOriginalView;
 
     /**
      * Indicates if it's invokable or not through some disabled UI
      */
     private boolean isEnabled = true;
 
-    public SystemShortcut(int iconResId, int labelResId, T target, ItemInfo itemInfo) {
+    public SystemShortcut(int iconResId, int labelResId, T target, ItemInfo itemInfo,
+            View originalView) {
         mIconResId = iconResId;
         mLabelResId = labelResId;
         mAccessibilityActionId = labelResId;
         mTarget = target;
         mItemInfo = itemInfo;
+        mOriginalView = originalView;
     }
 
     public SystemShortcut(SystemShortcut<T> other) {
@@ -66,6 +69,7 @@
         mAccessibilityActionId = other.mAccessibilityActionId;
         mTarget = other.mTarget;
         mItemInfo = other.mItemInfo;
+        mOriginalView = other.mOriginalView;
     }
 
     /**
@@ -107,10 +111,10 @@
 
     public interface Factory<T extends Context & ActivityContext> {
 
-        @Nullable SystemShortcut<T> getShortcut(T activity, ItemInfo itemInfo);
+        @Nullable SystemShortcut<T> getShortcut(T activity, ItemInfo itemInfo, View originalView);
     }
 
-    public static final Factory<Launcher> WIDGETS = (launcher, itemInfo) -> {
+    public static final Factory<Launcher> WIDGETS = (launcher, itemInfo, originalView) -> {
         if (itemInfo.getTargetComponent() == null) return null;
         final List<WidgetItem> widgets =
                 launcher.getPopupDataProvider().getWidgetsForPackageUser(new PackageUserKey(
@@ -118,12 +122,13 @@
         if (widgets.isEmpty()) {
             return null;
         }
-        return new Widgets(launcher, itemInfo);
+        return new Widgets(launcher, itemInfo, originalView);
     };
 
     public static class Widgets extends SystemShortcut<Launcher> {
-        public Widgets(Launcher target, ItemInfo itemInfo) {
-            super(R.drawable.ic_widget, R.string.widget_button_text, target, itemInfo);
+        public Widgets(Launcher target, ItemInfo itemInfo, View originalView) {
+            super(R.drawable.ic_widget, R.string.widget_button_text, target, itemInfo,
+                    originalView);
         }
 
         @Override
@@ -145,9 +150,9 @@
         @Nullable
         private SplitAccessibilityInfo mSplitA11yInfo;
 
-        public AppInfo(T target, ItemInfo itemInfo) {
+        public AppInfo(T target, ItemInfo itemInfo, View originalView) {
             super(R.drawable.ic_info_no_shadow, R.string.app_info_drop_target_label, target,
-                    itemInfo);
+                    itemInfo, originalView);
         }
 
         /**
@@ -160,8 +165,9 @@
          * That way it could directly create the correct node info for any shortcut that supports
          * split, but then we'll need custom resIDs for each pair of shortcuts.
          */
-        public AppInfo(T target, ItemInfo itemInfo, SplitAccessibilityInfo accessibilityInfo) {
-            this(target, itemInfo);
+        public AppInfo(T target, ItemInfo itemInfo, View originalView,
+                SplitAccessibilityInfo accessibilityInfo) {
+            this(target, itemInfo, originalView);
             mSplitA11yInfo = accessibilityInfo;
             mAccessibilityActionId = accessibilityInfo.nodeId;
         }
@@ -203,28 +209,29 @@
         }
     }
 
-    public static final Factory<BaseDraggingActivity> INSTALL = (activity, itemInfo) -> {
-        boolean supportsWebUI = (itemInfo instanceof WorkspaceItemInfo)
-                && ((WorkspaceItemInfo) itemInfo).hasStatusFlag(
+    public static final Factory<BaseDraggingActivity> INSTALL =
+            (activity, itemInfo, originalView) -> {
+                boolean supportsWebUI = (itemInfo instanceof WorkspaceItemInfo)
+                        && ((WorkspaceItemInfo) itemInfo).hasStatusFlag(
                         WorkspaceItemInfo.FLAG_SUPPORTS_WEB_UI);
-        boolean isInstantApp = false;
-        if (itemInfo instanceof com.android.launcher3.model.data.AppInfo) {
-            com.android.launcher3.model.data.AppInfo
-                    appInfo = (com.android.launcher3.model.data.AppInfo) itemInfo;
-            isInstantApp = InstantAppResolver.newInstance(activity).isInstantApp(appInfo);
-        }
-        boolean enabled = supportsWebUI || isInstantApp;
-        if (!enabled) {
-            return null;
-        }
-        return new Install(activity, itemInfo);
+                boolean isInstantApp = false;
+                if (itemInfo instanceof com.android.launcher3.model.data.AppInfo) {
+                    com.android.launcher3.model.data.AppInfo
+                            appInfo = (com.android.launcher3.model.data.AppInfo) itemInfo;
+                    isInstantApp = InstantAppResolver.newInstance(activity).isInstantApp(appInfo);
+                }
+                boolean enabled = supportsWebUI || isInstantApp;
+                if (!enabled) {
+                    return null;
+                }
+                return new Install(activity, itemInfo, originalView);
     };
 
     public static class Install extends SystemShortcut<BaseDraggingActivity> {
 
-        public Install(BaseDraggingActivity target, ItemInfo itemInfo) {
+        public Install(BaseDraggingActivity target, ItemInfo itemInfo, View originalView) {
             super(R.drawable.ic_install_no_shadow, R.string.install_drop_target_label,
-                    target, itemInfo);
+                    target, itemInfo, originalView);
         }
 
         @Override
diff --git a/src/com/android/launcher3/secondarydisplay/PinnedAppsAdapter.java b/src/com/android/launcher3/secondarydisplay/PinnedAppsAdapter.java
index e9058c3..a0ed77e 100644
--- a/src/com/android/launcher3/secondarydisplay/PinnedAppsAdapter.java
+++ b/src/com/android/launcher3/secondarydisplay/PinnedAppsAdapter.java
@@ -205,8 +205,8 @@
     /**
      * Returns a system shortcut to pin/unpin a shortcut
      */
-    public SystemShortcut getSystemShortcut(ItemInfo info) {
-        return new PinUnPinShortcut(mLauncher, info,
+    public SystemShortcut getSystemShortcut(ItemInfo info, View originalView) {
+        return new PinUnPinShortcut(mLauncher, info, originalView,
                 mPinnedApps.contains(new ComponentKey(info.getTargetComponent(), info.user)));
     }
 
@@ -214,10 +214,11 @@
 
         private final boolean mIsPinned;
 
-        PinUnPinShortcut(SecondaryDisplayLauncher target, ItemInfo info, boolean isPinned) {
+        PinUnPinShortcut(SecondaryDisplayLauncher target, ItemInfo info, View originalView,
+                boolean isPinned) {
             super(isPinned ? R.drawable.ic_remove_no_shadow : R.drawable.ic_pin,
                     isPinned ? R.string.remove_drop_target_label : R.string.action_add_to_workspace,
-                    target, info);
+                    target, info, originalView);
             mIsPinned = isPinned;
         }
 
diff --git a/src/com/android/launcher3/secondarydisplay/SecondaryDragLayer.java b/src/com/android/launcher3/secondarydisplay/SecondaryDragLayer.java
index 9201006..e906c95 100644
--- a/src/com/android/launcher3/secondarydisplay/SecondaryDragLayer.java
+++ b/src/com/android/launcher3/secondarydisplay/SecondaryDragLayer.java
@@ -193,8 +193,8 @@
         container.populateAndShow((BubbleTextView) v,
                 popupDataProvider.getShortcutCountForItem(item),
                 Collections.emptyList(),
-                Arrays.asList(mPinnedAppsAdapter.getSystemShortcut(item),
-                        APP_INFO.getShortcut(mActivity, item)));
+                Arrays.asList(mPinnedAppsAdapter.getSystemShortcut(item, v),
+                        APP_INFO.getShortcut(mActivity, item, v)));
         v.getParent().requestDisallowInterceptTouchEvent(true);
         return true;
     }