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

Commit 206066b6 authored by Pierre Barbier de Reuille's avatar Pierre Barbier de Reuille
Browse files

Check if a view can be recycled in async case.

When implementing the code, it seems this was forgotten :( If the view
id of the root of the RemoteViews is changed, currently, the top-level
view will be re-used, which is an error.

Bug: 181985606
Test: atest android.widget.cts.RemoteViewsRecyclingTest
Change-Id: I5a8addb08f597ec574e3ed49d1318771e4c7c767
parent a9efae98
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -626,7 +626,7 @@ public class AppWidgetHostView extends FrameLayout {

        // If our stale view has been prepared to match active, and the new
        // layout matches, try recycling it
        if (layoutId == mLayoutId && mView != null) {
        if (remoteViews.canRecycleView(mView)) {
            try {
                mLastExecutionSignal = remoteViews.reapplyAsync(mContext,
                        mView,
+1 −1
Original line number Diff line number Diff line
@@ -5795,7 +5795,7 @@ public class RemoteViews implements Parcelable, Filter {
        // across orientation change, and has the RemoteViews re-applied in the new orientation,
        // we throw an exception, since the layouts may be completely unrelated.
        if (hasMultipleLayouts()) {
            if ((Integer) v.getTag(R.id.widget_frame) != rvToApply.getLayoutId()) {
            if (!rvToApply.canRecycleView(v)) {
                throw new RuntimeException("Attempting to re-apply RemoteViews to a view that" +
                        " that does not share the same root layout id.");
            }