Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5363de2f authored by Sihua Ma's avatar Sihua Ma
Browse files

Add error log for when widget provider is null

When the service try to update the visibility of the widgets, it would
iterate over the available widgets and check the ids of their providers.
However, due to unknown reasons there is a possibility of their
providers being null even after they are bound to the screen. Adding
more logs to help determine the exact issue.

Bug: 212651639
Test: N/A
Change-Id: I74a095dd2a44d0235fba27a57190aa89032fa63e
parent 7d3188b7
Loading
Loading
Loading
Loading
+10 −4
Original line number Original line Diff line number Diff line
@@ -1109,11 +1109,8 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
            registerForBroadcastsLocked(provider, getWidgetIds(provider.widgets));
            registerForBroadcastsLocked(provider, getWidgetIds(provider.widgets));


            saveGroupStateAsync(userId);
            saveGroupStateAsync(userId);

            if (DEBUG) {
            Slog.i(TAG, "Bound widget " + appWidgetId + " to provider " + provider.id);
            Slog.i(TAG, "Bound widget " + appWidgetId + " to provider " + provider.id);
        }
        }
        }


        return true;
        return true;
    }
    }
@@ -4196,6 +4193,10 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
        IAppWidgetHost callbacks;
        IAppWidgetHost callbacks;
        boolean zombie; // if we're in safe mode, don't prune this just because nobody references it
        boolean zombie; // if we're in safe mode, don't prune this just because nobody references it


        private static final boolean DEBUG = true;

        private static final String TAG = "AppWidgetServiceHost";

        int tag = TAG_UNDEFINED; // for use while saving state (the index)
        int tag = TAG_UNDEFINED; // for use while saving state (the index)
        // Sequence no for the last update successfully sent. This is updated whenever a
        // Sequence no for the last update successfully sent. This is updated whenever a
        // widget update is successfully sent to the host callbacks. As all new/undelivered updates
        // widget update is successfully sent to the host callbacks. As all new/undelivered updates
@@ -4266,6 +4267,11 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
            final SparseArray<String> uids = new SparseArray<>();
            final SparseArray<String> uids = new SparseArray<>();
            for (int i = widgets.size() - 1; i >= 0; i--) {
            for (int i = widgets.size() - 1; i >= 0; i--) {
                final Widget widget = widgets.get(i);
                final Widget widget = widgets.get(i);
                if (widget.provider == null) {
                    if (DEBUG) {
                        Slog.e(TAG, "Widget with no provider " + widget.toString());
                    }
                }
                final ProviderId providerId = widget.provider.id;
                final ProviderId providerId = widget.provider.id;
                uids.put(providerId.uid, providerId.componentName.getPackageName());
                uids.put(providerId.uid, providerId.componentName.getPackageName());
            }
            }