• Home
  • History
  • Annotate
  • only in /frameworks/base/services/java/com/android/server/accessibility/
History log of /frameworks/base/services/java/com/android/server/accessibility/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f74d0c39b62ff542542df69e641477eb1e09b157 02-Nov-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Polish user selector accessibility." into jb-mr1-lockscreen-dev
fc9c4cd51b3bdca27726dd6d8a00d47e388ca2aa 02-Nov-2012 Svetoslav Ganov <svetoslavganov@google.com> Polish user selector accessibility.

1. The current user was not announced as such.

2. The event for a user switch was not sent.

Change-Id: Ib3caf1f9e93ea1f0b5450246601bc37f416be6da
ccessibilityManagerService.java
28e8f76c50b26efd657bc0740fee25ac18520f9e 02-Nov-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Cannot click on partially visible views in touch exploration." into jb-mr1-dev
a94c3194ffa896632f025b983ca57095cd4ba277 01-Nov-2012 Svetoslav Ganov <svetoslavganov@google.com> Cannot click on partially visible views in touch exploration.

1. In touch exploration mode the system clicks in the center of the
accessibility focus rectangle. However, if this rectangle is only
partially shown on the window or on the screen the system may not
be able to perform the click, if the accessibility focus center
is not on the screen, or click on the wrong window, if the access
focus center is outside of the window.

This change clips the rectangle to the window bounds which and the
display bounds. This will ensure no clicks are sent to the wrong
window and no clicks are sent outside of the screen.

bug:7453839

Change-Id: I79f98971e7ebcbb391c37284467dc76076172c5f
ccessibilityManagerService.java
c4842c11932ea4f60fe7ae09b0a59660207e1587 31-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Accessibility support for the lockscreen - phone.

Change-Id: Idc99f1322a1d635dd07e1f5efa1665a4676267c2
ouchExplorer.java
7fd9882ba3e97423901e06188c6dbaaca661ecbd 25-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Accessibility layer in inconsistent state after running UI test automation tests.

1. The accessibility layer has a back door for a UI test automation code running
from the shell to attach. The unregister code does an incorrect identity check
and as a result the register UI test automation service is not disconnected
until its process is killed. The fix is super safe and simple.

bug:7409261

Change-Id: I4b1da18be6c5619dadd4a58fca6724529bc59dea
ccessibilityManagerService.java
ff6c329f61ea4f00d9cbbe55387adbc2050f4679 19-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Cannot pan in browser if magnification is enabled.

1. We cache some events to see if the user wants to trigger magnification. If no
magnification is triggered we inject these events with adjusted time and down
time to prevent subsequent transformations being confused by stale events.
After the cached events, which always have a down, are injected we need to also
update the down time of all subsequent non cached events.

bug:7379388

Change-Id: I41d8b831cc1016a0ee8f9c5ef5f42eb60a6f64d9
creenMagnifier.java
444e8aabc12994316315688cc3674a432424adb9 18-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Magnifier not respecting RTL/LTR direction and keyguard dialogs not properly centered.

1. When magnifier, if a dialog that popped up is wider than the scree we pan to its upper
left corner. We now show the upper right corner if the locale direction is RTL.

2. Keyguard dialogs are not centered since they are used as a sign to recompute the
magnified area but an unnecessary else statement prevents such dialogs from being
properly show via a pan.

bug:7374331

Change-Id: I285e46b822a29f0082c502cb642f9da32dabfe6a
creenMagnifier.java
72e351296046d61ecc5863da2faca0ab4ba0fd62 17-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Long press not working if explore by touch and magnification are on.

1. In the magnifier we are caching the touch events until we figure
out whether the user is triple tapping to enable magnification.
If the user is not trying to engage magnification we deliver the
stashed events. However, these events are stale and the subsequent
transformations such as the touch explorer get confused when trying
to detect a tap since the delay is longer than the tap slop.
This change compensates for the time the events were cached
before sending them to the next transformation in the chain.

bug:7362365

Change-Id: Idd8539ffed7ba4892c5a916bd34910fd2ef50f75
creenMagnifier.java
55468c64bc4f3c4b16bf144f66907d75bb656b0a 16-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Occasionally triple tap on the keyboard toggles screen magnification.

1. Sometimes unlocking the device when the IME is up and triple tapping on the keyboard
toggles screen magnification. The core reason is that when the kayguard window is
shown we hide all other windows and when it is hidden we show these windows. We did
not notify the screen magnifier for windows being shown and hidden. Also when the
windows are shown we may reassign layers to put the IME or the wallpaper in the
right Z order. The screen magnifier is now notified upon such layer reassignment
since window layers are used when computing the magnified region.

bug:7351531

Change-Id: I0931f4ba6cfa565d8eb1e3c432268ba1818feea6
creenMagnifier.java
0ea16037c7b6db95b3c23180bd88bdf431bf54a3 11-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Screen magnification does not auto-pan when fragment dialog pops up.

1. We auto pan when certain type of window pop up to make sure the user
knows about the context change. This does not happen however for
fragment dialog since its window type is not in the list of one
we auto pan for. Updating the window type list.

bug:7332090

Change-Id: I9b097c57df929d2e4e807a948c3a0540f4092a76
creenMagnifier.java
ee44fae19664594d4a17dd86723106533f4b218a 04-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Prevent out of range magnification scale to be persisted.

1. If a bad magnification scale is persisted, i.e. it is
not between the min and max, the screen magnifier gets
into a bad state which even a reboot does not fix since
the scale is persisted in settings.

This change ensures that only valid scales are presisted.
In general a bad value should not be attempted to be
persisted but at this point this is the safest change.

bug:7288239

Change-Id: I3e9c7c091772fa64128ab8403c2127ce65cb94b8
creenMagnifier.java
6ae8a24fc045bc7970f2843fa9baf06aff15e22d 10-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> The active window for accessibility purposes can be miscomputed.

1. The active window is the one that the user touches or the one
that has input focus. We recognize the user touching a window
by the received accessibility hover events and the user not
touching the screen by a call from the touch explorer. It is
possible that the user touches window that does not have
input focus and as soon as he lifts finger the active one
will become the window that has input focus but now we get
he hover accessibility events from the touched window which
incorrectly changes the active window to be the touched one.
Note that at this point the user is not touching the screen.

bug:7298484

Change-Id: Ife035a798a6e68133f9220eeeabdfcd35a431b56
ccessibilityManagerService.java
ouchExplorer.java
318b00bfeefa6dc05913c8eea0052d70185c7910 08-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Show the touch explore enable dialog for the current user.

1. We are showing a warning dialog if the user enables an accessibility
service that requests explore by touch. This dialog was shown only
for the owner but should be shown for the current user.

bug:7304437

Change-Id: I692b5112df16405e6d2e4890aafbfde79981f973
ccessibilityManagerService.java
1ad0fd9c04ae2e352c59129b979145e662f25cbc 06-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Accessibility active window not updated on time." into jb-mr1-dev
f81dc4c08b2985ef369134b73e1b383b8284e912 06-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Screen magnification cannot be engaged in landscape on a phone." into jb-mr1-dev
a7bcb546bc4d9492a1e3c994bdc1318db7a3a0c4 06-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Screen magnification cannot be engaged in landscape on a phone.

1. The reason is that the screen magnifier computes that the whole
screen is not magnifiable. The miscalculation was caused due to
an incorrect assumption that the non-magnified area is only at
the bottom. In fact, on a phone in landscape the non-magnified
area is both on the right and at the bottom. This change adds
a correct algorithm for computing the magnified region.

2. Increasing the delay for computing the magnified area when the
keyguard goes away to allow all windows hidden by the keyguard
to be shown. In rare occasions the previous delay was not long
enough resulting in a state where the keyboard is considered
a part of the magnified region.

3. Removed some dead code.

bug:7293097

Change-Id: Ic5ff91977df8bcf4afd77071685c3eb20555d4f3
creenMagnifier.java
f772cba59760d1ad9eb5cb9205b2e2e9126e488d 06-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Accessibility active window not updated on time.

1. The active window is the one the user is touching or the one
that has input focus. It has to be made current immediately
after the user has stopped touching the screen because if the
user types with the IME he should get a feedback for the
letter typed in the text view which is in the input focused
window. Note that we always deliver hover accessibility events
(they are a result of user touching the screen) so change of
the active window before all hover accessibility events from
the touched window are delivered is fine.

bug:7296890

Change-Id: I1ae87c8419e2f19bd8eb68de084c7117c66894bc
ccessibilityManagerService.java
ouchExplorer.java
88400d3a31139c40c4014faf86c243647087ef6c 30-Sep-2012 Craig Mautner <cmautner@google.com> Add flag for displaying non-user's Windows to user.

Created a new flag that indicates that a window should be shown
to all users. For the flag to be valid the owner of the window
must have system permissions.

Also separated system window types into those that show to all
users (e.g. StatusBar, Keyguard, ....) and those that appear only
to the owning users (e.g. Drag, ANR, TOAST, ...). Those that appear
only to their owner can override their default behavior using
the new flag (e.g. LowBattery).

Fixes bug 7211965.

Change-Id: I1fdca25d57b7b523f0c7f8bceb819af656c388d4
creenMagnifier.java
d367b70c4ad5d8e6cdbcc0d6d429428413cd39b3 04-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Accessibility HOVER_ENTER / EXIT without enclosing EXPLORATION_GESTURE_START / END" into jb-mr1-dev
f068fed6c4c3fc2003aec19b6e7e892358179b02 04-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Accessibility HOVER_ENTER / EXIT without enclosing EXPLORATION_GESTURE_START / END

1. The initial implementation was not sending the gesture start and end
events until the the user has moved more than a given slop and did not
do it faster than a given velocity. However, there is the case where
if the user did not move or just taped on the screen an exploration
occurs. The system was not sending the exploration start and end
events for the latter case.

2. The delaued command for long press was not canceled when the pointer
moves more than the slop distance.

bug:7282811

Change-Id: I7d98470cd4d9ea9b2519326e5e550ff68b040747
ouchExplorer.java
a6cab32d68692f69729195ac69b7f9e9c8d2001f 04-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Events for window's content change should be dispatched only for the active window." into jb-mr1-dev
58fd9f8d6ad6bf1975e834f1a69e68673db9a452 04-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Events for window's content change should be dispatched only for the active window.

1. Accessibility events for changes in the content of a given window, such as
click, focus, etc. are dispatched to clients only if they come from the
active window.

Events for changes in the state of a window, such as window got input focus
or a notification appeared, are always dispatched. The notification events
do not contain source, so a client cannot introspect the notification area
(unless the user explicitly touches it which generates hove events). The
events for a window getting input focus change the active window so they
have to be dispatched.

