From c62a4dae5f9c7cb02503214730d5a4153689c9f2 Mon Sep 17 00:00:00 2001 From: Stefan Andonian Date: Wed, 30 Mar 2022 22:55:34 +0000 Subject: [PATCH] Show correct drop targets for All-apps predicted item drags. This change fixes a bug where, after a user drags and drops a predicted app from the all apps page once, dragging that item again results in the "Remove" drop target being shown rather than the "Do Not Suggest" drop target. Bug: 221057278 Test: Verified correct drop down targets were present after fix when dropping all apps prediction item on workspace multiple times in a row. Change-Id: I95940eeebbd547861fcdfbb5d02769b82446184d --- src/com/android/launcher3/Workspace.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index a7fc2f52ba..e3e8cc0233 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -2751,6 +2751,12 @@ public class Workspace extends PagedView info = ((AppInfo) info).makeWorkspaceItem(); d.dragInfo = info; } + if (info instanceof WorkspaceItemInfo + && info.container == LauncherSettings.Favorites.CONTAINER_PREDICTION) { + // Came from all apps prediction row -- make a copy + info = new WorkspaceItemInfo((WorkspaceItemInfo) info); + d.dragInfo = info; + } if (info instanceof SearchActionItemInfo) { info = ((SearchActionItemInfo) info).createWorkspaceItem( mLauncher.getModel());