From 7f4bbfa599cdd047e469cb1d2d60dd00971ee1fd Mon Sep 17 00:00:00 2001 From: fbaron Date: Tue, 19 Sep 2023 14:58:34 -0700 Subject: [PATCH] Fix indexoutofbounds folder preview The indexoutofbounds issue came from the fact that folder was being animated open when there are no items in preview. It might be a race condition where we try to open the folder at a time where it's actually being emptied. This check should prevent folders from running animateOpen() if there's <= 1 items, avoiding the outofbounds error Fix: 298740874 Flag: no flag Test: no test Change-Id: I31ed53fbdf22a7f19bc9ec414242312afe7c6cd2 --- src/com/android/launcher3/folder/Folder.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index fc36ce674c..57e1641bf0 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -645,6 +645,11 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo * is played. */ private void animateOpen(List items, int pageNo) { + if (items == null || items.size() <= 1) { + Log.d(TAG, "Couldn't animate folder open because items is: " + items); + return; + } + Folder openFolder = getOpen(mActivityContext); if (openFolder != null && openFolder != this) { // Close any open folder before opening a folder.