Events that are a result of the user touching the screen, such as hover
enter, first tocuh, etc. should always be dispatched.

bug:7282006

Change-Id: I96b79189f8571285175d9660a22394cc84f39559
ccessibilityManagerService.java
ec33d56300aa417efb4a055786d73d1bf23a6a85 04-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Exception in the touch explorer when dragging.

1. During a drag in touch exploration we have two pointers moving in the same
direction but inject only one of them. If the dragging pointer goes up we
send an up to the view system and wait for all pointers to go up to transition
to touch exploring state. At this point the dragging pointer id is cleared
and if a new pointer goes down we are trying to send up (rather do nothing)
for the dragging pointer which we already did and due to the invalid pointer
id we get an exception when splitting the motion event.

bug:7282053

Change-Id: I690bf8bdf6e2e5851ee46a322c4a1bb7d484b53a
ouchExplorer.java
9bfb8bcfeb585c1692830ff91a36afa852455cf7 03-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Up motion event not injected by the touch explorer at the end of a drag." into jb-mr1-dev
aeb8d0ed0d98d398a66a092c418f4f2bca8719e0 02-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Up motion event not injected by the touch explorer at the end of a drag.

1. The up event was not injected when the last pointer went up, i.e.
at the end of the drag. This patch sends an up event if the dragging
pointer goes up for both cases, when the dragging pointer goes up
first and when it goes up second.

bug:7272830

Change-Id: I708a2b93ee2d0a4c46dbeea002841666e919602d
ouchExplorer.java
6e2bee75cea415621165698fdd9ce857bbb8872e 01-Oct-2012 Jeff Sharkey <jsharkey@android.com> Migrate more System and Secure settings to Global.

Includes telephony, WindowManager, PackageManager, and debugging
settings. Update API to point towards moved values.

Bug: 7231764, 7231252, 7231156
Change-Id: I5828747205708872f19f83a5bc821ed0a801cb79
creenMagnifier.java
0944d625448209185452eb4e800daec49de51986 02-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Touch explorer and magnifier do not work well together." into jb-mr1-dev
45af84a483165f06c04d74baba67f90da29c6ad2 02-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Touch explorer and magnifier do not work well together.

1. If tocuh exploration and screen magnification are enabled and the screen
is currently magnified, gesture detection does not work well. The reason
is because we are transforming the events if the screen is magnified before
passing them to the touch explorer to compensate for the magnification so
the user can poke what he thinks he pokes. However, when doing gesture
detection/velocity computing this compensating shrinks the gestured shape/
decreases velocity leading to poor gesture reco/incorrect velocity.

This change adds a onRawMotionEvent method in the event transformation chain
which will process the raw touch events. In this method of the touch explorer
we are passing events to the gesture recognized and the velocity tracker.

2. Velocity tracker was not cleared on transitions out of touch exploring state
which is the only one that uses velocity.

bug:7266617

Change-Id: I7887fe5f3c3bb6cfa203b7866a145c7341098a02
ccessibilityInputFilter.java
ventStreamTransformation.java
creenMagnifier.java
ouchExplorer.java
59f07690c2bdd97b9e486b776d2175d914818d06 02-Oct-2012 Svetoslav Ganov <svetoslavganov@google.com> Owner should not be announces as a user switch.

1. The accessibility layer announces user switches. Even though
the initial switch to the owner on a singe user device is a
valid use switch we should not announce it for accessibility.

bug:7264693

Change-Id: Idf022fab6b74c84b7a96bc4ed7c7fee2b83029a6
ccessibilityManagerService.java
9ea8f390dbe8123415b9d64ce1a31683012958d9 29-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Explore by touch enabled when screen magnification is on.

1. A recently added check was preventing touch exploration being
disabled when the last touch exploring service was turned off.
As a consequence enabling explore by touch was initializing the
input filter with the magnification and the not disabled
screen magnification features.
bug:7256223

Change-Id: I9ed5457705d625805462e4d316b2c8a5af9aabca
ccessibilityManagerService.java
46824214bbe75d7e7e50cb15e3293c703d597a5f 29-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Sending interaction end event at the end of a drag.

1. In explore-by-touch when the user slides two fingers in the same
direction we consider it a drag gesture. We merge the pointers into
one and deliver a touch event. When one of the pointers goes up
we were transitioning into touch exploring state. This means that
were transitioning to another state in the middle of a gesture which
creates complications and leads for interaction end event not being
sent.

This change transitions out of dragging state when all pointers go up
- simple and all events are properly sent. Consequentially, staring a
drag the user has to lift all pointers to touch explore. Since usually
users either drags or touch explores this seems the simplest and
*least risky* fix.

bug:7253731

Change-Id: Ie8588fbe9b26cb81312bd7fd377c94732e41e3f8
ouchExplorer.java
fe304b893968887323b93764caafa66ee8ad44de 28-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Some accessibility events not sent from touch explorer if apps misbehave.

1. The touch explorer is relying on the hover exit accessibility event to be sent
from the app's view tree before sending the exploration end and last touch
accessibility events. However, if the app is buggy and does not send the hover
exit event, then the interaction ending events are never sent. Now there is a
timeout in which we wait for the hover exit accessibility event before sending
the gesture end and last touch accessibility events. Hence, we are making a
best effort to have a consistent event stream.

2. Sneaking in the new nine patch for the border around the magnified region
since the current one is engineering art.

bug:7233616

Change-Id: Ie64f23659c25ab914565d50537b9a82bdc6a44a0
ouchExplorer.java
95841ac3c2d45a839cc3cd0bd420fd9d91ccd583 28-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Inconsistent events on transition from gesture detection to touch exploration." into jb-mr1-dev
ca8688207b68612419213cc8f3afd7abeb03a181 28-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Accessibility services that do not accept events are mismanaged." into jb-mr1-dev
0dc2b81ce1400ae23faa5cc386caeef235856307 28-Sep-2012 Daniel Sandler <dsandler@android.com> Merge "Cleanup internal status bar APIs." into jb-mr1-dev
aed4b6f812674bc60a04470013ca449e5c114fa5 28-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Inconsistent events on transition from gesture detection to touch exploration.

1. The problem is that we have a gesture detection timeout after which we transition
to touch exploration state. This handles the case where the user is using too high
velocity while trying to touch explore. The delayed command that transitions from
gesture detection state to touch exploration state was not firing an event for the
end of gesture detection and begin of touch exploration before doing its main work
to transition to touch exploring state.

bug:7233819

Change-Id: I5c4855231aa3826dadbee324e74a3c9e52c96cd9
ouchExplorer.java
1f22b6a25d7df6c5488d9bd01793e7a20d921349 28-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Accessibility services that do not accept events are mismanaged.

1. If an accessibility service does not specify that it handles any
event types it was never added to the list of services while
the system is bound to it. Since the service is not in the list
with enabled services we never unbind it, hence it consumes
resources without doing nothing. This is also semantically
incorrect because a sevice may not want to receive events while
handling only gestures.

bug:5648345

Change-Id: Id478a4704cdeeb1729330f6ae4b8ff9e06320952
ccessibilityManagerService.java
7befb7deb2ac15134b3bb190520cba19165d16dd 28-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Global gesture to toggle Accessibility system-wide.

1. This change adds a global gesture for enabling accessibility.
To enable this gesture the user has to allow it from the
accessibility settings or use the setup wizard to enable
accessibility. When the global gesture is enabled the user
can long press on power to bring the global actions dialog
and then hold with two fingers for a few seconds to enable
accessibility. The appropriate feedback is also provided.

2. The global gesture is writing directly into the settings for
the current user if performed when the keyguard is not on. If
the keygaurd is on and the current user has no accessibility
enabled, the gesture will temporary enable accessibility
for the current user, i.e. no settings are changed, to allow
the blind user to log into his account. As soon as a user
switch happens the new user settings are inherited. If no
user change happens after temporary enabling accessibility
the temporary changes will be undone when the keyguard goes
away and the device will works as expected by the current user.

bug:6171929

3. The initialization code for the owner was not executed due
to a redundant check, thus putting the accessibility layer in
an inconsistent state which breaks pretty much everything.

bug:7240414

Change-Id: Ie7d7aba80f5867b7f88d5893b848b53fb02a7537
ccessibilityManagerService.java
11cf178100e71d3f9f34ab5865e03a277c5eadaa 27-Sep-2012 Daniel Sandler <dsandler@android.com> Cleanup internal status bar APIs.

IStatusBarService.collapseQuickSettings is gone;
collapseNotifications is now collapsePanels, which does what
collapse() used to do. Similarly,
IStatusBar.animateCollapseQuickSettings is now simply
IStatusBar.animateCollapse().

Bug: 7245229
Change-Id: Id157d2fdf34926d3c85ffa8b81c741a5359aede4
ccessibilityManagerService.java
c91fb5875bfd7f91d50d6fe939873872b53c8b2f 26-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Adding a global accessibility action to open quick settings." into jb-mr1-dev
e20a177d3f147f3011647c3bdab401f90b2c5d1d 26-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding a global accessibility action to open quick settings.

1. Added APIs for opening the quick settings to the StatusBarManagerService
and the local StatausBarManager. The new APIs are protected by the old
EXPAND_STATUS_BAR permission.
Renamed the expand* and collapse* non-public APIs that are expanding
the notifications to expandNotifications* collapseNotifications* to
better convey what they do given that this change adds
expandQuickSettings* and collapseQuickSettings*.
Added a global action to the accessibility layer to expand the quick
settings which is calling into the new status bar manager APIs.

bug:7030487

Change-Id: Ic7b46e1a132f1c0d71355f18e7c5a9a2424171c3
ccessibilityManagerService.java
1c9766e32a630c72db400a769430e60549062577 25-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "The active window for accessibilitiy incorrectly tracked." into jb-mr1-dev
a8afa694d6881266ad762aacdac92b2047f9a86c 25-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Regression in screen introspection APIs due to the multi-user change.

1. The initial user was set to USER_NULL but some clients were registering
before the user change callback happens. Since the initial user is
the owner the current user id defaults to USER_OWNER.

2. The check for global clients and window connections was using the
calling UID but there are processes that run in a per user basis
as system UID (Setting for example). Now the check is stronger
and comparing the caller PID with that of the system process.

3. The code for finding the focused window id was not checking the
global window token list in addition to that of the current user.

4. The code updating the active window id was calling out into the
window manager with a lock held.

bug:7224670

Change-Id: I9f4b7ea67eb5598b30ee7d1b68a1d3ce0cf8cfb4
ccessibilityManagerService.java
fe3632bcbea6aabe0e363c00097767465a1d7797 25-Sep-2012 Jean-Baptiste Queru <jbq@google.com> Merge into jb-mr1-dev

