From fea773a5c2e1cb3df348229946c37b23e191c90b Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Mon, 28 Apr 2025 11:57:17 -0700 Subject: [PATCH] Always change the container when dropping in icon I was being cautios on my previous fix for this same isse, cautios because I'm modifying an object by reference That's why I was only updating the container when the icon being dropped was PendingAddShortcutInfo but we can change the container on every icon (we don't need to in the Widget case which is the other if statement), we can be sure it is a safe operation because we later update the info anyway rendering the previous info invalid. Fix: 413784315 Test: WIP Flag: EXEMPT bug fix Change-Id: I60ecdb52be1c7bf0584cb1c74ee15b85961e5012 --- src/com/android/launcher3/Workspace.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index db5dc8054e..b3b89819c1 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -2907,6 +2907,9 @@ public class Workspace extends PagedView } else { // This is for other drag/drop cases, like dragging from All Apps mLauncher.getStateManager().goToState(NORMAL, SPRING_LOADED_EXIT_DELAY); + // TODO(b/414409465) We could just create a new info making a copy with all the new + // needed values instead of choosing on each case what to modify. + info.container = container; View view = mLauncher.getItemInflater().inflateItem(info, cellLayout); d.dragInfo = info = (ItemInfo) view.getTag();