diff options
author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-03-20 11:51:39 -0700 |
---|---|---|
committer | Svetoslav Ganov <svetoslavganov@google.com> | 2012-04-13 19:05:24 -0700 |
commit | 4213804541a8b05cd0587b138a2fd9a3b7fd9350 (patch) | |
tree | 6b19718ddbc60229cd4f2e059feea8021225c5e6 /core/tests | |
parent | dbed083ff07f4e6fa727ea22cdd7d758291630c1 (diff) | |
download | frameworks_base-4213804541a8b05cd0587b138a2fd9a3b7fd9350.zip frameworks_base-4213804541a8b05cd0587b138a2fd9a3b7fd9350.tar.gz frameworks_base-4213804541a8b05cd0587b138a2fd9a3b7fd9350.tar.bz2 |
Accessibility focus - framework
Usefulness: Keep track of the current user location in the screen when
traversing the it. Enabling structural and directional
navigation over all elements on the screen. This enables
blind users that know the application layout to efficiently
locate desired elements as opposed to try touch exploring the
region where the the element should be - very tedious.
Rationale: There are two ways to implement accessibility focus One is
to let accessibility services keep track of it since they
have access to the screen content, and another to let the view
hierarchy keep track of it. While the first approach would
require almost no work on our part it poses several challenges
which make it a sub-optimal choice. Having the accessibility focus
in the accessibility service would require that service to scrape
the window content every time it changes to sync the view tree
state and the accessibility focus location. Pretty much the service
will have to keep an off screen model of the screen content. This
could be quite challenging to get right and would incur performance
cost for the multiple IPCs to repeatedly fetch the screen content.
Further, keeping virtual accessibility focus (i.e. in the service)
would require sync of the input and accessibility focus. This could
be challenging to implement right as well. Also, having an unlimited
number of accessibility services we cannot guarantee that they will
have a proper implementation, if any, to allow users to perform structural
navigation of the screen content. Assuming two accessibility
services implement structural navigation via accessibility focus,
there is not guarantee that they will behave similarly by default,
i.e. provide some standard way to navigate the screen content.
Also feedback from experienced accessibility researchers, specifically
T.V Raman, provides evidence that having virtual accessibility focus
creates many issues and it is very hard to get right.
Therefore, keeping accessibility focus in the system will avoid
keeping an off-screen model in accessibility services, it will always
be in sync with the state of the view hierarchy and the input focus.
Also this will allow having a default behavior for traversing the
screen via this accessibility focus that is consistent in all
accessibility services. We provide accessibility services with APIs to
override this behavior but all of them will perform screen traversal
in a consistent way by default.
Behavior: If accessibility is enabled the accessibility focus is the leading one
and the input follows it. Putting accessibility focus on a view moves
the input focus there. Clearing the accessibility focus of a view, clears
the input focus of this view. If accessibility focus is on a view that
cannot take input focus, then no other view should have input focus.
In accessibility mode we initially give accessibility focus to the topmost
view and no view has input focus. This ensures consistent behavior accross
all apps. Note that accessibility focus can move hierarchically in the
view tree and having it at the root is better than putting it where the
input focus would be - at the first input focusable which could be at
an arbitrary depth in the view tree. By default not all views are reported
for accessibility, only the important ones. A view may be explicitly labeled
as important or not for accessibility, or the system determines which one
is such - default. Important views for accessibility are all views that are
not dumb layout managers used only to arrange their chidren. Since the same
content arrangement can be obtained via different combintation of layout
managers, such managers cannot be used to reliably determine the application
structure. For example, a user should see a list as a list view with several
list items and each list item as a text view and a button as opposed to seeing
all the layout managers used to arrange the list item's content.
By default only important for accessibility views are regared for accessibility
purposes. View not regarded for accessibility neither fire accessibility events,
nor are reported being on the screen. An accessibility service may request the
system to regard all views. If the target SDK of an accessibility services is
less than JellyBean, then all views are regarded for accessibility.
Note that an accessibility service that requires all view to be ragarded for
accessibility may put accessibility focus on any view. Hence, it may implement
any navigational paradigm if desired. Especially considering the fact that
the system is detecting some standard gestures and delegates their processing
to an accessibility service. The default implementation of an accessibility
services performs the defualt navigation.
bug:5932640
bug:5605641
Change-Id: Ieac461d480579d706a847b9325720cb254736ebe
Diffstat (limited to 'core/tests')
-rw-r--r-- | core/tests/coretests/src/android/widget/focus/ListOfButtonsTest.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/tests/coretests/src/android/widget/focus/ListOfButtonsTest.java b/core/tests/coretests/src/android/widget/focus/ListOfButtonsTest.java index 3dba4e5..1968a32 100644 --- a/core/tests/coretests/src/android/widget/focus/ListOfButtonsTest.java +++ b/core/tests/coretests/src/android/widget/focus/ListOfButtonsTest.java @@ -19,7 +19,7 @@ package android.widget.focus; import android.widget.focus.ListOfButtons; import com.android.frameworks.coretests.R; -import android.test.ActivityInstrumentationTestCase; +import android.test.ActivityInstrumentationTestCase2; import android.test.suitebuilder.annotation.MediumTest; import android.widget.ListAdapter; import android.widget.Button; @@ -31,7 +31,7 @@ import android.view.View; * Tests that focus works as expected when navigating into and out of * a {@link ListView} that has buttons in it. */ -public class ListOfButtonsTest extends ActivityInstrumentationTestCase<ListOfButtons> { +public class ListOfButtonsTest extends ActivityInstrumentationTestCase2<ListOfButtons> { private ListAdapter mListAdapter; private Button mButtonAtTop; @@ -39,7 +39,7 @@ public class ListOfButtonsTest extends ActivityInstrumentationTestCase<ListOfBut private ListView mListView; public ListOfButtonsTest() { - super("com.android.frameworks.coretests", ListOfButtons.class); + super(ListOfButtons.class); } @Override @@ -47,6 +47,7 @@ public class ListOfButtonsTest extends ActivityInstrumentationTestCase<ListOfBut super.setUp(); ListOfButtons a = getActivity(); + getInstrumentation().waitForIdleSync(); mListAdapter = a.getListAdapter(); mButtonAtTop = (Button) a.findViewById(R.id.button); mListView = a.getListView(); |