32 Commits

Author SHA1 Message Date
Svetoslav Ganov
a31f5e6374 InputFilter not updated on global accessibility change.
Change-Id: I35fd5fa078840abf62a3d5eac66b2eae1a79d01d
2011-07-28 20:18:10 -07:00
Svetoslav Ganov
4e2a762eae Not user generated accessibility events can change the interrogation allowing window.
1. Events not generated by the user can change the interrogation allowing window
   unpredicatably. For example when a ListView lays out its children it fires an
   accessibility events and changes the currently active window while the user
   interaction may be happening in another window say a dialog. Now the interrogation
   allowing window is changed when a new window is shown or the user has touch
   explored it.

bug:5074116

Change-Id: I8dde12bbec807d32445a781eedced9b95312b3e2
2011-07-26 20:08:50 -07:00
Svetoslav Ganov
940dabfc66 Merge "TouchExplorer long press not working and activation tap not respecting distance slop." 2011-07-25 12:10:46 -07:00
Svetoslav Ganov
f5a07905a3 TouchExplorer long press not working and activation tap not respecting distance slop.
1. The first problem is manifested on Prime. Apparently the Prime screen driver
   is very aggresive in filtering move events that origin from almost the same
   location. Hence, the framework doesn't see a constant stream of events. However,
   the TouchExplorer implementation was assuming a constant event stream to detect
   long press. Refactored the code such that no assumptions for the event stream
   are made.

2. Touch exploring an item and then tapping far away from that item was activating
   it, hence not respecting the distance slop. This was due to incorrect check of
   the latter.

bug:5070917

Change-Id: I3627a2feeb3712133f58f8f8f1ab7a2ec50cdc9a
2011-07-24 19:43:50 -07:00
Svetoslav Ganov
00aabf7d18 Touch exploration state set to clients asynchronously and depended on talking service being enabled.
1. Upon registration of an accessibility client the latter received only
   the accessiiblity state and waiting for the touch exploration state
   to be sent by the system in async manner. This led the very first
   check of touch exploration state is checked a wrong value to be reported.
   Now a state of the accessibility layer is returned to the client
   upon registration.

2. Removing the dependency on talking accessibility service to be enabled
   for getting into touch exploration mode. What if the user wants to use
   an accessibility service that shows a dialog with the text of the touched
   view?

bug:5051546

Change-Id: Ib377babb3f560929ee73bd3d8b0d277341ba23f7
2011-07-22 17:38:54 -07:00
Svetoslav Ganov
35bfedeaba Touch exploration separate setting and API to poll the latter state.
1. Seperated touch exploration to be a seperate setting rather being
   magically enabled by the system of accessiiblity is on the there
   is at leas one accessibility service that speaks enabled. Now
   there is a setting for requesting touch exploration but still the
   system will enabled it only if that makes sense i.e. accessibility
   is on and one accessibility service that speaks is enabled.

2. Added public API for checking of touch exploration is enabled.

3. Added description attribute in accessibility service declaration
   which will be shown to the user before enabling the service.

4. Added API for quick cloning of AccessibilityNodeInfo.

5. Added clone functionality to SparseArray, SparseIntArray, and
   SparseBooleanArray.

bug:5034010
bug:5033928

Change-Id: Ia442edbe55c20309244061cd9d24e0545c01b54f
2011-07-18 12:44:08 -07:00
Svetoslav Ganov
4a49d9fe52 Throw an exception if accessibility service has not requested to retrieve window content.
1. If an accessibility service does not request access to the window
   content and does so, an exception is thrown to point the developer
   to the reason.

bug:5038284

Change-Id: Ibf08f4d2c8ad8939c4f4c2e288048a4f8ff1e31b
2011-07-17 12:22:14 -07:00
Svetoslav Ganov
ea80b2d02f Exception in TouchExplorer due to invalid pointer id.
Change-Id: Iec5d3b3b0d3ae5676e16384ed2b12352fe4a7f3c
2011-07-16 13:41:21 -07:00
Svetoslav Ganov
63c04eeb00 Touch exploration gesture events change the window id.
1. Touch exploration start and end events are generated
   by the sytstem to provide additional information for
   accessibility services. Since such events do not come
   from any particular window they whould not change the
   id of the window that currently allows exploring its
   content.

2. Touch exploration start and end events were lealing the
   touch explorer class wich is private.

bug:5026258

Change-Id: Icaf3e2bd9566716f2afb876cf8e0d50813b0c76e
2011-07-13 17:22:15 -07:00
Svetoslav Ganov
e8f95352cf Addressing comments during security review of the interrogation feature.
1. Pretty much minor fixes for improving readability.