Change-Id: Ib0523ded92e2fe4be6a32d092baa55b527229c07
56d8cc103150eecad8911754735abec3a7ce9691 25-Sep-2012 Jean-Baptiste Queru <jbq@google.com> Merge into jb-mr1-dev

Change-Id: I6504b000be7e3b6e770af99c5a922fd1e9ec73de
76c0dd48279531cb31e2a284a270c535664cbf81 25-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> The active window for accessibilitiy incorrectly tracked.

1. The active window for accessibility purposes is the either the
window the user is touching or the window that has input focus. We
were using the touch exploration gesture end event to figure
when the user stops touching the screen so we can set the active
window to the input focused one. However, we do not send such
gesture end if the user does not touch explore. If the user only
taps we do not consider this touch exploring. We now have dedicated
accessibility events for first and last touch and this change uses
them as a guide when to update the active window.

bug:6523219

Change-Id: I6262c0c5f408b02dbaa127664e4b426935d7f81f
ccessibilityManagerService.java
ouchExplorer.java
03e7b8881599da69207a93a2bcbbe5050efb6633 25-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> More than one finger at a time can trigger a system crash.

1. The crash was happening if: two active pointers are performing a drag;
there are some inactive pointers down; the main dragging pointer (we are
merging the dragging pointers into one) goes up; now an inactive pointer
goes up and the explorer tries to inject up for the dragging pointer
which is no longer in the event resulting in a crash. Basically two
problems: inactive pointers were not ignored; 2) having only one
active pointer should not only send the up event but also transition
the explorer in touch exploring state.

bug:6874128

Change-Id: I341fc360ebc074fe3919d5ba3b98ee5cb08dd71e
ouchExplorer.java
187f3f94901001792328b40366b434135e3f1dde 25-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Magnified frame not properly computed when keyguard goes away.

1. The keyguard force hides some windows when it is shown and as soon
as the keyguard goes away there windows are made visible. However,
the window transition that the keyguard is moving away is reported
before the force hidden windows are shown which makes the screen
magnifier compute the magnified region with an incomplete list of
windows of interest.

bug:7215285

Change-Id: I3abc4d97b7a74de8183ad20477dadf66c82da037
creenMagnifier.java
657968a65f29e9319c39b833fefc2ae7472c3e53 22-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> UI test automation service should not be auto reconnected.

1. Since adb is restarted on user switch it makes no sense to
try to reconnect the ui automation service since it will
be killed on a user switch.

Disabling touch exploration on UI automation service
connect since it can explicitly put the device in this
state if needed.

bug:6967373

Change-Id: I8cfde74f28f3f03d4ccf24746d43b8178ae2b5ef
ccessibilityManagerService.java
9371a0a0c0cdf9be0e0a32e4c3037cc2e216cfa0 22-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Fixing a regression in the UI test automation.

bug:6967373

Change-Id: I28f01a2bfe44febcb1a519028dab82fb1da9753e
ccessibilityManagerService.java
58d37b55bd228032355360ea3303e46a804e0516 18-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Multi-user support for the accessibility layer.

1. This change converts the accessibility manager service to
maintain a state per user. When the user changes the services
for the user that is going away are disconnected, the local
accessibility managers in the processes for this user are
disabled, the state is swapped with the new user's one, and
the new user state is refreshed.

This change updates all calls into the system to use their
user specific versions when applicable. For example, regisetring
content observers, package monitors, calls into other system
services, etc.

There are some components that are shared across users such
as UI created by the system process and the SystemUI package.
Such components are managed as a global state shared across
all users and are updated accordingly on a user switch. Since
the SystemUI is running in a normal app process this change
adds hidden APIs on the local window manager to allow the
SystemUI to notify the accessibility layer that it will run
accross users.

Calls to AccessibiltyManager's isEnabled(), isTouchExplorationEnabled()
and sendAccessibilityEvent return false or a are a nop for a
background user sice he should not send accessibility events,
and should not perform touch exploration.

Update the internal accessibility tests due to changes in the
AccessibilityManager.

This change also fixes several issues that were encountered
such as calling out the accessibility manager service with a
lock held.

Removed some incorrect debugging code from the TouchExplorer
that was leading to a system crash.

bug:6967373

Change-Id: I2cf32ffdee1d827a8197ae4ce717dc0ff798b259
ccessibilityManagerService.java
ouchExplorer.java
8b681cb8813454aac8a626bf3d7adaa8beca4d75 15-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Some formatting missed in the previous patch

Change-Id: I299090ca67b1d90cf75a46dc85b13970d32511e5
ouchExplorer.java
77276b60851a158ad3e142cb3b091d57ae5ceffb 14-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding accessibility events for touch and gesture detection states.

1. Currently the system fires accessibility events to announce the
start and end of a touch exploration gesture. However, such a
gesture starts after we have decided that the user is not
performing a gesture which is achieved by measuring speed of
movement during a threshold distance. This allows an accessibility
service to provide some feedback to the user so he knows that
he is touch exploring.

This change adds event types for the first and last touches
of the user. Note that the first touch does not conincide with
the start of a touch exploration gesture since we need a time
or distance to pass before we know whether the user explores
or gestures. However, it is very useful for an accessibility
service to know when the user starts to interact with the
touch screen so it can turn the speech off, to name one
compelling use case.

This change also provides event types for the start and end
of gesture detection. If the user has moved over the threshold
with a speed greater than X, then the system detects gestures.
It is useful for an accessibility service to know the begin
and end of gesture detection so it can provide given feedback
type for such a gesture, say it may produce haptic feedback
or sound that differs for the one for touch exploration.

The main benefit of announcing these new events is that an
accessibility service can provide feedback for each touch
state allowing the user to always know what he is doing.

bug:7166935

Change-Id: I26270d774cc059cb921d6a4254bc0aab0530c1dd
ccessibilityManagerService.java
ouchExplorer.java
19f4a29fa44008703738fd5217366365f14f2649 13-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Enforcing BIND_ACCESSIBILITY_SERVICE for connecting to an accessibility service.

1. This change enforces an accessibility service to require the system
defined BIND_ACCESSIBILITY_SERVICE permission.

bug:6507771

Change-Id: If5e16bb4fa97891be0ccbb35e343773712e33b98
ccessibilityManagerService.java
3e1476a697ad94e638867361a6caba0ede77cb33 12-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding a scaling threshold in ScreenMagnifier

Change-Id: I1fdd7c93de571a61d88d7386c5c2a423a6b83fb9
creenMagnifier.java
d420e3ac94afea65173fd0ae43e13dfa6948bff9 12-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Refactoring the scale and pan detection in the ScreenMagnifier.

Change-Id: I8560f53f88ef0c9244e2b48d40119574cacb544f
creenMagnifier.java
9b4125e435b6bc8f8bd2f6e569d9b0b296ab16ef 12-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Screen magnifier should handle window rebuilds correctly.

1. The way for computing the magnified region was simplistic and
incorrect. It was ignoring window layering resulting in broken
behavior. For example, if the IME is up, then the everything else
is magnifed and the IME not. Now the keyguard appears and covers
the IME but the magnified region does not expand while it would
since the keyguard completely covers the not magnified IME window.

bug:7138937

Change-Id: I21414635aefab700ce75d40f3e913c1472cba202
creenMagnifier.java
36e614c110dad174dea6017eb701f55339aee200 11-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Screen magnification should disengage on screen off.

1. When the screen goes off the user will be in a completely
different context upon turning the screen on. Therefore,
if magnification auto update is enabled magnification
will be disengaged on screen off.

bug:7139088

Change-Id: I790cfa5b3cf31d34e95fc9548e6246a84096c37b
creenMagnifier.java
86fe9e14f1a816df32b08e0eb677989cc7444948 11-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Reducing the click delay while screen magnification is enabled.

1. If screen magnification is enabled the user has to triple tap
and lift or triple tap and hold to engage magnification. Hence,
we delay the touch events until we are sure that it is no longer
possible for the user to perform a multi-tap to engage
magnification. While such a delay is unavoidable it feels a
bit longer than it should be. This change reduces the delay
between taps to be considered a multi-tap, essentially making
the click delay shorter.

bug:7139918

Change-Id: I2100945171fff99600766193f0effdaef1f1db8f
creenMagnifier.java
662538957f12a7b7c534382a6a4f306d5777375b 11-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Scaling in viewport moving state locks into a magnified state.

1. If the user changes the magnification level while moving the
viewport the magnification is locked. The gesture handle has
to put device back into a viewport moving state if this was
the last state.

bug:7139363

Change-Id: I24992b973bb15624580114353b004efdb35c2faa
creenMagnifier.java
6d04712d15e4fe9b44b0d9accf073f5a7f1d334a 11-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Allow simultaneous scale and pan in magnified state.

1. Before in magnified state the user was able to only scale or
pan. Based on user input this change allows performing pan
or scale or both. If the user scales more than a threshold
we are performing a scale and independently of that if the
use pans more than a threshold we are performing a pan.

bug:7138928

Change-Id: Ic1511500ba3369091dcfd070669d3e4f0286fbe5
creenMagnifier.java
0c381504a8fce293b3b9ef8ad0333849c43eb6a4 10-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Improve scaling vs pan in screen magnifier.

1. Due to frequent changes of the behavior of ScaleGestureDetector
this patch rolls in a gesture detector used for changing the
screen magnification level. It has an improved algorithm which
uses the diameter of min circle around the points as the span, the
center of this circle as the focal point, and the average slop
of the lines from each pointer to the center to determine the
angle of the diameter used when computing the span x and y.

Change-Id: I5cee8dba84032a0702016b8f9632f78139024bbe
creenMagnifier.java
add52a975aa78d9e24d3e63a8168c00a9bfb80ec 09-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Viewport should zoom out when screen magnification is disabled.

1. If screen magnification is disabled when the screen is in a
magnified state we have to zoom out since otherwise the user
is stuck in a magnified state without ability to pan/zoom/
toggle magnification which renders the device useless.

bug:7131030

Change-Id: I8f3339f31310448ec8742f3101c1fdc61a6a5f83
creenMagnifier.java
5b1720e11d3d5a23c4b0406e1c51e8cd8275f25f 09-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Viewport should zoom out when screen magnification is disabled." into jb-mr1-dev
6d0df874ce235872bd5fdd4d3bce0905869a099d 09-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Viewport should zoom out when screen magnification is disabled.

1. If screen magnification is disabled when the screen is in a
magnified state we have to zoom out since otherwise the user
is stuck in a magnified state without ability to pan/zoom/
toggle magnification which renders the device useless.

