Prevent launcher crash when an App Widget is removed.

If an App Widget with a scrollable element is removed, we may end up in
a situation where we try to draw the view directly on a canvas while the
it has already been detached from the workspace. This can crash as some
of the drawing the scroll indicators require the view to be attached.

In general, we should never draw a view by calling the draw method
directly, even more so when the view is detached: the behavior is
undefined as the method expects the canvas to be properly set up, and it
is not. A crash can therefore be expected. This patch should avoid
crashing the launcher until we stop doing that altogether.

Fix: 183386115
Test: Manally add a view with a preview layout
Test: Manually remove an app widget with a list view
Change-Id: I8e1aa581700a08d6747eab085199c2b293e0e3fb
1 file changed