From 447ea429cd9f48a608c11dbef7dec1d2ab22d1ef Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Mon, 20 Jul 2020 16:54:17 -0700 Subject: [PATCH] Fix folder crash where view is added when it already has a parent. The fix is to prevent re-arrangement if the views are already unbound. This is caused when: - Folder is open - Item has deep shortcuts - Long press on deep shortcut to create DragView that could land in the folder if the folder did not auto close. This is important because it starts a drag within the folder The folder unbinds all views as part of the Folder close complete callback. And then the folder exit alarm gets triggered (because we drag DragView outside of the folder) which causes the folder items to get rearranged and added back to the folder's CellLayout. Bug: 161559911 Change-Id: I142589b2c541dc21c47a67c20a93e627732107ef --- src/com/android/launcher3/folder/Folder.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index de2b5da6ad..b91d1c3260 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -1135,6 +1135,9 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo * Rearranges the children based on their rank. */ public void rearrangeChildren() { + if (!mContent.areViewsBound()) { + return; + } mContent.arrangeChildren(getIconsInReadingOrder()); mItemsInvalidated = true; }