bug:7131030

Change-Id: Ia620954fbd594e7cd470e43b89d9ed04c0397c3c
creenMagnifier.java
2cee686498c6141f5a68532ecb79f598e043ec7e 08-Sep-2012 Svetoslav Ganov <svetoslavganov@google.com> Fixing off by one error in the ScreenMagnifier.

Change-Id: Ia0ccfb6b354b7a18633e7cf26647c6436ebf5c08
creenMagnifier.java
1cf70bbf96930662cab0e699d70b62865766ff52 06-Aug-2012 Svetoslav Ganov <svetoslavganov@google.com> Screen magnification - feature - framework.

This change is the initial check in of the screen magnification
feature. This feature enables magnification of the screen via
global gestures (assuming it has been enabled from settings)
to allow a low vision user to efficiently use an Android device.

Interaction model:

1. Triple tap toggles permanent screen magnification which is magnifying
the area around the location of the triple tap. One can think of the
location of the triple tap as the center of the magnified viewport.
For example, a triple tap when not magnified would magnify the screen
and leave it in a magnified state. A triple tapping when magnified would
clear magnification and leave the screen in a not magnified state.

2. Triple tap and hold would magnify the screen if not magnified and enable
viewport dragging mode until the finger goes up. One can think of this
mode as a way to move the magnified viewport since the area around the
moving finger will be magnified to fit the screen. For example, if the
screen was not magnified and the user triple taps and holds the screen
would magnify and the viewport will follow the user's finger. When the
finger goes up the screen will clear zoom out. If the same user interaction
is performed when the screen is magnified, the viewport movement will
be the same but when the finger goes up the screen will stay magnified.
In other words, the initial magnified state is sticky.

3. Pinching with any number of additional fingers when viewport dragging
is enabled, i.e. the user triple tapped and holds, would adjust the
magnification scale which will become the current default magnification
scale. The next time the user magnifies the same magnification scale
would be used.

4. When in a permanent magnified state the user can use two or more fingers
to pan the viewport. Note that in this mode the content is panned as
opposed to the viewport dragging mode in which the viewport is moved.

5. When in a permanent magnified state the user can use three or more
fingers to change the magnification scale which will become the current
default magnification scale. The next time the user magnifies the same
magnification scale would be used.

6. The magnification scale will be persisted in settings and in the cloud.

Note: Since two fingers are used to pan the content in a permanently magnified
state no other two finger gestures in touch exploration or applications
will work unless the uses zooms out to normal state where all gestures
works as expected. This is an intentional tradeoff to allow efficient
panning since in a permanently magnified state this would be the dominant
action to be performed.

Design:

1. The window manager exposes APIs for setting accessibility transformation
which is a scale and offsets for X and Y axis. The window manager queries
the window policy for which windows will not be magnified. For example,
the IME windows and the navigation bar are not magnified including windows
that are attached to them.

2. The accessibility features such a screen magnification and touch
exploration are now impemented as a sequence of transformations on the
event stream. The accessibility manager service may request each
of these features or both. The behavior of the features is not changed
based on the fact that another one is enabled.

3. The screen magnifier keeps a viewport of the content that is magnified
which is surrounded by a glow in a magnified state. Interactions outside
of the viewport are delegated directly to the application without
interpretation. For example, a triple tap on the letter 'a' of the IME
would type three letters instead of toggling magnified state. The viewport
is updated on screen rotation and on window transitions. For example,
when the IME pops up the viewport shrinks.

4. The glow around the viewport is implemented as a special type of window
that does not take input focus, cannot be touched, is laid out in the
screen coordiates with width and height matching these of the screen.
When the magnified region changes the root view of the window draws the
hightlight but the size of the window does not change - unless a rotation
happens. All changes in the viewport size or showing or hiding it are
animated.

5. The viewport is encapsulated in a class that knows how to show,
hide, and resize the viewport - potentially animating that.
This class uses the new animation framework for animations.

6. The magnification is handled by a magnification controller that
keeps track of the current trnasformation to be applied to the screen
content and the desired such. If these two are not the same it is
responsibility of the magnification controller to reconcile them by
potentially animating the transition from one to the other.

7. A dipslay content observer wathces for winodw transitions, screen
rotations, and when a rectange on the screen has been reqeusted. This
class is responsible for handling interesting state changes such
as changing the viewport bounds on IME pop up or screen rotation,
panning the content to make a requested rectangle visible on the
screen, etc.

8. To implement viewport updates the window manger was updated with APIs
to watch for window transitions and when a rectangle has been requested
on the screen. These APIs are protected by a signature level permission.
Also a parcelable and poolable window info class has been added with
APIs for getting the window info given the window token. This enables
getting some useful information about a window. There APIs are also
signature protected.

bug:6795382

Change-Id: Iec93da8bf6376beebbd4f5167ab7723dc7d9bd00
ccessibilityInputFilter.java
ccessibilityManagerService.java
ventStreamTransformation.java
estureUtils.java
creenMagnifier.java
ouchExplorer.java
c9c9a48e7bafae63cb35a9aa69255e80aba83988 16-Jul-2012 Svetoslav Ganov <svetoslavganov@google.com> Removing a workaround for incorrect window position on window move.

1. The window manager was not notifying a window when the latter
has been moved. This was causing incorrect coordinates of the
nodes reported to accessibility services. To workaround that
we have carried the correct window location when making a
call from the accessibility layer into a window. Now the
window manager notifies the window when it is moved and the
workaround is no longer needed. This change takes it out.

2. The left and right in the attach info were not updated properly
after a report that the window has moved.

3. The accessibility manager service was calling directly methods
on the window manager service without going through the interface
of the latter. This leads to unnecessary coupling and in the
long rung increases system complexity and reduces maintability.

bug:6623031

Change-Id: Iacb734b1bf337a47fad02c827ece45bb2f53a79d
ccessibilityInputFilter.java
ccessibilityManagerService.java
ouchExplorer.java
a43ef3d1c553007b3fa158fe1d3ec4ddb99a71af 12-Jul-2012 Svetoslav Ganov <svetoslavganov@google.com> Gestures don't work when turning on Explore by Touch pragmatically.

1. There was a misspelled duplicate member in the accessibility service
class which was causing inconsistent behavior because one field was
updated and another checked.

2. When the set of services that can put the device in explore by touch
mode changes we were disconnecting and reconnecting all services
and this is not correct. Now only the state of explore by touch is
updated appropriately.

bug:6798860

Change-Id: Ib3c119cef8e71c3458d56e4ce6fbde2c2f750dcd
ccessibilityManagerService.java
ea6fbc0981564f7bbf4c6fbb63af0175415121ce 20-Jun-2012 Casey Burkhardt <caseyburkhardt@google.com> Fixing gesture recognition configuration in TouchExplorer.

This fix adjusts the sensitivity of the gesture recognizer by
eliminating gesture rotation in the recognition process.

Bug:6697119
Change-Id: Ic767f513c05210b27e583338c4f0adcaa1c4c625
ouchExplorer.java
5d043ce8cc2f588fdfb336cc843fb3b07b196f83 14-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Active window not updated window not updated properly.

1. Accessibility allows querying only of the active window.
The active window is the one that has input focus or the
one the user is touching. Hence, if the user is touching
a window that does not have input focus this window is
the active one and as soon as the user stops touching
it the active window becomes the one that has input
focus. Currently the active window is not updated properly
when the user lifts his finger. This leads to a scenario
of traversal actions sent to the wrong window and the user
being stuck.

The reason is that the last touch explored event that is
used to determine where to click is cleared when accessibility
focus moves but this event is also used to determine when to
send the hover exit and touch exploration gesture end events.
The problem is that the last hover event is cleared before
it is used for sending the right exit events, thus the event
stream is inconsistent and the accessibility manager service
relies on this stream to update the active window. Now we
are keeping separate copies of the last touch event - one
for clicking and one for determining the which events to
inject to ensure consistent stream.

bug:6666041

Change-Id: Ie9961e562a42ef8a9463afacfff2246adcb66303
ouchExplorer.java
95068e5d1bea47091e97955f271c789264994550 14-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> If a gesture cannot be detected the device should transition to touch exploration state.

1. We are deciding whether the user is performing a gesture or an exploration based
on the gesture velocity. If we are detecting gesture we do the recognition at the
gesture end which is when the finger goes up. This is better than having a mode
toggle gesture for exploring and gestures detection. However, it is possible that
the user really wanted to perform an exploration but was moving too fast and
unless he lifts his finger the device is in gesture detection mode. This is
frustrating since the user has no feedback and assumes exploration does not
work.

We want to perform gesture detection only for a maximal time frame and if the
user did not lift his finger we transition into touch exploration state.

bug:6663173

Change-Id: I954ff937cca902e31b51325d1e1dfce84d239624
ouchExplorer.java
b7726159e3ee29b45381ede8446c1e87fbbaa23a 10-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Crash in the touch explorer." into jb-dev
e45c0b230ba92d7daf8bf625a59bd87d5948101b 09-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Crash in the touch explorer.

1. The touch explorer was notified for accessibility events from
a binder thread which was poking the internal state of the
latter which by design is not tread safe. Since the touch
explorer is expected to be running only on the main thread
the accessibility manager service delivers the accessibility
events to the explorer on that thread.

bug:6635496

Change-Id: Ifdc5329e4be8e485d7f77f0fb472184494fa0d15
ccessibilityManagerService.java
ee33ad24cdc31ed0d7f99e110e041b0a63c9b0f1 09-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Settings crash after enabling TalkBack accessibility.

1. AccessibilityInput filter was not checking whether the touch
explorer instance is not null before passing it an accessibility
event. If the accessibility event is dispatched before the input
filter is installed but after it is created we runt into this
case.

2. Added a missing null check in accessibility node info.

bug:6635089

Change-Id: Ia389dc1f427427eb73794f6331ccb870e0b44c55
ccessibilityInputFilter.java
385d9f24b5ce2acb86c0dc192ce702718ab01c39 08-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Cannot click on the last touch explored auto-completion item.

1. When typing into an auto completion edit field a list of completions pops up and if
the user touch explores the list and tries to double tap to select the touched
completion the latter is not selected.

The auto completion is a popup that does not take input focus and is overlaid on
top of the window that has input focus. The touch explorer was clicking on the
location of the accessibility focus if the last touch explored location is within
the bounds of the active window. In this case this was the window with the edit
text into which the user is typing. The check performed by the touch explorer
was missing the case when the last touch explored location was within the bounds
of the active window but it actually was deloverd to another overlaid window.
Now we are poking on the accessibility focus location if the last explored
location is within the active window and was delivered to it.

bug:6629535

