From b269cc515030cb8a955d2c8315af98be56101236 Mon Sep 17 00:00:00 2001 From: Steven Ng Date: Wed, 4 Aug 2021 11:14:09 +0100 Subject: [PATCH] Don't delete widgets that violate min size requirement Test: Manual Bug: 194766124 Change-Id: I4713e65e27da23d833bb60fb556ae8924a63e305 --- src/com/android/launcher3/model/LoaderTask.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java index 28fd389c49..f6b0b4d3c8 100644 --- a/src/com/android/launcher3/model/LoaderTask.java +++ b/src/com/android/launcher3/model/LoaderTask.java @@ -760,16 +760,13 @@ public class LoaderTask implements Runnable { if (widgetProviderInfo != null && (appWidgetInfo.spanX < widgetProviderInfo.minSpanX || appWidgetInfo.spanY < widgetProviderInfo.minSpanY)) { - logDeleteWidgetInfo(mApp.getInvariantDeviceProfile(), - widgetProviderInfo); - - // This can happen when display size changes. - c.markDeleted("Widget removed, min sizes not met: " - + "span=" + appWidgetInfo.spanX + "x" - + appWidgetInfo.spanY + " minSpan=" + FileLog.d(TAG, "Widget " + widgetProviderInfo.getComponent() + + " minSizes not meet: span=" + appWidgetInfo.spanX + + "x" + appWidgetInfo.spanY + " minSpan=" + widgetProviderInfo.minSpanX + "x" + widgetProviderInfo.minSpanY); - continue; + logWidgetInfo(mApp.getInvariantDeviceProfile(), + widgetProviderInfo); } if (!c.isOnWorkspaceOrHotseat()) { c.markDeleted("Widget found where container != " + @@ -990,10 +987,8 @@ public class LoaderTask implements Runnable { } @SuppressLint("NewApi") // Already added API check. - private static void logDeleteWidgetInfo(InvariantDeviceProfile idp, + private static void logWidgetInfo(InvariantDeviceProfile idp, LauncherAppWidgetProviderInfo widgetProviderInfo) { - FileLog.d(TAG, "Deleting " + widgetProviderInfo.getComponent() - + " due to min size constraint"); Point cellSize = new Point(); for (DeviceProfile deviceProfile : idp.supportedProfiles) { deviceProfile.getCellSize(cellSize);