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

Commit 7fa0ae50 authored by Adam Cohen's avatar Adam Cohen
Browse files

DO NOT MERGE - Catching TransactionTooLargeException in AppWidgetHost#startListening

solution b) from issue 14255011

Change-Id: I1dc521632a132de496ff9a583b1e0b29415aacdd
(cherry picked from commit 084c3187)
parent 60e1efe0
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetProviderInfo;
import android.content.Context;
import android.os.TransactionTooLargeException;

/**
 * Specific {@link AppWidgetHost} that creates our {@link LauncherAppWidgetHostView}
@@ -41,6 +42,22 @@ public class LauncherAppWidgetHost extends AppWidgetHost {
        return new LauncherAppWidgetHostView(context);
    }

    @Override
    public void startListening() {
        try {
            super.startListening();
        } catch (Exception e) {
            if (e.getCause() instanceof TransactionTooLargeException) {
                // We're willing to let this slide. The exception is being caused by the list of
                // RemoteViews which is being passed back. The startListening relationship will
                // have been established by this point, and we will end up populating the
                // widgets upon bind anyway. See issue 14255011 for more context.
            } else {
                throw new RuntimeException(e);
            }
        }
    }

    @Override
    public void stopListening() {
        super.stopListening();