Change-Id: Ie66d5bb81ab021f2bb0414339b7de26d96826191
ccessibilityManagerService.java
ouchExplorer.java
86783474fdec98a22bc22e224462767eab13e273 07-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Cannot interact with dialogs when IME is up and on not touch explored popups.

1. If the last touch explored location is within the active window we
used to click on exact location if it is within the accessibility
focus otherwise in the accessibility focus center. If the last touch
explored location is not within the active window we used to just
click there. This breaks in the case were one has touch explored
at a given place in the current window and now a dialog opens *not*
covering the touch explored location. If one uses swipes to move
accessibility focus i.e. to traverse the dialog without touching
it one cannot activate anything because the touch explorer is using
the last touch explored location that is outside of the active
window e.g the dialog.

The solution is to clear the last touch explored location when a
window opens or accessibility focus moves. If the last touch
explored location is null we are clicking in the accessibility
focus location.

bug:6620911

2. There is a bug in the window manager that does not notify a
window that its location has changed (bug:6623031). This breaks
accessibility interaction with dialogs that have input because
when the IME is up the dialog is moved but not notified. Now
the accessibility layer gets incorrect location for the
accessibility focus and the window bounds.

The soluion is when the accessibility manager service calls
into the remove thress to obtain some accessibility node infos
it passes the window left and top which it gets from the
window manager. These values are used to update the attach info
window left and top so all accessibility node infos emitted
from that window had correct bounds in screen coordinates.

bug:6620796

Change-Id: I18914f2095c55cfc826acf5277bd94b776bda0c8
ccessibilityInputFilter.java
ccessibilityManagerService.java
ouchExplorer.java
e47957a0bbe2164467ff6e7a566b0c9e4689cdc9 05-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Nodes with contentDescription should always be important for accessibility.

1. Now after setting the content description on a view we mark is as
important for accessibility of the current important for accessibility
mode of that view is auto.

2. Minor tweak to a touch explorer coefficient to make performing double
tapping easier.

bug:6615353

Change-Id: I3b477f533a3ebde85d425caf32ace5e851240f88
ouchExplorer.java
ccf97dc1afc1b0f99ced0b5324e383edd5ee8246 05-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Global accessibility action to open recent apps shows the old dialog style." into jb-dev
c682fc965df2518a95d23e39ec51d788100d20ec 04-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Global accessibility action to open recent apps shows the old dialog style.

1. The global action to open recent apps shows the old dialog style rent apps
panel. Apparently the key code to open recent apps is not opening the new
UI so the AccessibilityManagerService is calling directly the method on
the IStatusBarSerivce to do so.

bug:6607664

Change-Id: I94c1963b07947776bf1c2448903b26f3603f9a59
ccessibilityManagerService.java
cc822a769e752c2845dc795f05b7b35b5b3f6614 04-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Touch exploration gesture end not delivered to clients." into jb-dev
cd94caf2bb94f07522ea5bbf0e37dea960b38220 04-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Touch exploration gesture end not delivered to clients.

1. Touch exploration gestures are demarcated by start and end
events. Due to a bug in the AccessibilityManagerService
the gesture end event was not dispatched. This caused the
AccessibilityNodeInfoCache to be off sync since it relies
on getting such events not to mention that the clients were
not getting the end but only the start event. The issue
was that the notified service types variable was not reset
after every event so when the manager sends the last hover
exit it flags that the service type is already notified
resulting in dropping on the floor the following gesture
end event.

bug:6539306

Change-Id: I2b96bcecea3b2240199d67f01afa6a033afce1de
ccessibilityManagerService.java
ebac1b79c4a355d8cd73b49df059deb00d7aa256 03-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Fixing a crash in the TouchExplorer.

1. If the runnable for performing a long press is not
removed when all pointers are up and it is executed
the explorer gets into delegating mode with no pointer
down and the next down crashes the explorer. Added
code to remove the long press runnable in a few places
it was missing and also added a safety in the runnable
to avoid executing it in case there are no active pointers.

bug:6557183

Change-Id: I9dab3de88fd08d8e2b38af18249ac551837c0736
ouchExplorer.java
6acca2442572a28b7d9428e5e2fc2aa4271e29f9 01-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Cannot double tap and hold outside of the input focused window." into jb-dev
238099c0dbbdc66b8443552126680ad1c7cab17d 01-Jun-2012 Svetoslav Ganov <svetoslavganov@google.com> Cannot double tap and hold outside of the input focused window.

1. The long press routine was using the coordintates of the
accessibility focused item in the input focused window.
As a result double tap and hold did not work in a window
that does not take input focus such as the system bar.
Now the routine is using the last touch explored location
if it cannot find accessibility focus in the last touched
window.

bug:6584438

Change-Id: Ifd43adb20a066f389a9d4bd5716dd7ad834dd574
ouchExplorer.java
9a4c5cd19106c3021eeead27fbc2aa05ad7d0d18 30-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Ask to enable touch exploration only the first time it enables the feature.

1. Now we are asking the user to grant permission to the service to enable
touch exploration only the first time this service is enabled. If the
service was uninstalled and then later installed we ask the user again.
This avoids the scenario in which rebooting the device or upgrading an
accessibility service leaves the device in a state in which the user
cannot interact with.

bug:6582088

Change-Id: I51d24e4892b3b48c9fb11dfb09ec1118502ba526
ccessibilityManagerService.java
ouchExplorer.java
4074e8a3f429f62aff3312083d1d925d794ffacc 23-May-2012 Svetoslav Ganov <svetoslavganov@google.com> System accessibility state update postponed if UI test autmation is running.

1. If a UI test automation accessibility service is connected to the
system we pospone state updates in the AccessibilityManagerService
for the moment the UI automations service dies or is disconnected.

bug:6540522

Change-Id: I48ddf603b53d2158a00edcf8ad05cfe2575d4d75
ccessibilityManagerService.java
64a03875897afe07b731eaf66969e87362a1a740 23-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Perform an action in AccessibilityManagerSerivce using wrong process id." into jb-dev
9bf21873c900e7bf82d864172ab40527a48dae3e 23-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Perform an action in AccessibilityManagerSerivce using wrong process id.

1. We are passing the interrogating process id in the remote
accessibility requests to catch the query from the same
thread. While all other methods were doing this correctly
somehow the perform action is using the incorrect process id.

bug:6534935

Change-Id: Icef50833903c562758d51ef316b60c53c7a336c0
ccessibilityManagerService.java
ec2c1717780fa4f61ed11dced16a87b8ae5d7fb0 22-May-2012 Svetoslav Ganov <svetoslavganov@google.com> UI test automation not working.

1. The internal service instance created by AccessibilityManagerService
was getting the looper of the current thread when created. This works
for real accessibility services but since UI automation service is
registered via an IPC the binder thread has no looper. Now we explicitly
get the correct looper.

bug:6535435

Change-Id: I63a2ada1b65c4b3c71c3d1e6deb3dfdeb7a3d6d6
ccessibilityManagerService.java
e15ccb93add99ebb9cd7aec03a04faa37f45b39d 17-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Changing the interaction model of the touch explorer.

1. Now the user have to double tap to activate the last
item. If the last touched window is not active because
it does not take input focus the click on the last
touch explored location. Othewise the click is on the
accessibility focus location.

bug:5932640

Change-Id: Ibb7b97262a7c5f2f94abef429e02790fdc91a8dd
ccessibilityInputFilter.java
ccessibilityManagerService.java
ouchExplorer.java
53e184d34e7c5b1a65c74fac55f9a635d8131dda 17-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Accessibility service needs to request permission to be bound to.

1. Every accessibility services targeting JellyBean or higher has
to request a special permission for the system to bind to it.

Change-Id: I6e579326bdf3597f148d6c67317455701ec8af68
ccessibilityManagerService.java
0bef72450b954ab0254ab948f75a89d65af3808c 15-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Implement the global accessibility action to expand notifications." into jb-dev
5c89f44ea16667bf18297ccb9fb10aad639dab1f 15-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Implement the global accessibility action to expand notifications.

bug:6468852

Change-Id: Id4494a07b1ed96773e22dcfdd5991afe3ee98004
ccessibilityManagerService.java
d1ff736d01cebaee70b76f012b660ae549c252b9 15-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Keeping the screen on during gesture detection.

1. During gesture detection we are not injecting the events we receive
since we do not want the accessibility focus to move as a result of
the hover event of the gesture. Because of that it was possible that
we consume all events since the user performs only gesture to navigate
resulting in the screen being off while the user is actively interacting
with the device. Now we are poking the user activity in the power
manager to keep the screen on.

bug:6485171

Change-Id: I06a09c5297f01bef5e20d471cee76fa7aae0c4fe
ccessibilityInputFilter.java
11fd02f63acba18a1b03351b595490597136fc6a 14-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Update the API version checks." into jb-dev
5a48f9758b990fe6c46359927a40aecb6a02b64c 13-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Update the API version checks.

1. Since the API version has been finalized this change
updates the SDk version checks to use the JellyBean
verson number.

bug:5947249

Change-Id: Ie22fa7e18a7ea7b0c7077d80246a26c17f327ceb
ccessibilityManagerService.java
7b1e0c7046abefc0b40884b36197c8a803d9cf6d 13-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Removing default accessibility gesture handling.

1. The initial design was to have some accessibility gestures
being handled by the system if the gesture handling access
service does not consume the gesture. However, we are not
sure what a good default is and once we add a default handler
we cannot remove it since people may rely on it. Thus, we
take the simples approach and let the accessibility service
handle the gestures. If no gestures are handled the system
will work in explore by touch as before.

bug:5932640

Change-Id: I865a83549fa03b0141d27ce9713e9b7bb45a57b4
ccessibilityManagerService.java
a1dc761c8322355eb1bb71d3d6c9c603c1d1fc0f 10-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding scroll actions to accessibility node info.

1. Scrolling actions are crucial for enabling a gesture based
traversal of the UI and specifically scrollable containers
especially lists and anything backed by an adapter. Since
accessibility focus can land only attached views, it cannot
visit views for adapter items not shown on the screen.
Auto scrolling the list as a result of putting access focus
ot a list item does not work well since the user may get
trapped in a long list. Adding an accessibility node provider
to emit virtual views for one view before the first and one
after the last is complex and suffers the limitation of trapping
the user. Accessibility service need an explicit scroll actions
which may be performed upon an explicit user action. Hence,
the user is informed for the start/end of the visible part of
the list and he makes a deliberate choice to scroll. This will
benefit also people developing Braille devices since they can
scroll the content without telling the user to stop using the
Braille controller and take the device out of his pocket to scroll
and go back to the Braille controller.

