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

Commit 09522461 authored by Joshua Trask's avatar Joshua Trask
Browse files

A11y: announce when resolver items are "selected"

To test, I manually changed the condition in the listener (checking
layout-with-default, selection, and always button) to instead read
`if (true)` -- otherwise we would launch the target immediately upon
selection, w/o reading out the state text. Then I initiate a Resolver
session with Talkback on.

When an item is first tapped, Talkback adds a green frame around its
row and reads "double-tap to select / double-tap-and-hold to long
press." Double-tapping anywhere on the screen changes the background
color of that item and reads "selected." Single-tapping a different
item moves the green frame but not the background; single-tapping
back to the currently-selected item indicates that it's still in the
"selected" state. I believe this is the correct a11y behavior.

Fix: 399189789
Test: manually as described above; atest ResolverActivityTest
Flag: EXEMPT bugfix
Change-Id: Ic446a308df296a7c3cb15f3d100fa9c0fde7b73b
parent bd2e8874
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -159,6 +159,7 @@ public class ResolverActivity extends Activity implements
    private Button mOnceButton;
    protected View mProfileView;
    private int mLastSelected = AbsListView.INVALID_POSITION;
    @Nullable private View mLastSelectedItemView;
    private boolean mResolvingHome = false;
    private String mProfileSwitchMessage;
    private int mLayoutId;
@@ -2199,6 +2200,7 @@ public class ResolverActivity extends Activity implements
            return;
        }
        mLastSelected = ListView.INVALID_POSITION;
        mLastSelectedItemView = null;
        ListView inactiveListView = (ListView) mMultiProfilePagerAdapter.getInactiveAdapterView();
        if (inactiveListView.getCheckedItemCount() > 0) {
            inactiveListView.setItemChecked(inactiveListView.getCheckedItemPosition(), false);
@@ -2582,6 +2584,12 @@ public class ResolverActivity extends Activity implements
                    mOnceButton.requestFocus();
                }
                mLastSelected = checkedPos;
                if (mLastSelectedItemView != null) {
                    mLastSelectedItemView.setStateDescription(null);
                }
                mLastSelectedItemView = view;
                mLastSelectedItemView.setStateDescription(
                        getString(com.android.internal.R.string.selected));
            } else {
                startSelected(position, false, true);
            }