Change-Id: I76efdcc574af9a277b54eeb9fb5caf34948fcfde
2011-07-06 17:24:54 -07:00
Svetoslav Ganov
b96a41136a Fatal system crash due to NullPointerException
1. Due to thread interleaving it was possible that
   two messages are sent for requesting dispatch of
   the same accessibility event and since the first
   one sends the event and removes it from the pending
   list the second message pulls null during the event
   lookup. Look at the patch's comments for a detailed
   scenario and rationale of the fix.

bug:4886129

Change-Id: If8b272ceaec7709c659ae502c3a730e63c939172
2011-06-28 03:05:10 -07:00
Svetoslav Ganov
cf15bb6197 Merge "ArrayIndexOutOfBounds exception in TouchExplorer." 2011-06-27 12:07:27 -07:00
Svetoslav Ganov
51cccf0845 ArrayIndexOutOfBounds exception in TouchExplorer.
1. The explorer was injecting up/down touch events to
   click with the id of the last pointer that went up
   but the prototype i.e. last touch explore event may
   not contain this pointer. Since we click on the last
   touch explored location then using the action pointer
   index of that event is the right approach.

bug:4551506

Change-Id: I73428b09dc014417096a52e667f58768a2871dc8
2011-06-27 12:06:17 -07:00
Svetoslav Ganov
a0156177cd Added scroll and text selection change accessibility events.
1. Added scrolling accessibility event to provicde feedback
   when a view is scrolled.

Note: We need scroll events for ICS since even though we have
      touch exploration the user does not know when something
      is scrollable and not feedback is provided while scrolling.

bug:4902097

2. Added a text selection change event to provide feedback
   for selection changes including cursor movement.

Note: We need the text selection change events for ICS since
      even though the IME supports navigation in text fields
      the user receives no feedback for the current selection/
      cursor position.

bug:4586186

3. Added a scrollable property to both AccessibilityEvent and
   AccessibilityNodeInfo. The info has to describe the source
   in terms of all properties that make sense for accessibility
   purposes and the event has this property (kinda duplicated)
   since clients will aways want to know if the source is
   scrollable to provided clue to the user and we want to avoid
   pulling the info of the source for every accessibility event.

Change-Id: I232d6825da78e6a12d52125f51320217e6fadb11
2011-06-26 21:35:22 -07:00
Svetoslav Ganov
1ecc1e098a Minor tweak I forgot in the presious change.
Change-Id: I17854e3c824bea5b6c0ffeea45f986f0b5297054
2011-06-22 11:40:13 -07:00
Svetoslav Ganov
7961be75f4 AccessibilityNodeInfo bounds inconsistent with compatibility mode.
1. In compatibility mode a window wide scaling is applied to stretch
   the content. However, AccessibilityNodeInfos retrieved from that
   window contain bounds in application's view of the world and need
   to be scaled to properly relect what a sighted user sees.

Change-Id: Iebbb99526fc327f45b5cede89ba8c32e6ebd8845
2011-06-21 13:02:03 -07:00
Svetoslav Ganov
9dc98e3d17 Accessiiblity in right state upon connection of a test agent.
1. Enabling accessibility and disabling all enabled
   accessibility service when a test client connects
   the the AccessibilityManagerService.

Change-Id: I2f40cccaa0035ac1454d8c5ac84678c1542a0229
2011-06-16 16:12:36 -07:00
Svetoslav Ganov
eeee4d2c01 Final polish of the interrogation feature.
1. Added a new event type for notifying client accessibilitiy
   services for changes in the layout. The event is fired at
   most once for a given time frame and is delivered to clients
   only if it originates from the window that can be interrogated.

2. Exposed the findByText functionality in AccessibilityNodeInfo.
   This is very useful for an accessibility service since it allows
   searching for something the user knows is on the screen thus
   avoiding touch exploring the content. Touch exploring is
   excellent for learning the apps but knowing them search is
   much faster.

3. Fixed a bug causing an accessibiliby service not to receive
   the event source in case of more than one service is registered
   and one of them does not have paermission to interrogate the window.
   The same event was dispatched to multiple services but if one
   of them does not have interrogation permission the event is
   modified to remove the source causing subsequent serivices not
   to get the later.

4. Moved the getSource setSource methods to AccessibilityRecord
   instead in AccessibilityEvent.

5. Hiden some protected members in AccessibilityRecod which should
   not be made public since getters exist.

6. Added the View absolute coordinates in the screen to AccessibilityNodeInfo.
   This is needed for fast computation of relative positions of
   views from accessibility - common use case for the later.

