Commit Graph

450 Commits

Author SHA1 Message Date
RyanlwLin
4eccaf5e39 Do not redispatch/inject motionevent to private virtual display
The virtaul display with private flag can't be access by other process.
To prevent AceesibilityService redispatches/injects motionevents on it,
We don't add it to valid displayList.

Bug: 138637403
Test: AccessibilityInputFilterTest
Test: AccessibilityGestureDectorTest
Change-Id: I7b60e4eee87b0812d3c882d0e45bbf2016190e6a
2019-08-15 21:08:56 +08:00
Ryan Lin
c4d27393e8 Merge "make MotionEventInjector support multi-display" 2019-08-02 03:37:20 +00:00
Ameer Armaly
9339c598bb Move accessibility gesture code into its own package.
Given the number of classes that are going  to be created (gesture detectors, TouchExplorer state handlers) it made sense to put them into their own package.
Bug: 136131815
Test: atest CtsAccessibilityServiceTestCases CtsAccessibilityTestCases

Change-Id: Ie347424ecd7518a7c5a4fdefdca5b4886b1fd8e4
2019-08-01 10:39:00 -07:00
Jacky Kao
80c49d7ad6 Merge "Supporting windows updated per display [Part II]" 2019-08-01 05:33:24 +00:00
Jacky Kao
3f730ebfd1 Supporting windows updated per display [Part II]
Creating new class, DisplayWindowsObserver implementing
WindowManagerInternal.WindowsForAccessibilityCallback, receives
updated windows from window manager.

Bug: 132854721
Test: a11y CTS & unit tests
Test: atest AccessibilityWindowManagerTest
Change-Id: I211da59d72c284e4a87574d3fc1955f44036800a
2019-07-31 18:03:51 +08:00
RyanlwLin
9f4b83d272 make MotionEventInjector support multi-display
Although we have MotionEventInjector for each display but it always
inject events to default display. We set display id of the motion events
to make it correct.

Test: atest MotionEventInjectorTest
Test: atest AccessibilityGestureDetectorTest
Test: atest AccessibilityServiceConnectionTest
Bug: 138422679
Change-Id: I8cfbe9887109e001ea64ca0c250606684be370e7
2019-07-30 11:04:23 +00:00
Ryan Lin
74fc2c8d70 Merge "Added onGesture(AccessibilityGestureInfo) for mulit-display" 2019-07-26 05:49:30 +00:00
Ryan Lin
e1e3273b10 Merge "added setDisplayId in GestureDesicption.Builder to support multi-display" 2019-07-24 03:49:54 +00:00
RyanlwLin
a0daddd8d8 Added onGesture(AccessibilityGestureInfo) for mulit-display
We added a new API to help App developers know the gesture information
performed on specific display.

Bug: 133290787
Test: atest AccessibilityGestureDetectorTest
Change-Id: Ic98847691ba9f608f418408e9bef1c3116388f3c
2019-07-24 11:28:50 +08:00
Jacky Kao
0b423b70c1 Merge "Supporting windows updated per display [Part I]" 2019-07-22 08:01:26 +00:00
RyanlwLin
8078813107 added setDisplayId in GestureDesicption.Builder to support multi-display
We add this API to support dispatching gesures on mulit-display. If the
display id is invalid or the assigned display is untouchable, this
action would be cancelled.

Test: atest AccessibilityServiceConnectionTest
Bug: 133290787
Change-Id: Ic0e265f7b0b2a9601a670e290d6d2dab27a92545
2019-07-22 11:22:44 +08:00
Jacky Kao
f93252b725 Supporting windows updated per display [Part I]
1. Making WindowsForAccessibilityObserver class to be plural for
supporting multi-display.
2. Adding the display information when WindowManagerService informs the
window changes to Accessibility Controller.

Bug: 132854721
Test: a11y CTS & unit tests
Change-Id: I0efba7d924b24fcab85c6bb333687cc4cefa890f
2019-07-22 10:45:35 +08:00
Minche Li
56b61987b0 Merge "Support A11y overlay on multi-display" 2019-07-19 02:56:09 +00:00
mincheli
5f435e70db Support A11y overlay on multi-display
To make an a11y overlay window available on a specific display, we need
to update window token and update the context with a specific display
information when AccessibilityServiceConnection or diplay is changed.

