diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2021-11-08 23:21:31 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-11-08 23:21:31 +0000 |
| commit | 533ce6f9f0bbecd804ca8194577767727876fb5d (patch) | |
| tree | 5b37e1d8eecb4387f60a5967ca31aee9aae3671a /core/java/android | |
| parent | 217e1d88194f9ac211ba46a3889fb718c420a48a (diff) | |
| parent | 951bc7d8923cbbc90687f8dd19c45975f56e3ca6 (diff) | |
Merge "Revert "Always check if the view can be recycled."" into sc-v2-dev
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/widget/RemoteViews.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index 57b7d618917d..2357d13c8d41 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(), |
