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

Commit 0d5fe0dd authored by Alan Viverette's avatar Alan Viverette Committed by Android Git Automerger
Browse files

am 4c6b2900: Merge "Clear accessibility focus from recycled views when needed" into klp-dev

* commit '4c6b2900':
  Clear accessibility focus from recycled views when needed
parents b1992b55 4c6b2900
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -2250,6 +2250,13 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                }
            } else {
                isScrap[0] = true;

                // Clear any system-managed transient state so that we can
                // recycle this view and bind it to different data.
                if (child.isAccessibilityFocused()) {
                    child.clearAccessibilityFocus();
                }

                child.dispatchFinishTemporaryDetach();
            }
        } else {
@@ -5069,6 +5076,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                    count++;
                    int position = firstPosition + i;
                    if (position >= headerViewsCount && position < footerViewsStart) {
                        // The view will be rebound to new data, clear any
                        // system-managed transient state.
                        if (child.isAccessibilityFocused()) {
                            child.clearAccessibilityFocus();
                        }
                        mRecycler.addScrapView(child, position);
                    }
                }
@@ -5087,6 +5099,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                    count++;
                    int position = firstPosition + i;
                    if (position >= headerViewsCount && position < footerViewsStart) {
                        // The view will be rebound to new data, clear any
                        // system-managed transient state.
                        if (child.isAccessibilityFocused()) {
                            child.clearAccessibilityFocus();
                        }
                        mRecycler.addScrapView(child, position);
                    }
                }
@@ -6660,8 +6677,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te

            lp.scrappedFromPosition = position;

            // Don't scrap header or footer views, or views that should
            // otherwise not be recycled.
            // Remove but don't scrap header or footer views, or views that
            // should otherwise not be recycled.
            final int viewType = lp.viewType;
            if (!shouldRecycleViewType(viewType)) {
                return;
@@ -6700,6 +6717,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
                    mScrapViews[viewType].add(scrap);
                }

                // Clear any system-managed transient state.
                if (scrap.isAccessibilityFocused()) {
                    scrap.clearAccessibilityFocus();
                }

                scrap.setAccessibilityDelegate(null);

                if (mRecyclerListener != null) {