Instead of each application loading the KeyCharacterMap from
the file system, get them from the input manager service as
part of the InputDevice object.
Refactored InputManager to be a proper singleton instead of
having a bunch of static methods.
InputManager now maintains a cache of all InputDevice objects
that it has loaded. Currently we never invalidate the cache
which can cause InputDevice to return stale motion ranges if
the device is reconfigured. This will be fixed in a future change.
Added a fake InputDevice with ID -1 to represent the virtual keyboard.
Change-Id: If7a695839ad0972317a5aab89e9d1e42ace28eb7
The purpose of the input device descriptor is to make it possible
to associate persistent settings for each input device, such as the
keyboard layout.
The descriptor is a hash of the information we have about the
device, such as its vendor id, product id, unique id, name,
or location.
Bug: 6110399
Change-Id: Idb80f946819b3f0dbf4e661bb0a753dbc2b60981
On reflection, only key events need to be serialized.
This is part of a series of changes to improve input system pipelining.
Bug: 5963420
Change-Id: I028b4eac97497d012036cb60ffbac4cb22d3966c
To support this feature, the input dispatcher now allows input
events to be acknowledged out-of-order. As a result, the
consumer can choose to defer handling an input event from one
device (because it is building a big batch) while continuing
to handle input events from other devices.
The InputEventReceiver now sends a notification when a batch
is pending. The ViewRoot handles this notification by scheduling
a draw on the next sync. When the draw happens, the InputEventReceiver
is instructed to consume all pending batched input events, the
input event queue is fully processed (as much as possible),
and then the ViewRoot performs traversals as usual.
With these changes in place, the input dispatch latency is
consistently less than one frame as long as the application itself
isn't stalled. Input events are delivered to the application
as soon as possible and are handled as soon as possible. In practice,
it is no longer possible for an application to build up a huge
backlog of touch events.
This is part of a series of changes to improve input system pipelining.
Bug: 5963420
Change-Id: I42c01117eca78f12d66d49a736c1c122346ccd1d
Minor tweak to the dispatcher to handle as many finished signals
in a receive callback as possible instead of going back to
the Looper and waiting for the next poll() to hit the callback
again.
This is part of a series of changes to improve input system pipelining.
Bug: 5963420
Change-Id: I8471107371693e21ce8ce7cca1e8d79ba4ca2351
This change enables the input dispatcher to send multiple touch
events to an application without waiting for them to be acknowledged.
Essentially this is a variation on the old streaming optimization
but it is much more comprehensive. Event dispatch will stall as
soon as 0.5sec of unacknowledged events are accumulated or a
focused event (such as a key event) needs to be delivered.
Streaming input events makes a tremendous difference in application
performance. The next step will be to enable batching of input
events on the client side once again.
This is part of a series of changes to improve input system pipelining.
Bug: 5963420
Change-Id: I025df90c06165d719fcca7f63eed322a5cce4a78
The information gathered here will no longer be valid once we
start dispatching multiple events at a time to the same connection.
Moreover, we are more concerned with end-to-end latency, which we
can measure with sufficiently high accuracy in other ways.
This is part of a series of changes to improve input system pipelining.
Bug: 5963420
Change-Id: I49a0c9876b64af56b40e96e0d98c45f325da2a73
The dispatcher no longer needs to track which connections are
active except perhaps for diagnostic purposes, so we might as well
remove this code.
This is part of a series of changes to improve input system pipelining.
Bug: 5963420
Change-Id: Ibadc830b7b792a59b9244d0a6e85f320c4947109
Since we no longer stream events to the application, we don't need to
keep the current list of input targets around longer than it takes
to begin the dispatch cycle.
This is part of a series of changes to improve input system pipelining.
Bug: 5963420
Change-Id: I5824b04e564c8a4dec991598292441e46c331905
Since we will not longer be modifying events in place, we don't need
to use an ashmem region for input. Simplified the code to instead
use a socket of type SOCK_SEQPACKET.
This is part of a series of changes to improve input system pipelining.
Bug: 5963420
Change-Id: I05909075ed8b61b93900913e44c6db84857340d8
Don't worry, these features will be moving to a different part of
the pipeline. We're just getting them out of the way for now so
we can make deeper changes to how the input dispatcher works.
This is part of a series of changes to improve input system pipelining.
Bug: 5963420
Change-Id: If97de923c8165776882eef23f5204cc448dad0fc
Try harder to test for liveness. There are situations where
the lock might not be held but the input system is stuck in
a callback into the window manager policy that has hung.
Bug: 5094994
Change-Id: Iff88655512a5dc8bbb4615be65f4115e975c020b
The new ioctls will enable the system to be more selective about
which evdev devices should hold wake-locks when their queue is
non-empty.
For now, we enable this behavior for all configured input devices,
which is more or less the status quo. This change is mainly about
ensuring that the system still works correctly when combined with
a newer kernel that supports the suspend-block ioctls. We can
tweak this behavior later.
Change-Id: I8ff69aa5198903f7e2998772a339313df17c0f24
This optimization is no longer needed now that the kernel evdev
driver's poll() implementation only wakes up the poll after
the final sync.
Change-Id: If237776861df9cfac3086e744d3bbf3484d4c53b
Fixed a problem where the key up for the ALT or META key was not
delivered to the task switcher dialog because it was deemed
to be inconsistent with the window's observed state. Consequently
the dialog would not be dismissed when the key was released.
Moved global hotkey handling for META+* shortcuts and ALT/META-TAB
into the window manager policy's interceptKeyBeforeDispatching
method. This change prevents applications from hijacking these
keys.
The original idea was that these shortcuts would be handled only
if the application did not handle them itself. That way certain
applications, such as remote desktop tools, could deliberately
override some of these less important system shortcuts.
Unfortunately, that does make the behavior inconsistent across
applications. What's more, bugs in the onKeyDown handler of
applications can cause the shortcuts to not work at all, for
no good reason.
Perhaps we can add an opt-in feature later to enable specific
applications to repurpose these keys when it makes sense.
Bug: 5720358
Change-Id: I22bf17606d12dbea6549c60d20763e6608576cf7
Stop using system properties to publish information about
the key character map path. Instead, we can retrieve it
on demand by asking the window manager.
It was possible to exhaust the supply of system properties
when repeatedly adding and removing input devices.
Bug: 5532806
Change-Id: Idd361a24ad7db2edc185c8546db7fb05f9c28669
For the getState() routines that operate on multiple devices / mappers:
Return AKEY_STATE_DOWN (or AKEY_STATE_VIRTUAL) if any of the devices/mappers
have the key down.
Otherwise, return AKEY_STATE_UP if at least one device/mapper returns AKEY_STATE_UP.
Otherwise, return AKEY_STATE_UNKNOWN.
Change-Id: I1ef6251d73af916b51f408a41c5e4adf5bdc237a
Bug: 5011907
Introduce a 150ms delay in handling volume down keys
while waiting to see if a power key will follow.
Don't trigger the screenshot chord if both volume up and
volume down are pressed together.
Don't trigger the long-press power menu if volume keys are
also pressed.
Require the user to press both keys in the chord within
the debounce time and continue long-pressing them in order
to trigger the screenshot action.
Change-Id: I248968d37b73c09d6d08e7f62667c443eba32da0
Prevent system overlays from showing above the notification bar.
Allow secure system overlays to be fullscreen, for the pointer
location view.
Show the drag layer above the notification bar.
Change-Id: Ic8d663792a243cca2cd9952d241d001e0357d551
This change enables the joystick input mapper to handle any axes
that are not claimed by the touch input mapper, which makes
auxiliary controls such as wheels / knobs accessible.
Change-Id: I01ee7f342ac91acfcb4ccb6676fd52b3d5bf31a0
Bug: 5156144
Input channels could leak or simply live longer than they should
in some cases.
1. Monitor channels (used by the pointer location overlay) are never
unregistered, so they would leak.
Added code to handle failures in the receive callback by closing
the input channel.
2. The DragState held onto its input window and application handles
even after the input channel was disposed.
Added code to null these handles out when they are no longer needed.
3. Input channels previously used as input event targets would stick
around until the targets were cleared (usually on the next
event).
Added code to detect when the input dispatcher is in
an idle state and to proactively clear the targets then
to ensure that resources are released promptly.
4. Native input window handles held onto the input channel even
after the input window was removed from the input dispatcher.
Consequently, the input channel would not be disposed until
the input window handle itself was freed. Since the input
window handle is held from managed code, this meant that the
window's input channel could stick around until the next GC.
Refactored the input window handle to separate the properties
(info) and identify (handle) state into different objects.
Then modified the dispatcher to release the properties (info)
when no longer needed, including the input channel.
7. The pointer location overlay does not actually use its
standard input channel, only the monitor input channel.
Added INPUT_FEATURE_NO_INPUT_CHANNEL to allow windows to
request that they not be provided with an input channel
at all.
Improved some of the error handling logic to emit the status
code as part of the exception message.
Change-Id: I01988d4391a70c6678c8b0e936ca051af680b1a5