Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b880d167 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Fixing the parent check loop to allow RemoteViewsFrameLayout

Bug: 27328093
Change-Id: I0f6ae8e95f952d40589eafb912ba188d15d7624c
parent fe2fba37
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -454,12 +454,19 @@ public class RemoteViews implements Parcelable, Filter {
                    public void onClick(View v) {
                    public void onClick(View v) {
                        // Insure that this view is a child of an AdapterView
                        // Insure that this view is a child of an AdapterView
                        View parent = (View) v.getParent();
                        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<?>)
                        while (parent != null && !(parent instanceof AdapterView<?>)
                                && !(parent instanceof AppWidgetHostView)) {
                                && !((parent instanceof AppWidgetHostView) &&
                                    !(parent instanceof RemoteViewsAdapter.RemoteViewsFrameLayout))) {
                            parent = (View) parent.getParent();
                            parent = (View) parent.getParent();
                        }
                        }


                        if (parent instanceof AppWidgetHostView || parent == null) {
                        if (!(parent instanceof AdapterView<?>)) {
                            // Somehow they've managed to get this far without having
                            // Somehow they've managed to get this far without having
                            // and AdapterView as a parent.
                            // and AdapterView as a parent.
                            Log.e(LOG_TAG, "Collection item doesn't have AdapterView parent");
                            Log.e(LOG_TAG, "Collection item doesn't have AdapterView parent");
+1 −1
Original line number Original line Diff line number Diff line
@@ -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
     * A FrameLayout which contains a loading view, and manages the re/applying of RemoteViews when
     * they are loaded.
     * they are loaded.
     */
     */
    private static class RemoteViewsFrameLayout extends AppWidgetHostView {
    static class RemoteViewsFrameLayout extends AppWidgetHostView {
        private final FixedSizeRemoteViewsCache mCache;
        private final FixedSizeRemoteViewsCache mCache;


        public RemoteViewsFrameLayout(Context context, FixedSizeRemoteViewsCache cache) {
        public RemoteViewsFrameLayout(Context context, FixedSizeRemoteViewsCache cache) {