summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-02-25 18:10:37 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-02-25 18:10:38 +0000
commitc1a3181d8db25e36b4303822e429b2839468e259 (patch)
treed6004e2e971c3e086022a0ff0fa6284f34630374 /core/java/android
parentdc32185b924b422d06cfcc399a4b53b0301d78b5 (diff)
parentb880d167a6ba6ce90c0c52c44bc775627150cdb8 (diff)
Merge "Fixing the parent check loop to allow RemoteViewsFrameLayout" into nyc-dev
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/widget/RemoteViews.java11
-rw-r--r--core/java/android/widget/RemoteViewsAdapter.java2
2 files changed, 10 insertions, 3 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");
diff --git a/core/java/android/widget/RemoteViewsAdapter.java b/core/java/android/widget/RemoteViewsAdapter.java
index 8278c5af92cb..10abbab6aacd 100644
--- a/core/java/android/widget/RemoteViewsAdapter.java
+++ b/core/java/android/widget/RemoteViewsAdapter.java
@@ -288,7 +288,7 @@ public class RemoteViewsAdapter extends BaseAdapter implements Handler.Callback
* A FrameLayout which contains a loading view, and manages the re/applying of RemoteViews when
* they are loaded.
*/
- private static class RemoteViewsFrameLayout extends AppWidgetHostView {
+ static class RemoteViewsFrameLayout extends AppWidgetHostView {
private final FixedSizeRemoteViewsCache mCache;
public RemoteViewsFrameLayout(Context context, FixedSizeRemoteViewsCache cache) {