public class KeyEventDispatcher extends Object
AccessibilityService.onKeyEvent
on a single thread, and so
don't see the N+1th event until they have processed the Nth event.Constructor and Description |
---|
KeyEventDispatcher(Handler handlerToSendKeyEventsToInputFilter,
int messageTypeForSendKeyEvent,
Object lock,
PowerManager powerManager) |
Modifier and Type | Method and Description |
---|---|
void |
flush(com.android.server.accessibility.AccessibilityManagerService.Service service)
Flush all pending key events for a service, treating all of them as unhandled
|
boolean |
notifyKeyEventLocked(KeyEvent event,
int policyFlags,
List<com.android.server.accessibility.AccessibilityManagerService.Service> boundServices)
Notify that a new KeyEvent is available to accessibility services.
|
void |
setOnKeyEventResult(com.android.server.accessibility.AccessibilityManagerService.Service service,
boolean handled,
int sequence)
Set the result from onKeyEvent from one service.
|
public KeyEventDispatcher(Handler handlerToSendKeyEventsToInputFilter, int messageTypeForSendKeyEvent, Object lock, PowerManager powerManager)
handlerToSendKeyEventsToInputFilter
- The handler to which to post KeyEvent
s
that have not been handled by any accessibility service.messageTypeForSendKeyEvent
- The field to populate message.what
for the
message that carries a KeyEvent
to be sent to the input filterlock
- The lock used for all synchronization in this package. This lock must be held
when calling notifyKeyEventLocked
powerManager
- The power manager to alert to user activity if a KeyEvent is processed
by a servicepublic boolean notifyKeyEventLocked(KeyEvent event, int policyFlags, List<com.android.server.accessibility.AccessibilityManagerService.Service> boundServices)
event
- The new key eventpolicyFlags
- Flags for the eventboundServices
- A list of currently bound AccessibilityServicestrue
if the event was passed to at least one AccessibilityService,
false
otherwise.public void setOnKeyEventResult(com.android.server.accessibility.AccessibilityManagerService.Service service, boolean handled, int sequence)
service
- The service setting the resulthandled
- true
if the service handled the KeyEvent
sequence
- The sequence number of the KeyEvent
public void flush(com.android.server.accessibility.AccessibilityManagerService.Service service)
service
- The service for which to flush events