From b0b6a212b8a4b21eaee105ae5cba1e8645aa7111 Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Wed, 8 Mar 2023 13:53:28 -0800 Subject: [PATCH] Stop DeleteDropTarget from setting the containerId of items to NO_ID When deleting items, the items wont get removed form the database right away to give time for the user to undo the operation if needed. When rotating the screen the items get loaded again, even those items marked for deletion who hasn't been deleted yet, and because they have the container to NO_ID it cause Launcher to crash. There is no need to set the containerId to NO_ID because the trigger to finally remove the items gets called when the toast to undo disappears and rotating the screen triggers the toast to disapear. It might be posible for the item to flash in the workspace if it gets render before deleting after rotation but it's so fast that I haven't seen that issue. Fix: 262199032 Test: Manuall test: remove item from hotseat, rotate device before toast with undo button disapears. Change-Id: Ia8726941dc81078b49b32565daa32fadf3ae45ba --- src/com/android/launcher3/DeleteDropTarget.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java index 95d3ad9dbb..9ef9320352 100644 --- a/src/com/android/launcher3/DeleteDropTarget.java +++ b/src/com/android/launcher3/DeleteDropTarget.java @@ -121,7 +121,6 @@ public class DeleteDropTarget extends ButtonDropTarget { public void onDrop(DragObject d, DragOptions options) { if (canRemove(d.dragInfo)) { mLauncher.getModelWriter().prepareToUndoDelete(); - d.dragInfo.container = NO_ID; } super.onDrop(d, options); mStatsLogManager.logger().withInstanceId(d.logInstanceId)