From b814c3bb2358183f3cb03c17926bb869f1a17841 Mon Sep 17 00:00:00 2001 From: Tracy Zhou Date: Tue, 14 Jul 2020 01:25:55 -0700 Subject: [PATCH] Infinite loop when migrating calendar widget Second page can take y = 0 Fixes: 161201598 Test: manual Change-Id: I6654db5c2c358dfb132268218dd044674e302e83 --- src/com/android/launcher3/model/GridSizeMigrationTaskV2.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java b/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java index ebdfa8c820..79467d36f6 100644 --- a/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java +++ b/src/com/android/launcher3/model/GridSizeMigrationTaskV2.java @@ -406,7 +406,7 @@ public class GridSizeMigrationTaskV2 { * to speed up the search. */ private boolean findPlacement(DbEntry entry) { - for (int y = mNextStartY; y > 0; y--) { + for (int y = mNextStartY; y >= (mScreenId == 0 ? 1 /* smartspace */ : 0); y--) { for (int x = mNextStartX; x < mTrgX; x++) { boolean fits = mOccupied.isRegionVacant(x, y, entry.spanX, entry.spanY); boolean minFits = mOccupied.isRegionVacant(x, y, entry.minSpanX,