summaryrefslogtreecommitdiff
path: root/core/java/android/widget/RemoteViews.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-02-24 14:38:59 -0800
committerSunny Goyal <sunnygoyal@google.com>2016-02-25 09:07:37 -0800
commitb880d167a6ba6ce90c0c52c44bc775627150cdb8 (patch)
tree91dcffdabba4f1a2324b5b07529ee1fbeb6f8850 /core/java/android/widget/RemoteViews.java
parentfe2fba3742c5e67f3061bc7c0bf7c97dc3056123 (diff)
Fixing the parent check loop to allow RemoteViewsFrameLayout
Bug: 27328093 Change-Id: I0f6ae8e95f952d40589eafb912ba188d15d7624c
Diffstat (limited to 'core/java/android/widget/RemoteViews.java')
-rw-r--r--core/java/android/widget/RemoteViews.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 914ffdf8b1e9..1cccfaeb7dc3 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -454,12 +454,19 @@ public class RemoteViews implements Parcelable, Filter {
public void onClick(View v) {
// Insure that this view is a child of an AdapterView
View parent = (View) v.getParent();
+ // Break the for loop on the first encounter of:
+ // 1) an AdapterView,
+ // 2) an AppWidgetHostView that is not a RemoteViewsFrameLayout, or
+ // 3) a null parent.
+ // 2) and 3) are unexpected and catch the case where a child is not
+ // correctly parented in an AdapterView.
while (parent != null && !(parent instanceof AdapterView<?>)
- && !(parent instanceof AppWidgetHostView)) {
+ && !((parent instanceof AppWidgetHostView) &&
+ !(parent instanceof RemoteViewsAdapter.RemoteViewsFrameLayout))) {
parent = (View) parent.getParent();
}
- if (parent instanceof AppWidgetHostView || parent == null) {
+ if (!(parent instanceof AdapterView<?>)) {
// Somehow they've managed to get this far without having
// and AdapterView as a parent.
Log.e(LOG_TAG, "Collection item doesn't have AdapterView parent");