7. Fixed a couple of marshalling bugs.

8. Added a test for the object contract of AccessibilityNodeInfo.

Change-Id: Id9dc50c33aff441e4c93d25ea316c9bbc4bd7a35
2011-06-10 21:10:46 -07:00
Svetoslav Ganov
00f7b3f765 Crash in the TouchExplorer
1. No clearing the last touch explore event in all cases
   when transitioning to another mode.

2. Incorrectly assuming the the action index of an up/down
   events is 0.

bug:4551506

Change-Id: I43f8e800b54a340968489dc924a539795a9195cb
2011-06-07 19:27:56 -07:00
Svetoslav Ganov
8643aa0179 Interrogation of the view hierarchy from an AccessibilityService.
1. Views are represented as AccessibilityNodeInfos to AccessibilityServices.

2. An accessibility service receives AccessibilityEvents and can ask
   for its source and gets an AccessibilityNodeInfo which can be used
   to get its parent and children infos and so on.

3. AccessibilityNodeInfo contains some attributes and actions that
   can be performed on the source.

4. AccessibilityService can request the system to preform an action
   on the source of an AccessibilityNodeInfo.

5. ViewAncestor provides an interaction connection to the
   AccessibiltyManagerService and an accessibility service uses
   its connection to the latter to interact with screen content.

6. AccessibilityService can interact ONLY with the focused window
   and all calls are routed through the AccessibilityManagerService
   which imposes security.

7. Hidden APIs on AccessibilityService can find AccessibilityNodeInfos
   based on some criteria. These API go through the AccessibilityManagerServcie
   for security check.

8. Some actions are hidden and are exposes only to eng builds for UI testing.

Change-Id: Ie34fa4219f350eb3f4f6f9f45b24f709bd98783c
2011-06-06 18:46:03 -07:00
Svetoslav Ganov
c321c19fc9 Fixing a bug I introduced during my last merge.
Change-Id: I6474ca94a6ef9bd17a5670a4baa51673f3c2f5d0
2011-06-03 19:49:00 -07:00
Svetoslav Ganov
f9886f3ee9 AccessiblityManagerService not cleaning up dead binders.
1. AccessibilityManagerService was keeping handles to dead
   IAccessibilitymanagerClients - now doing so.

2. AccessibilityManagerService was lazily cleaning up dead
   IAccessibilityServiceConnections - now using a callback.

3. Cleaned up the book keeping of enabled services.

4. Fixed a bug that the input filter is still enabled
   when disabling accessibility.

Change-Id: I5e9af7ab684a3b71e8ee51125b1262a17e960eb0
2011-06-01 20:32:09 -07:00
Svetoslav Ganov
cc4053e031 Accessibility serviceconfiguration via meta-data
Note: This is a part of two CL change and contains the
      system changes without updates to the settings.

1. Added a mechanism for configuring an accessibility service via
   XML file specified in a meta-data tag (similar to IMEs).

2. Added property for specifying a settings activity for an
   accessibility service.

3. Refactored the APIs in AccessibilityManager to return
   lists of AccessiblityServiceInfo instead ServiceInfo
   since the former describes an AccessibilityService in
   particular (similar to IMEs).

Change-Id: Ie8781bb7e0cdb329e583b6702a612a507367ad7b
2011-05-31 12:04:18 -07:00
Svetoslav Ganov
91feae3c59 TouchExplorer - refactoring and a couple of bug fixes
1. Refactored the code to avoid code duplication.

2. Fixed a bug in removing unused pointers from the event.

3. Fixed a bug that was crashing the explorer.

4. Sending hover exit immediately at the end of touch exploration
   gesture rather with a delay.

Change-Id: Ie288cb8090d6fb5e5c715afa6ea5660b17c019e0
2011-05-19 18:29:01 -07:00
Jeff Brown
fe9f8ab03a Add initial API for stylus and mouse buttons.
Added the concept of pointer properties in a MotionEvent.
This is currently used to track the pointer tool type to enable
applications to distinguish finger touches from a stylus.

Button states are also reported to application as part of touch events.

There are no new actions for detecting changes in button states.
The application should instead query the button state from the
MotionEvent and take appropriate action as needed.

A good time to check the button state is on ACTION_DOWN.

As a side-effect, applications that do not support multiple buttons
will treat primary, secondary and tertiary buttons identically
for all touch events.

The back button on the mouse is mapped to KEYCODE_BACK
and the forward button is mapped to KEYCODE_FORWARD.

Added basic plumbing for the secondary mouse button to invoke
the context menu, particularly in lists.