Bug: 133304985
Test: a11y CTS & unit tests
Change-Id: Ib8693978e2455b5f568e195167e319b5b6cc9f02
2019-07-18 17:37:50 +08:00
Jackal Guo
f382371d77 Add new APIs to support RegionInScreen in A11yWindowInfo
To support non-rectangular visible area for windows, add new APIs
about RegionInScreen in A11yWindowInfo to represent the actual
interact-able area of a window.

Bug: 132146558
Test: a11y CTS & unit tests
Change-Id: I86bb6bc8c567e09f01a3f853a3cffd896ce934c8
2019-07-17 10:57:09 +08:00
Ryan Lin
9cc9618560 Merge "Use DisplayContext to replace default context" 2019-07-05 03:15:29 +00:00
RyanlwLin
983a9969df Use DisplayContext to replace default context
When detecting gesturs, the threshold is based on the display metrics.
To get correct display metrics, we replace default context with displayContext.

Bug: 136425762
Test: atest TouchExploreTest
Test: atest MagnificationGestureHandlerTest

Change-Id: I2d6c5a0ef00966d9164e117fc65dac8131f7a175
2019-07-04 08:15:04 +00:00
Rhed Jao
f4b2f5197e Merge "Add tests for AbstractAccessibilityServiceConnection" 2019-07-02 06:56:12 +00:00
Rhed Jao
d444a9ae13 Add tests for AbstractAccessibilityServiceConnection
Bug: 133635779
Test: atest AbstractAccessibilityServiceConnectionTest
Change-Id: Idfcf3790a1a45dfa4423d57e6d2d13c6a302e11e
2019-07-01 14:27:43 +08:00
Minche Li
855b4506d4 Merge "Always adjust event location to the middle of two fingers when two-finger dragging in TouchExplorer" 2019-06-28 06:26:19 +00:00
Jackal Guo
28dce10513 Move pre-check in A11yController to the new A11yWindowManager
Bug: 112046331
Test: a11y CTS & unit tests
Change-Id: If012cb3d9eb1404864a16592d44edbc0893c81b7
2019-06-25 17:13:29 +08:00
Ryan Lin
1877e93695 Merge "added getDisplayId for AccessibilityWindowInfo" 2019-06-13 08:14:32 +00:00
Ameer Armaly
0a142b5cfd Break up TouchExplorer.handleMotionEventStateTouchExploring for better readability.
Test: atest CtsAccessibilityServiceTestCases
Change-Id: I3d85918b53601af617f137300526d4fd47fe0571
2019-06-05 16:44:54 -07:00
mincheli
069ff1636b Always adjust event location to the middle of two fingers when two-finger dragging in TouchExplorer
No need to check the min distsance, always adjust the event location.
Remove mScaledMinPointerDistanceToUseMiddleLocation and
MIN_POINTER_DISTANCE_TO_USE_MIDDLE_LOCATION_DIP.

Bug: 134124639
Test: atest TouchExplorerTest
Change-Id: I8be1d665e307d0191aecef3f6f16d825514ce628
2019-06-03 03:56:14 +00:00
Jackal Guo
4a318ed2e8 Adjust down time to prevent subsequent modules being misleading
MagnificationGestureHandler cache some events to see if users want to
trigger magnification. If no magnification is triggered we inject the
events with original down time. This causes the subsequent modules,
like GestureDetector, be misleading. For example, injecting a cached
ACTION_DOWN event may mistrigger a long click if the down time of the
event is long enough ago.

Bug: 131815497
Test: a11y CTS & unit tests
Change-Id: I19508e8ef7c91af02cdc628463d5715f6de22cd3
2019-06-03 11:28:10 +08:00
RyanlwLin
25a3651245 added getDisplayId for AccessibilityWindowInfo
To support multi-display, we need to retrive display id from
AccessibilityWindowInfo.

Test: atest ctsAccessibilityWindoInfoTest
Bug: 132851274
Change-Id: Ia59bd83e223ecf5c9af7e4b0a52150e0353192c7
2019-05-31 15:55:20 +08:00
Ameer Armaly
0649924d21 Extract touch state information from TouchExplorer into TouchState.
Test: cts-tradefed run singleCommand cts -d --module CtsAccessibilityService TestCases --test android.accessibilityservice.cts.TouchExplorerTest

