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

Commit 1e51cc7e authored by Alan Viverette's avatar Alan Viverette
Browse files

Clear accessibility focus from recycled views when needed

BUG: 10913323
Change-Id: I99c20269b4f5e491685f75c2e3bbb36d541a5525
parent 398d7f61
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -2252,6 +2252,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 {
@@ -5071,6 +5078,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);
                    }
                }
@@ -5089,6 +5101,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);
                    }
                }
@@ -6662,8 +6679,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;
@@ -6702,6 +6719,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) {