From acd9d799325543c5f74ac58760191dbda01680f7 Mon Sep 17 00:00:00 2001 From: Steven Ng Date: Fri, 25 Jun 2021 11:51:44 +0100 Subject: [PATCH] Refine widgets removal logging Test: N/A Bug: 190565858 Change-Id: I7fb20eaf727db19787fa9b1fb36eeb5d1392e50c --- src/com/android/launcher3/Launcher.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index d107afdaf9..1cfe7e0300 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2330,30 +2330,32 @@ public class Launcher extends StatefulActivity implements Launche try { final LauncherAppWidgetProviderInfo appWidgetInfo; - String reason = ""; + String removalReason = ""; if (item.hasRestoreFlag(LauncherAppWidgetInfo.FLAG_PROVIDER_NOT_READY)) { // If the provider is not ready, bind as a pending widget. appWidgetInfo = null; - reason = "the provider not ready."; + removalReason = "the provider isn't ready."; } else if (item.hasRestoreFlag(LauncherAppWidgetInfo.FLAG_ID_NOT_VALID)) { // The widget id is not valid. Try to find the widget based on the provider info. appWidgetInfo = mAppWidgetManager.findProvider(item.providerName, item.user); if (appWidgetInfo == null) { if (WidgetsModel.GO_DISABLE_WIDGETS) { - reason = "widgets are disabled on go device."; + removalReason = "widgets are disabled on go device."; } else { - reason = "WidgetManagerHelper cannot find a provider from provider info."; + removalReason = + "WidgetManagerHelper cannot find a provider from provider info."; } } } else { appWidgetInfo = mAppWidgetManager.getLauncherAppWidgetInfo(item.appWidgetId); if (appWidgetInfo == null) { if (item.appWidgetId <= LauncherAppWidgetInfo.CUSTOM_WIDGET_ID) { - reason = "CustomWidgetManager cannot find provider from that widget id ."; + removalReason = + "CustomWidgetManager cannot find provider from that widget id."; } else { - reason = "AppWidgetManager cannot find provider for that widget id." - + " It could be due to AppWidgetService is not available, or the" + removalReason = "AppWidgetManager cannot find provider for that widget id." + + " It could be because AppWidgetService is not available, or the" + " appWidgetId has not been bound to a the provider yet, or you" + " don't have access to that appWidgetId."; } @@ -2366,7 +2368,7 @@ public class Launcher extends StatefulActivity implements Launche if (appWidgetInfo == null) { FileLog.d(TAG, "Removing restored widget: id=" + item.appWidgetId + " belongs to component " + item.providerName + " user " + item.user - + ", as the provider is null and " + reason); + + ", as the provider is null and " + removalReason); getModelWriter().deleteItemFromDatabase(item); return null; }