NOTE: Without these action large portions of the screen will be
hard to access since users will have to touch and explore to
find and scroll the list.

Change-Id: Iafcf54d4967893205872b3649025a4e347a299ed
ccessibilityManagerService.java
e4abc512aa6474f0106f407f7b399832da34483f 09-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Remove activation gestures form reported and add a touch explore requesting flag.

1. Delegating activation gestures has several issues that we should
decide how to handle if possible before allowing an accessibility
service to take over them:

A) It is needed that every view than can be clicked or long pressed on
reacts to such as a response to calling performClick and performLongPress
which is not necessary true since the view may watch the touch
events and do its own click long click detection. As a result it may
be possible that there are view a user cannot interact with in
touch exploration mode but can if not in that mode.

B) Clicking or long pressing on a different location in a view may yield
different results, for example NumberPicker. Ideally such views have
to implement AccessibilityNodeProvide which provider handles correctly
the request for click long press on virtual nodes. Some apps however
just fire different hover accessibility events when the user is over
a specific semantic portion of the view but do not provide virtual
nodes. Hence, a user will not be able to interact with such semantic
regions but the system can achieve that by sending the click/long click
at the precise location in the view that was last touch explored.

2. Adding a flag on accessibility service info to request explore by touch
mode. There is no need to put the device in this mode if node of the currently
enabled accessibility services supports it. Now the problem is inverted and
the service has to explicitly state its capability.

3. Fixing a bug where includeImportantViews was ignored for automation
services.

Change-Id: I3b29a19f24ab5e26ee29f974bbac2197614c9e2a
ccessibilityManagerService.java
df549f83810c6fa76be1845363ef69809a30e569 09-May-2012 Guang Zhu <guangzhu@google.com> Make UiTestAutomationBridge see non-important views again

This problem was introduced in I74df9c24. The intention of the
change was still let UiTestAutomationBridge see the
non-important views, but there were bugs in the implementation:

1. AccessibilityManagerService was not really updating
mIncludeNotImportantViews when mIsAutomation is true

2. Wrong constant is used to set the flag

Change-Id: Ia0a2e9ed9720bd0ea3a563e0b492e870a6ec1586
ccessibilityManagerService.java
ef5889810c32eca9d874503fdc7df6e2a1575993 08-May-2012 Svetoslav Ganov <svetoslavganov@google.com> DefaultGestureHandlingHelperService should not include non-important views.

1. Since we are using a stateless proxy accessibility service to
perform default accessibility gesture handling it shuld not
operate against not important views.

bug:6422069

Change-Id: I74df9c2415ab3b164d9ac5873f7004c0459e2bfa
ccessibilityManagerService.java
2b435aada3d274a9c08d334946fff1ab9ba15b48 05-May-2012 Svetoslav Ganov <svetoslavganov@google.com> API REVIEW: android.view.accessibility

1. Changed all references to granularity to movement
granularity. BTW, to be more precise it should be
text movement granularity.

bug:6435232

Change-Id: If6366b002ca3390f74918995b342baff2cbcfd01
ccessibilityManagerService.java
5a00661bd6a1bfe82656c51d23a3ac6be99602a2 02-May-2012 Svetoslav Ganov <svetoslavganov@google.com> Accessibility focus should not affect the currently active window.

1. The event of setting an accessibility focus on a view should not
make the host window the currently active one.

bug:6400648

Change-Id: Ib45c255f441c38489ee9d4ab5f284550ac5f6b01
ccessibilityManagerService.java
afe8cf2623f6e28e2c2bf350173e66718b5aa4c0 28-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Removing action arguments checks.

1. The checks for action arguments are not needed since they
may cause trouble for developers if we add more args to
an action.

bug:6414006

Change-Id: Ia4212b52be183b1ef1cfd2561ce618cef2b015e4
ccessibilityManagerService.java
b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dc 25-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding explicit text traversal granularities and actions for web navigation.

1. The granularities for traversing the text content of an accessibility
node info are now predefined constants and custom ones will not be
supported. This is the simplest solution - we can always add namespaced
user defined ones (unlikely).

2. Added actions for traversing web content. These actions can be used by
an accessibility service to transparently drive the JavaScript based
screen reader that is used for handling web content.

3. Added a new accessibility event type for traversing the content of a
view. This event is needed to announce to the user what is the next
element, i.e. the one next to the cursor, after the view's text was
traversed.

bug:5932640
bug:6389591

Change-Id: I144647da55bc4005c64f89865ef333af8359e145
ccessibilityManagerService.java
76f287e416ded85734b610f316e38d243d2ddb09 23-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Removing hierarchical accessibility focus directions.

1. The accessibility focus directions are not needed since an
accessibility service just get the root, first child, next
sibling, previous sibling and call execute the action to
give it accessibility focus. Now the accessibility node
info tree is properly ordered taking into account layout
manager directions for both layout manager that we report
and ones that we have determined as not important for
accessibility. Also the position of a node info are ordered
properly based on their coordinates after all transformations
as opposed to child index.

bug:5932640

Change-Id: I994a8297cb1e57c829ecbac73a937c2bcbe0bac7
ccessibilityManagerService.java
122b2c32dea573a3efbd0d608a70b7cd169d99dd 21-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Fixing a couple of issues I have introduces in the last patch.

1. Fix waiting for the wrong instance.

2. Fix cloning of accessibility node info.

Change-Id: Icabf0d4bc947602a32fddc6642cc787f2bc766e4
ccessibilityManagerService.java
72de2062485f711c9a2291c204fd2c0fb6c4e20f 21-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Merge "Adding support for traversing the content of a node info at granularity."
aa780c110922148a6a4ba06734bb2b0bb8c98f93 20-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding support for traversing the content of a node info at granularity.

1. A view that creates an accessibility node info may add to the info
a list of granularity labels. These are granularities by which the
source view can iterate over its content. For example a text view
may support character, word link while a web view may additionally
support buttons, tables, etc. There are actions on accessibility
node info to go to the next/previous at a given granularity which
is passesed as an argument.

2. Added Bundle argument to the APIs for performing accessibility
actions. This is generic and extensible.

bug:5932640

Change-Id: I328cbbb4cddfdee082ab2a8b7ff1bd7477d8d6f9
ccessibilityManagerService.java
8e2f41426ce162a164d1074dd67ea4549ffd0711 20-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Fixes in the accessibility gesture dispatching.

1. The gesture dispatcher thread was not waiting in a loop
that check for complete initialization. Therefore is was
susceptible to missed signals and unexpected interrupts.

2. In the gesture processing message handle the interaction id
was reading the wrong message argument.

bug:5932640

Change-Id: Ic65ecc01a7fe7d43929c6c07d0759ae9001cf515
ccessibilityManagerService.java
e1a996e99dc68b48efad989876c01ce05a7a58ac 20-Apr-2012 Dianne Hackborn <hackbod@google.com> Merge "Move handling of package changes to a background thread."
d0d7503fd3e941113094532f28986f49b11b5fdb 20-Apr-2012 Dianne Hackborn <hackbod@google.com> Move handling of package changes to a background thread.

Helps get rid of some jank when installing applications.

Change-Id: I97d0022f82d67796e334d37086e5911dd6ca6b62
ccessibilityManagerService.java
fefd20e927b7252d63acb7bb1852c5188e3c1b2e 20-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding an opt-in mechanism for gesture detection in AccessibilityService.

1. An accessibility service has to explicitly opt in to be notified
for gestures by the system. There is only one accessibility service
that handles gestures and in case it does not handle a gesture
the system performs default handling. This default handling ensures
that we have gesture navigation even if no accessibility service
would like to participate/customize the interaction model.

bug:5932640

Change-Id: Id8194293bd94097b455e9388b68134a45dc3b8fa
ccessibilityManagerService.java
ouchExplorer.java
005b83b0c62d3d0538f0d566b08bd457015ec661 17-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Adding some more gestures and actions for accessibility.

1. Added more gesture for accessibility. After a meeting
with the access-eng team we have decided that the current
set of gestures may be smaller than needed considering
that we will use four gestures for home, back, recents,
and notifications.

2. Adding actions for going back, home, opening the recents,
and opening the notifications.

3. Added preliminary mapping from some of the new gestures
to the new actions.

4. Fixed a bug in the accessibility interaction controller
which was trying to create a handled on the main looper
thread which may be null if the queried UI is in the
system process. Now the context looper of the root view
is used.

5. Fixed a bug of using an incorrect constant.

6. Added a missing locking in a couple of places.

7. Fixed view comparison for accessibilityt since it was
not anisymmetric.

bug:5932640
bug:5605641

Change-Id: Icc983bf4eafefa42b65920b3782ed8a25518e94f
ccessibilityManagerService.java
31725b3f387dacf018804e3c500d693261f1d994 17-Apr-2012 Svetoslav Ganov <svetoslavganov@google.com> Fixing a regression I have introduced.

bug:6344558

Change-Id: Ie726e091942e337962baa052953002be724068b1
ccessibilityManagerService.java
4213804541a8b05cd0587b138a2fd9a3b7fd9350 20-Mar-2012 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityInputFilter.java
ccessibilityManagerService.java
ouchExplorer.java
4532e6158474a263d9d26c2b42240bcf7ce9b172 05-Apr-2012 Jeff Brown <jeffbrown@google.com> Refactor input system into its own service.

Extracted the input system from the window manager service into
a new input manager service. This will make it easier to
offer new input-related features to applications.

Cleaned up the input manager service JNI layer somewhat to get rid
of all of the unnecessary checks for whether the input manager
had been initialized. Simplified the callback layer as well.

Change-Id: I3175d01307aed1420780d3c093d2694b41edf66e
ccessibilityInputFilter.java
ouchExplorer.java
57c7fd5a43237afc5e8ef31a076e862c0c16c328 24-Feb-2012 Svetoslav Ganov <svetoslavganov@google.com> Fixing issues with the AccessibilityNodeInfo cache.

1. Before there were two caches one in the app process that
kept track only the ids of infos that were given to a
querying client and one in the querying client that
holds the infos. This design requires precise sync
between the caches. Doing that is somehow complicated
since the app has cache for each window and it has
to intercept all accessibility events from that window
to manage the cache. Each app has to have a cache for
each querying client. This approach would guarantee that
no infos are fetched twice but due to its stateful nature
and the two caches is tricky to implement and adds
unnecessary complexity. Now there is only one cache in
the client and the apps are stateless. The client is
passing flags to the app that are a clue what nodes to
prefetch. This approach may occasionally fetch a node
twice but it is considerably simpler and stateless
from the app perspective - there is only one cache.
Fetching a node more than once does not cause much
overhead compared to the IPC.