Added clamp and split methods on MotionEvent to take care of
common filtering operations so we don't have them scattered
in multiple places across the framework.

Bug: 4260011
Change-Id: Ie992b4d4e00c8f2e76b961da0a902145b27f6d83
2011-05-13 12:11:17 -07:00
Svetoslav Ganov
a3e261d506 The accessibility input filter state was not unregistered when
no spoken feedback accessibility services are regitstered.

bug:4343996

Change-Id: Ie709ac24baa084cf3627d6adb6caf1550c399f8b
2011-04-27 12:06:28 -07:00
Svetoslav Ganov
736c2756bf Touch exploration feature, event bubling, refactor
1. Added an Input Filter that interprets the touch screen motion
   events to perfrom accessibility exploration. One finger explores.
   Tapping within a given time and distance slop on the last exlopred
   location does click and long press, respectively. Two fingers close
   and in the same diretion drag. Multiple finglers or two fingers in
   different directions or two fingers too far away are delegated to
   the view hierarchy. Non moving fingers "accidentally grabbed the
   device for the scrren" are ignored.

2. Added accessibility events for hover enter, hover exit, touch
   exoloration gesture start, and end. Accessibility hover events
   are fired by the hover pipeline. An accessibility event is
   dispatched up the view tree and the topmost view fires it.
   Thus predecessors can augment the fired event. An accessibility
   event has several records and a predecessor can optionally
   modify, delete, and add such to the event.

3. Added onPopulateAccessibilityEvent and refactored the existing
   accessibility code to use it.

4. Added API for querying the currently enabled accessibility services
   by feedback type.

Change-Id: Iea2258c07ffae9491071825d966dc453b07e5134
2011-04-22 18:30:43 -07:00
Adam Powell
3fb3d7c4e7 Revert "Touch exploration feature, event bubling, refactor"
This reverts commit ac84d3ba81f08036308b17e1ab919e43987a3df5.

There seems to be a problem with this API change. Reverting for now to
fix the build.

Change-Id: Ifa7426b080651b59afbcec2d3ede09a3ec49644c
2011-04-22 17:23:44 -07:00
Svetoslav Ganov
ac84d3ba81 Touch exploration feature, event bubling, refactor
1. Added an Input Filter that interprets the touch screen motion
   events to perfrom accessibility exploration. One finger explores.
   Tapping within a given time and distance slop on the last exlopred
   location does click and long press, respectively. Two fingers close
   and in the same diretion drag. Multiple finglers or two fingers in
   different directions or two fingers too far away are delegated to
   the view hierarchy. Non moving fingers "accidentally grabbed the
   device for the scrren" are ignored.

2. Added accessibility events for hover enter, hover exit, touch
   exoloration gesture start, and end. Accessibility hover events
   are fired by the hover pipeline. An accessibility event is
   dispatched up the view tree and the topmost view fires it.
   Thus predecessors can augment the fired event. An accessibility
   event has several records and a predecessor can optionally
   modify, delete, and add such to the event.

3. Added onPopulateAccessibilityEvent and refactored the existing
   accessibility code to use it.

4. Added API for querying the currently enabled accessibility services
   by feedback type.

Change-Id: Iec03c6c3fe298de3f14cb6efdbb9b198cd531a0c
2011-04-21 18:33:52 -07:00
Joe Onorato
43a17654cf Remove the deprecated things from Config.java. These haven't been working since before 1.0.
Change-Id: Ic2e8fa68797ea9d486f4117f3d82c98233cdab1e
2011-04-07 19:23:05 -07:00
Jeff Brown
0029c66203 Add input filter mechanism for accessibility.
This patch adds a mechanism for capturing, filtering, transforming
and injecting input events at a very low level before the input
dispatcher attempts to deliver them to applications.  At this time,
the mechanism is only intended to be used by the accessibility
system to implement built-in system-level accessibility affordances.

The accessibility input filter is currently just a stub.
It logs the input events receives and reinjects them unchanged,
except that it transforms KEYCODE_Q into KEYCODE_Z.

Currently, the accessibility input filter is installed whenever
accessibility is enabled.  We'll probably want to change that
so it only enables the input filter when a screen reader is
installed and we want touch exploration.

Change-Id: I35764fdf75522b69d09ebd78c9766eb7593c1afe
2011-03-30 16:55:15 -07:00
Jeff Brown
6e6cd7a566 Move accessibility manager service to own package.
Change-Id: I0d73737a21615f0ff0abc80b757fb8c9bcb50be5
2011-03-30 03:29:30 -07:00