From 49e6695c5cfd136b3047b6679b8fcde1ff56a9d2 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Tue, 17 May 2016 11:57:53 -0700 Subject: [PATCH] Store the appropriate layout id for the infrated view, so that it can be used for verification during reapply. Bug: 28815495 Change-Id: I8516661ef97f529851069331a6c2bb64429c7766 --- core/java/android/widget/RemoteViews.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index 6dc5ff7c427a5..4a0f3509ad31d 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -3176,7 +3176,9 @@ public class RemoteViews implements Parcelable, Filter { // we don't add a filter to the static version returned by getSystemService. inflater = inflater.cloneInContext(inflationContext); inflater.setFilter(this); - return inflater.inflate(rv.getLayoutId(), parent, false); + View v = inflater.inflate(rv.getLayoutId(), parent, false); + v.setTagInternal(R.id.widget_frame, rv.getLayoutId()); + return v; } private static void loadTransitionOverride(Context context, @@ -3354,7 +3356,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 (hasLandscapeAndPortraitLayouts()) { - if (v.getId() != rvToApply.getLayoutId()) { + if ((Integer) v.getTag(R.id.widget_frame) != rvToApply.getLayoutId()) { throw new RuntimeException("Attempting to re-apply RemoteViews to a view that" + " that does not share the same root layout id."); } @@ -3390,7 +3392,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 (hasLandscapeAndPortraitLayouts()) { - if (v.getId() != rvToApply.getLayoutId()) { + if ((Integer) v.getTag(R.id.widget_frame) != rvToApply.getLayoutId()) { throw new RuntimeException("Attempting to re-apply RemoteViews to a view that" + " that does not share the same root layout id."); }