Change-Id: Ia02f6fe4f82cff9a9c2e21f4a36747de0f414c6f
ccessibilityManagerService.java
0d04e245534cf777dfaf16dce3c51553837c14ff 21-Feb-2012 Svetoslav Ganov <svetoslavganov@google.com> Improving accessibility APIs used for UI automation.

1. UiTestAutomationBridge was accessing the root node in the
active window by tracking the accessibility event stream
and keeping the last active window changing event. Now
the bridge is stateless and the root node is fetched by
passing special window and view id with the request to
the system.

2. AccessibilityNodeInfos that are cached were not finished,
i.e. not sealed, causing exception when trying to access
their children or rpedecessors.

3. AccessibilityManagerService was not properly restoring its
state after the UI automation bridge disconnects from it.
I particular the devices was still in explore by touch mode
event if no services are enabled and the sutomation bridge
is disconnected.

4. ViewRootImpl for the focused window now fires accessibility
events when accessibility is enabled to allow accessibility
services to determine the current user location.

5. Several missing null checks in ViewRootImpl are fixed since
there were scenraios in which a NPE can occur.

6. Update the internal window content querying tests.

7. ViewRootImpl was firing one extra focus event.
bug:6009813
bug:6026952

Change-Id: Ib2e058d64538ecc268f9ef7a8f36ead047868a05
ccessibilityManagerService.java
9b666d0faadd26827ca5b7cf6af3aa94af6adcd9 10-Feb-2012 Svetoslav Ganov <svetoslavganov@google.com> UI automation service disconnected upon package change.

1. The AccessibilityManagerService used to disable the IU
automation service on package change. This behavior
was incorrect since the automation service has to
survive package installations.

bug:5975207

Change-Id: Idb5e76d02625c333a5842a6b5c5bc90c9b9634c9
ccessibilityManagerService.java
79311c4af8b54d3cd47ab37a120c648bfc990511 18-Jan-2012 Svetoslav Ganov <svetoslavganov@google.com> Speedup the accessibility window querying APIs and clean up.

1. Now when an interrogating client requires an AccessibilibtyNodeInfo
we aggressively prefetch all the predecessors of that node and its
descendants. The number of fetched nodes in one call is limited to
keep the APIs responsive. The prefetched nodes infos are cached in
the client process. The node info cache is invalidated partially or
completely based on the fired accessibility events. For example,
TYPE_WINDOW_STATE_CHANGED event clears the cache while
TYPE_VIEW_FOCUSED removed the focused node from the cache, etc.
Note that the cache is only for the currently active window.
The ViewRootImple also keeps track of only the ids of the node
infos it has sent to each querying process to avoid duplicating
work. Usually only one process will query the screen content
but we support the general case. Also all the caches are
automatically invalidated so not additional bookkeeping is
required. This simple strategy leads to 10X improving the
speed of the querying APIs.

2. The Monkey and UI test automation framework were registering a
raw event listener for accessibility events and hence perform
connection and cache management in similar way to an AccessibilityService.
This is fragile and requires the implementer to know internal framework
stuff. Now the functionality required by the Monkey and the UI automation
is encapsulated in a new UiTestAutomationBridge class. To enable this
was requited some refactoring of AccessibilityService.

3. Removed the *doSomethiong*InActiveWindow methods from the
AccessibilityInteractionClient and the AccessibilityInteractionConnection.
The function of these methods is implemented by the not *InActiveWindow
version while passing appropriate constants.

4. Updated the internal window Querying tests to use the new
UiTestAutomationBridge.

5. If the ViewRootImple was not initialized the querying APIs of
the IAccessibilityInteractionConnection implementation were
returning immediately without calling the callback with null.
This was causing the client side to wait until it times out. Now
the client is notified as soon as the call fails.

6. Added a check to guarantee that Views with AccessibilityNodeProvider
do not have children.

bug:5879530

Change-Id: I3ee43718748fec6e570992c7073c8f6f1fc269b3
ccessibilityManagerService.java
f3b4f3163b5b4c0a54a2643f07c97c47b14a1eb7 01-Dec-2011 Svetoslav Ganov <svetoslavganov@google.com> resolved conflicts for merge of 26f7a81f to master

Change-Id: I6bf5fd7c0de7945cef84602dbe3a7bbed587700f
d116d7c78a9c53f30a73bf273bd7618312cf3847 22-Nov-2011 Svetoslav Ganov <svetoslavganov@google.com> Fixing memory leaks in the accessiiblity layer.

1. AccessibilityInteractionConnections were removed from the
AccessiiblityManagerService but their DeathRecipents were
not unregistered, thus every removed interaction connection
was essentially leaking. Such connection is registered in
the system for every ViewRootImpl when accessiiblity is
enabled and inregistered when disabled.

2. Every AccessibilityEvent and AccessiilbityEventInfo obtained
from a widnow content querying accessibility service had a
handle to a binder proxy over which to make queries. Hoewever,
holding a proxy to a remote binder prevents the latter from
being garbage collected. Therefore, now the events and infos
have a connection id insteand and the hindden singleton
AccessiiblityInteaction client via which queries are made
has a registry with the connections. This class looks up
the connection given its id before making an IPC. Now the
connection is stored in one place and when an accessibility
service is disconnected the system sets the connection to
null so the binder object in the system process can be GCed.
Note that before this change a bad implemented accessibility
service could cache events or infos causing a leak in the
system process. This should never happen.

3. SparseArray was not clearing the reference to the last moved
element while garbage collecting thus causing a leak.

bug:5664337

Change-Id: Id397f614b026d43bd7b57bb7f8186bca5cdfcff9
ccessibilityManagerService.java
021078554b902179442a345a9d080a165c3b5139 04-Oct-2011 Svetoslav Ganov <svetoslavganov@google.com> Adding APIs to enable reporting virtual view hierarchies to accessibility serivces.

Added an interface that is the contract for a client to expose a virtual
view hierarchy to accessibility services. Clients impement this interface
and set it in the View that is the root of the virtual sub-tree. Adding
this finctionality via compostion as opposed to inheritance enables apps
to maintain backwards compatibility by setting the accessibility virtual
hierarchy provider on the View only if the API version is high enough.

bug:5382859

Change-Id: I7e3927b71a5517943c6cb071be2e87fba23132bf
ccessibilityManagerService.java
d8581c7a61a9db042b531ce4baca3c036316e066 18-Oct-2011 Svetoslav Ganov <svetoslavganov@google.com> TouchExplorer crashes if there is incative pointer while dragging.

The TouchExplorer was not taking into account the case with incative
pointers while dragging. If one puts a finger down and then perfroms
a dragging gestore the explorer tries to inject UP event for the end
of the gesture upon every of the two dragging pointers going up instead
only for one the first went up.

bug:5476098

Change-Id: I20d2dd7bde7e016b0678a35d14cd068d9ff37023
ouchExplorer.java
2e1c66bd53d30d2148afaa4b393b60cd59976d65 12-Oct-2011 Svetoslav Ganov <svetoslavganov@google.com> Dragging in touch explore mode should not become exploring.

In touch exploration two fingers in the same direction drag and if one of them
goes up the other starts to touch explore. This however causes inadvertent touch
exploring to happen on almost every scroll causing confusion. Now two finger
drag and they should both go up to allow exploring. This way the inadvertent
exploring is gone and user experience is much better.

bug:5440411

Change-Id: Id8aaece92e5dea1fc740400d2adc9dd63a1674e4
ouchExplorer.java
b6eca6e6691d4563d8395b3c3843d9932a2a6560 27-Sep-2011 Svetoslav Ganov <svetoslavganov@google.com> Accessibility test automation API not working.

1. Due to a previous change that disabled accessibility if not enabled
and installed serivces are present the automation APIs stopped working
since they use fake automation service that is not installed.

2. Added clean up of death recipients when binders die.

bug:5374662
bug:5239044

Change-Id: I1f3c8cd1d1c79753a4a64e2b8b2963025abb2939
ccessibilityManagerService.java
1e741b2705023be64389ac3e31c5f63d330470a5 21-Sep-2011 Svetoslav Ganov <svetoslavganov@google.com> System not checking if enabled services are installed when disabling accessibility.

The system is didabling accessiblity if no accessibility serivces are enabled
to avoid sending events across processes if no recipients are present. The
check considers enabled services which may not have been installed. Now the
check is made against enabled and installed serivces.

bug:5347273

Change-Id: Iad391a1a5bf0bbca470584bc8392f35821ba768c
ccessibilityManagerService.java
bd206d129fdd1777b9f9646a834d7fc342a8941e 16-Sep-2011 Svetoslav Ganov <svetoslavganov@google.com> Touch explorer does not perform tap with the right pointer.

The touch explorer was using the id of the last pointer that
went up while injecting up and down to tap through the last
touch explore event incorrectly assuming that the last up
pointer did touch explore. This was leading to a system crash.

bug:5319315

Change-Id: Iffe8ef753795ad685abe6f493cc09adac8bfea94
ouchExplorer.java
ea515aeafa01de6f50c854ee381b972ef2478284 15-Sep-2011 Svetoslav Ganov <svetoslavganov@google.com> Update the public APIs for finding views by text to optionally use content description.

1. Added flags to the search method to specify whether to match text or
content description or both.

2. Added test case for the seach by content description.

3. Updated the code in AccessibilityManager service to reflect the latest
changes there so test automation service works - this is the fake
service used for UI automation.

Change-Id: I14a6779a920ff0430e78947ea5aaf876c2e66076
ccessibilityManagerService.java
d07d60b9bc0fd2e88f58d6e68dbfadad1bdd31cf 14-Sep-2011 Svetoslav Ganov <svetoslavganov@google.com> AccessibilityManagerService not registered for removed packages.

The pakcage monitor in the AccessibilityManagerService was not
watching for packages that are removed. This is needes since
1) we need to remove the package from the enabled accessibility
serivces and clean up after the removed serivice; 2) we need to
disable accessibility if the last access serivices went away.

Change-Id: I06d33b411ce60703e5a2843107323ffc87046c16
ccessibilityManagerService.java
37fedf8b78dea969b97188fd3079fea5e71704be 14-Sep-2011 Svetoslav Ganov <svetoslavganov@google.com> Disable accessibility if all accessibility serivces are disbaled.

Accessibility was kept enabled even if all accessibility services
are disabled (explicitly by the user or removed) which was causing
the system to fire accessibility events that will never be consumed.

Change-Id: Ifb03e786ac0106687252bd1979725ffd724ad1c5
ccessibilityManagerService.java
406970b06c8472cbd44ecc278d643a12589c6b38 08-Sep-2011 Svetoslav Ganov <svetoslavganov@google.com> Touch explorer does not cancel long press correctly causing system crash.