Change-Id: I05f907e3dcfe7341c237b2bd7a5fef19271472c9
2019-05-28 13:17:21 -07:00
Phil Weaver
5093019f09 SecurityPolicy refactor
Bug: 112046331
Test: a11y cts and framework tests
Test: atest AccessibilitySecurityPolicyTest
Test: atest AccessibilityWindowManagerTest
Change-Id: I86c68603588b94cbd312e2ea30202ce866f99953
2019-05-24 16:31:19 +08:00
Ameer Armaly
886a7961be Use AccessibilityManagerService to deliver double tap and double tap and hold rather than touch events.
Test: cts-tradefed run singleCommand cts -d --module CtsAccessibilityServiceTestCases
Change-Id: I84bba65ac16e27e9c564b23a0c27d48245eef447
2019-05-21 12:48:58 -07:00
mincheli
b7507a9997 Adjust event location when two-finger dragging in TouchExplorer
To scroll on the screen when using TalkBack, a user need to dragging two
finger pointers. If the dragging pointer are closer that a given distance
we use the location of the primary one. Otherwise, we should adjust the
event location to take the middle between the two finger pointers.

Bug: 126354276
Test: atest TouchExplorerTest
Change-Id: I9e95ccec964d7930498febdd02731b94826fbb7b
2019-04-25 13:40:03 +08:00
Jackal Guo
efc894eeec Merge "Race condition while injecting ACTION_OUTSIDE" into qt-dev 2019-04-24 05:47:11 +00:00
Jackal Guo
8bcc0a9846 Race condition while injecting ACTION_OUTSIDE
In order to dismiss dialog in accessibility, we would also send
ACTION_OUTSIDE while performing ACTION_CLICK. However, the result
of performing ACTION_CLICK in AccessibilityInteractionClient may
be overwritten by the result of performing ACTION_OUTSIDE. This
causes that TouchExplorer may get incorrect result and follow-up
behavior is different.

Bug: 127902192
Test: a11y CTS & unit tests
Test: After enabling Talkback, manually test on 'View Terms' page
      in ManagedProvisioning to check if the section heading can
      be expanded/collapsed by double tap.

Change-Id: Id6b1f63ea87418c66bf1aebdea829f656581e8ed
2019-04-23 03:29:47 +00:00
Sara Kato
0fdbae3c46 Add @Nullable annotation to getAccessibilityWindowId
Bug: 126701062
Test: None
Change-Id: I7d13d56f5ffb303431f7e82418134d6f17275ef5
2019-04-19 12:04:51 +00:00
Jackal Guo
5ed20a7782 Don't cancel injected event when mouse event arrives
Currently, MotionEventInjector would cancel any injected gesture when
any MotionEvent arrives. For user using an external device to control
the pointer movement, it's almost impossible to perform the gestures.
Any slightly unintended movement results in the cancellation of the
gesture.

However, if MotionEventInjector keeps sending mouse movement events
when gesture is performing, dispatch logic would be confused and it
causes the gesture malfunction. Therefore, ignore movement events
from mouse when there is an ongoing gesture since click event from
mouse should be intended.

Bug: 116459737
Test: add a new test case in MotionEventInjectorTest
Test: a11y CTS & unit tests
Change-Id: I2c2be8cf565ba15d1a9cd6bc8c45b695c1309b56
Merged-In: I2c2be8cf565ba15d1a9cd6bc8c45b695c1309b56
2019-04-11 02:50:01 +00:00
Rhed Jao
a82d7831b4 Merge "Fix unbind a11y service fail" 2019-04-03 03:10:03 +00:00
Phil Weaver
c0c7efc442 Add null check to destroyUiAutomationService
Fixes: 129704196
Test: atest UiAutomationManagerTest, atest CtsUiAutomationTestCases
Change-Id: I257c4f7321e9b3b54efe45e46ede50b010494c6e
2019-04-02 09:15:14 -07:00
Rhed Jao
69d13b1522 Fix unbind a11y service fail
Bug: 128422953
Test: all a11y cts & framework tests
Change-Id: I391c81b97f73805f375fd3ab36759dfc826847ec
2019-04-02 21:52:40 +08:00
TreeHugger Robot
cdc6650063 Merge "Dumps bound and enabled services in a11yManagerService" 2019-04-01 06:57:14 +00:00
Rhed Jao
d3547af8fe Dumps bound and enabled services in a11yManagerService
Bug: 128422953
Test: dumpsys accessibility
Change-Id: I2f1fd441818d0a7bd379a9e7d325bcb63b64c620
2019-03-29 16:11:51 +08:00
Rhed Jao
6c8a43b685 Update active window when a11y client is removed
Bug: 119844696
Test: all a11y cts & framework tests
Change-Id: I9d826db034d2a61d61304fce9dcfc9ef4d319058
2019-03-25 20:58:51 +08:00
Jackal Guo
43be31120d Remove unpaired AccessibilityEvent
After a failed gesture, TouchExplorer was trying to announce
the transition to touch exploration mode. Since TouchExplorer
doesn't enter this mode, stop notifying a11y services.

