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

Commit a40920b9 authored by Matthew Ng's avatar Matthew Ng
Browse files

Recents scroll backwards (accessibility) if clear all button invisible

Currently accessibility prevents swiping from node to node will not show
the "clear all" button when scrolling backwards. Changing the logic to
check the visiblity of the "clear all button" will allow it to be
focusable when invisible and scrolling past the first task.

Bug: 37005488
Test: start Talkback, populate with apps, swipe left continuous past the
first task item
Change-Id: I1733382e62fc72b19ca6a074aa96adf4c0c8b178
parent 47b92092
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -219,6 +219,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
    private boolean mResetToInitialStateWhenResized;
    private int mLastWidth;
    private int mLastHeight;
    private boolean mStackActionButtonVisible;

    // We keep track of the task view focused by user interaction and draw a frame around it in the
    // grid layout.
@@ -287,6 +288,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        mDividerSize = ssp.getDockedDividerSize(context);
        mDisplayOrientation = Utilities.getAppConfiguration(mContext).orientation;
        mDisplayRect = ssp.getDisplayRect();
        mStackActionButtonVisible = false;

        // Create a frame to draw around the focused task view
        if (Recents.getConfiguration().isGridEnabled) {
@@ -1159,7 +1161,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
            Task focusedTask = getAccessibilityFocusedTask();
            info.setScrollable(true);
            int focusedTaskIndex = mStack.indexOfStackTask(focusedTask);
            if (focusedTaskIndex > 0) {
            if (focusedTaskIndex > 0 || !mStackActionButtonVisible) {
                info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
            }
            if (0 <= focusedTaskIndex && focusedTaskIndex < mStack.getTaskCount() - 1) {
@@ -1812,6 +1814,18 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
        }
    }

    public final void onBusEvent(ShowStackActionButtonEvent event) {
        if (RecentsDebugFlags.Static.EnableStackActionButton) {
            mStackActionButtonVisible = true;
        }
    }

    public final void onBusEvent(HideStackActionButtonEvent event) {
        if (RecentsDebugFlags.Static.EnableStackActionButton) {
            mStackActionButtonVisible = false;
        }
    }

    public final void onBusEvent(LaunchNextTaskRequestEvent event) {
        if (!mFinishedLayoutAfterStackReload) {
            mLaunchNextAfterFirstMeasure = true;