1. The touch explorer was not canceling long press runnable when a finger
goes down. This was causing system crash in the scenario of one pointer
down and not moving followed by another pointer down. Since the long press
runnable posed when the first pointer went down was not removed it was
sending events with wrong pointer id leading to a crash.

bug:5271592

Change-Id: I40dd7dd21d465ecedd9413f00b3cedc6066fa22d
ouchExplorer.java
12a024ca681d877fe16b7e087356f7aff175a218 04-Sep-2011 Svetoslav Ganov <svetoslavganov@google.com> Tuning the TouchExplorer

1. Tuned the max angle between two moving fingers in touch
exploration mode for a gesture to be considered a drag.
The previous value was too aggressive and it was fairly
easy for the user to get out of dragging state if she
ingreases the distance between her fingers.

bug:5223787

2. Before clicking the explorer was sending hover enter and
exit resulting in firing the corresponding accessibility
events which leads to announcement of the content under
the tap that triggered the click. However, the click is
actually performed on the last touch explored location
(if in the distance slop of course) instead of the actual
tapping pointer location. Before fixing that the user was
confused since he was hearing announcement of one content
but actually was clicking on something else.

bug:5225721

Change-Id: I79fec704878f98c95f181bf8a9647e0bb1bd10ef
ouchExplorer.java
f804420d6e37748b75478406e989c69303756980 27-Aug-2011 Svetoslav Ganov <svetoslavganov@google.com> Clean up and bug fixes in the TouchExplorer.

1. The downTime of the first down event was zero but it should the event time.

2. Hover exit events were not injected while transitioning to delegating
state and when tapping.

3. Differentiation between dragging and delagating state based on
two moving pointer direction and distance is now based only on
the direction. Hence, two pointers moving in the same direction
are dragging, otherwise the event stream is delegated unmodified.
The reason for that is the blind people cannot easily determine
and control the distance between their fingers resulting in
different behavior for gestures which the user thinks are the same
which creates confusion. Also in some cases the delegation and
draggig yield the same result, for example in list view, further
adding to the confusion. This was also causing the status bar to
be opened closed inreliably creating frustration.

4. Refactored the code such that now there is only one method that
injects motion events and all request go through it. Some bugs
were introduced by inconsistent implementation in the different
injection methods.

5. Fixed a couple of event stream inconsistencies reported by the
event consistency verifier.

bug:5224183
bug:5223787
bug:5214829

Change-Id: I16c9be3562ad093017af5b974a41ab525b73453f
ouchExplorer.java
8bd69610aafc6995126965d1d23b771fe02a9084 23-Aug-2011 Svetoslav Ganov <svetoslavganov@google.com> Intra-process view hierarchy interrogation does not work.

The content retrieval APIs are synchronous from a client's
perspective but internally they are asynchronous. The client thread
calls into the system requesting an action and providing a callback
to receive the result after which it waits up to a timeout for that
result. The system enforces security and then delegates the request
to a given view hierarchy where a message is posted (from a binder
thread) describing what to be performed by the main UI thread the
result of which it delivered via the mentioned callback. However,
the blocked client thread and the main UI thread of the target view
hierarchy can be the same one, for example an accessibility service
and an activity run in the same process, thus they are executed on the
same main thread. In such a case the retrieval will fail since the UI
thread that has to process the message describing the work to be done
is blocked waiting for a result is has to compute! To avoid this scenario
when making a call the client also passes its process and thread ids so
the accessed view hierarchy can detect if the client making the request
is running in its main UI thread. In such a case the view hierarchy,
specifically the binder thread performing the IPC to it, does not post a
message to be run on the UI thread but passes it to the singleton
interaction client through which all interactions occur and the latter is
responsible to execute the message before starting to wait for the
asynchronous result delivered via the callback. In this case the expected
result is already received so no waiting is performed.

bug:5138933

Change-Id: I382e2d8689f5189110226613c2387f553df98bd3
ccessibilityManagerService.java
3e4e4af45216aee4d4b009fe842c0324610918eb 05-Aug-2011 Svetoslav Ganov <svetoslavganov@google.com> Turning off accessibility feature reboots the device

1. The touch explorer uses delayed injection of events
which can happen after its hosting accessibility
input filer has been unregistered, thus the explorer
was trying to inject events when this is not allowed.
Now upon unregistration of the accessibility explorer
it resets the state of the touch explorer it hosts.

bug:5105956

Change-Id: I720682abf93382aedf4f431eaac90fd2c781e442
ccessibilityInputFilter.java
ouchExplorer.java
47e02711d78ecac9112aa7f66e5664cdc46fb3d1 01-Aug-2011 Svetoslav Ganov <svetoslavganov@google.com> ACTION_HOVER_EXIT sometimes not delivered during touch exploration.

1. The code for detecting the end of a touch exploration gesture
was not injecting the hover exit event upon detection of the
gesture end.

bug:5091758:

Change-Id: I468164617d6677cd2a2a2815e1756c826d49f3a9
ouchExplorer.java
a31f5e63743f3fc788acbd85474ec80eaf5c8b4d 28-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> InputFilter not updated on global accessibility change.

Change-Id: I35fd5fa078840abf62a3d5eac66b2eae1a79d01d
ccessibilityManagerService.java
4e2a762eae1f6981d32e6098a95498865ad7f795 27-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityManagerService.java
940dabfc669ef5973c54dcc62e38b4a095d1ff9f 25-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> Merge "TouchExplorer long press not working and activation tap not respecting distance slop."
f5a07905a3e025f95472a3f8d9935263e49ad6d3 25-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ouchExplorer.java
00aabf7d187bc05408199bd687a538b2e68bdc17 21-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityManagerService.java
35bfedeaba724aeadc6f6c890269cb6bf7ef42f5 15-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityManagerService.java
4a49d9fe52a76c7f91f81113e0a8e9f97ac3f24c 17-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityManagerService.java
ea80b2d02f836214b175ac24a7b4315053a86f06 16-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> Exception in TouchExplorer due to invalid pointer id.

Change-Id: Iec5d3b3b0d3ae5676e16384ed2b12352fe4a7f3c
ouchExplorer.java
63c04eeb00dd71380d5ebba701014793d8f9a2ea 14-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityManagerService.java
ouchExplorer.java
e8f95352cf4fd2bb38fd124bf5fcefddddeb0692 07-Jul-2011 Svetoslav Ganov <svetoslavganov@google.com> Addressing comments during security review of the interrogation feature.

1. Pretty much minor fixes for improving readability.

Change-Id: I76efdcc574af9a277b54eeb9fb5caf34948fcfde
ccessibilityManagerService.java
b96a41136a9afd8e719c19488094f641f9673362 28-Jun-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityManagerService.java
cf15bb6197c02f5a6893344ba551b96732bcc559 27-Jun-2011 Svetoslav Ganov <svetoslavganov@google.com> Merge "ArrayIndexOutOfBounds exception in TouchExplorer."
51cccf0845b36539d42503495f0689d487712b3a 27-Jun-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ouchExplorer.java
a0156177cdc809795dd8bc5a19943dd2b6f82b66 27-Jun-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityManagerService.java
1ecc1e098a531f57707218b0b38a73f6fa2759d8 22-Jun-2011 Svetoslav Ganov <svetoslavganov@google.com> Minor tweak I forgot in the presious change.

Change-Id: I17854e3c824bea5b6c0ffeea45f986f0b5297054
ccessibilityManagerService.java
7961be75f4161769f620e44dec3f5911e50ebe03 21-Jun-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityManagerService.java
9dc98e3d1764dbcf7828599b70e7a71a3c82a407 17-Jun-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityManagerService.java
eeee4d2c01d3c4ed99e4891dbc75c7de69a803fa 11-Jun-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityManagerService.java
00f7b3f76515d1c6fbe5cf9fee9d3760787c03cd 08-Jun-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ouchExplorer.java
8643aa0179e598e78d938c59035389054535a229 20-Apr-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityManagerService.java
c321c19fc91bfec9a74039ed4d37b815dd4ef379 04-Jun-2011 Svetoslav Ganov <svetoslavganov@google.com> Fixing a bug I introduced during my last merge.

Change-Id: I6474ca94a6ef9bd17a5670a4baa51673f3c2f5d0
ccessibilityManagerService.java
f9886f3ee9db23cc5a553b92e2aeff0ae842c915 11-May-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityManagerService.java
cc4053e031371456fe54d51bbad1db721db4ae38 23-May-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityManagerService.java
91feae3c5994bd4768cea3507c62c65746adcfa6 20-May-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ouchExplorer.java
fe9f8ab03a63b1037f07dd85799fbea80ec6adaa 07-May-2011 Jeff Brown <jeffbrown@google.com> 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
ouchExplorer.java
a3e261d506551713477adb2fd47d1a65b94e64d8 27-Apr-2011 Svetoslav Ganov <svetoslavganov@google.com> The accessibility input filter state was not unregistered when
no spoken feedback accessibility services are regitstered.

bug:4343996

Change-Id: Ie709ac24baa084cf3627d6adb6caf1550c399f8b
ccessibilityManagerService.java
736c2756bf3c14ae9fef7255c119057f7a2be1ed 23-Apr-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityInputFilter.java
ccessibilityManagerService.java
ouchExplorer.java
3fb3d7c4e756bd32d5abde0abca9ab52d559bc84 23-Apr-2011 Adam Powell <adamp@google.com> 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
ccessibilityInputFilter.java
ccessibilityManagerService.java
ouchExplorer.java
ac84d3ba81f08036308b17e1ab919e43987a3df5 05-Apr-2011 Svetoslav Ganov <svetoslavganov@google.com> 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
ccessibilityInputFilter.java
ccessibilityManagerService.java
ouchExplorer.java
43a17654cf4bfe7f1ec22bd8b7b32daccdf27c09 07-Apr-2011 Joe Onorato <joeo@google.com> Remove the deprecated things from Config.java. These haven't been working since before 1.0.

Change-Id: Ic2e8fa68797ea9d486f4117f3d82c98233cdab1e
ccessibilityManagerService.java
0029c66203ab9ded4342976bf7a17bb63af8c44a 30-Mar-2011 Jeff Brown <jeffbrown@google.com> 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
ccessibilityInputFilter.java
ccessibilityManagerService.java
6e6cd7a5660af1a4b5a9ad091c41ef1c72ad2000 30-Mar-2011 Jeff Brown <jeffbrown@google.com> Move accessibility manager service to own package.

Change-Id: I0d73737a21615f0ff0abc80b757fb8c9bcb50be5
ccessibilityManagerService.java