Besides, don't announce the end of the touch interaction if users
don't lift the fingers.

Bug: 118724767
Test: A11y CTS & unit test
Change-Id: I0320c47ac82e5371ef20c5bd16ef2d059ebad6f6
2019-03-18 14:58:27 +08:00
Michal Karpinski
e069b0022f Add new BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS binding flag
and the mechanism to use it

Since both starts and bindings might be contributing to the service
being whitelisted, track the state in ServiceRecord and update
the parent process accordingly when changes happen.

While we're at it, add that flag for bindings to accessibility
services, voice interaction services and QSTiles.

Also, make the timeout constant configurable for start-based
whitelisting.

Bug: 124298522
Bug: 123495976 (accessibility services)
Bug: 123337181 (paying via NFC, like Google Pay)
Bug: 122887611 (binding to InCallService)
Bug: 127774234 (binding to QSTile)
Bug: 124288681 (binding to voice interaction services)
Test: atest WmTests:ActivityStarterTests
Test: atest AccessibilityServiceConnectionTest
Test: manual with:
1) notifications from calendar and dynamite to test service starts
whitelisting
2) enabling talkback and livetranscribe to test service bindings
whitelisting
3) adding the LastPass QSTile and clicking on it
Change-Id: I8b6f23f999683920411ca40ab5b25c688a4f7055
2019-03-13 11:29:12 +00:00
Jackal Guo
57a5b295f9 Merge "Add critical event to relevantEvents." 2019-01-31 01:07:07 +00:00
Jackal Guo
8b8cb1e252 Add critical event to relevantEvents.
When no WindowsForAccessibilityCallback is registered or no a11y
service watches events affected the active window, mActiveWindowId
won't be updated accordingly. This causes some a11y events can't
be dispatched due to mismatch of window id.

We need to add TYPE_WINDOW_STATE_CHANGED event to relevantEvents
in order to keep mActiveWindowId up-to-date once the packages are
not excluded from whitelist.

Bug: 118096360
Test: a11y CTS & unit test
Change-Id: Id139572cd350ba5d1b1927fe1fc94dc0d8ec6279
2019-01-30 18:07:29 +08:00
Rhed Jao
098876f547 Merge "Improve clear a11y forcus for A11yManagerService" 2019-01-30 08:01:13 +00:00
Jackal Guo
bfaeaf3607 Merge "Adding AppOps data for Accessibility" 2019-01-29 03:17:23 +00:00
Jackal Guo
8dc791e678 Adding AppOps data for Accessibility
Support to expose the apps accessing accessibility features in the
permission hub. Start logging each time any data goes to services.

Bug: 122615167
Test: a11y CTS & unit test
Change-Id: I21f92dad8b3ec2e59a8ad6d180dc466357347784
2019-01-28 15:54:24 +08:00
Jackal Guo
d6e8dba7e9 Using actual display id
For MagnificationGestureHandler, enable the support for multi-display
by giving actual display id instead of default one.

Bug: 112273690
Test: A11y CTS & unit test
Test: manual
Change-Id: I0f1e844e491f39d35b75ab398ff9481680610fc9
2019-01-24 14:41:06 +08:00
Jackal Guo
a275d99547 Merge "Support A11yInputFilter on multi-display" 2019-01-24 05:43:07 +00:00
Rhed Jao
be6a92d6b2 Merge "Fix delay when multi-tap out of distance slop." 2019-01-23 05:58:13 +00:00