From 951bc7d8923cbbc90687f8dd19c45975f56e3ca6 Mon Sep 17 00:00:00 2001 From: Daniel Chapin Date: Mon, 8 Nov 2021 17:20:04 +0000 Subject: [PATCH] Revert "Always check if the view can be recycled." Revert "Add test checking view recycling is always tested" Revert submission 16149646-betterRecycling Reason for revert: Droidfood Blocking Bug: 205503898 Reverted Changes: Ib01c511e4:Always check if the view can be recycled. If11dcd323:Add test checking view recycling is always tested Change-Id: Id08d5ea3602d9d3ca03e148e57a9f97435534e2c --- core/java/android/widget/RemoteViews.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index 57b7d618917da..2357d13c8d41d 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -5746,9 +5746,11 @@ public class RemoteViews implements Parcelable, Filter { // persisted across change, and has the RemoteViews re-applied in a different situation // (orientation or size), we throw an exception, since the layouts may be completely // unrelated. - 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."); + if (hasMultipleLayouts()) { + 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."); + } } rvToApply.performApply(v, (ViewGroup) v.getParent(), handler, colorResources); @@ -5792,9 +5794,11 @@ public class RemoteViews implements Parcelable, Filter { // In the case that a view has this RemoteViews applied in one orientation, is persisted // 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 (!rvToApply.canRecycleView(v)) { - throw new RuntimeException("Attempting to re-apply RemoteViews to a view that" - + " that does not share the same root layout id."); + if (hasMultipleLayouts()) { + 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."); + } } return new AsyncApplyTask(rvToApply, (ViewGroup) v.getParent(),