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

Commit ccf3a9ed authored by Sunny Goyal's avatar Sunny Goyal Committed by android-build-merger
Browse files

Preventing a Runtime widget crash from crashing the Launcher

am: 3fc648d3

* commit '3fc648d3':
  Preventing a Runtime widget crash from crashing the Launcher
parents 8628a91b 3fc648d3
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -268,4 +268,19 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc
            getOnFocusChangeListener().onFocusChange(this, focused || isFocused());
        }
    }

    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        try {
            super.onLayout(changed, left, top, right, bottom);
        } catch (final RuntimeException e) {
            post(new Runnable() {
                @Override
                public void run() {
                    // Update the widget with 0 Layout id, to reset the view to error view.
                    updateAppWidget(new RemoteViews(getAppWidgetInfo().provider.getPackageName(), 0));
                }
            });
        }
    }
}