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

Commit cd0a5c53 authored by sallyyuen's avatar sallyyuen Committed by Sally Yuen
Browse files

Fix TalkBack page announcments in RecentsView

Because a PagedView has page a11y actions (PAGE_LEFT/RIGHT),
a11y services now identify recents apps as a pager.
Tweak the a11y event info to accomodate this so the announcements
are correct.
Also fix the CollectionItemInfo to have the correct page index.

Bug: 141899192
Test: Tested with TalkBack on device
Change-Id: Ic578bee8de26a41f0ab0e5468f1fd060ed21a7e1
parent f6d504d4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1673,8 +1673,8 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl

        if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) {
            final int[] visibleTasks = getVisibleChildrenRange();
            event.setFromIndex(taskViewCount - visibleTasks[1] - 1);
            event.setToIndex(taskViewCount - visibleTasks[0] - 1);
            event.setFromIndex(taskViewCount - visibleTasks[1]);
            event.setToIndex(taskViewCount - visibleTasks[0]);
            event.setItemCount(taskViewCount);
        }
    }
+2 −2
Original line number Diff line number Diff line
@@ -728,8 +728,8 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
        final RecentsView recentsView = getRecentsView();
        final AccessibilityNodeInfo.CollectionItemInfo itemInfo =
                AccessibilityNodeInfo.CollectionItemInfo.obtain(
                        0, 1, recentsView.getChildCount() - recentsView.indexOfChild(this) - 1, 1,
                        false);
                        0, 1, recentsView.getTaskViewCount() - recentsView.indexOfChild(this) - 1,
                        1, false);
        info.setCollectionItemInfo(itemInfo);
    }