Native input dispatch rewrite work in progress.
The old dispatch mechanism has been left in place and continues to
be used by default for now. To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.
Includes part of the new input event NDK API. Some details TBD.
To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument. The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points. The ViewRoot then
provides the InputChannel to the InputQueue. Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue. This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.
There can be zero or more targets for any given input event. Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets). Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.
End-to-end event dispatch mostly works!
To do: event injection, rate limiting, ANRs, testing, optimization, etc.
Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
2010-04-23 01:58:52 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2010 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _UI_INPUT_MANAGER_H
|
|
|
|
#define _UI_INPUT_MANAGER_H
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Native input manager.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <ui/EventHub.h>
|
|
|
|
#include <ui/Input.h>
|
|
|
|
#include <utils/Errors.h>
|
|
|
|
#include <utils/Vector.h>
|
|
|
|
#include <utils/Timers.h>
|
|
|
|
#include <utils/RefBase.h>
|
|
|
|
#include <utils/String8.h>
|
|
|
|
|
|
|
|
namespace android {
|
|
|
|
|
2010-06-15 08:31:58 +00:00
|
|
|
class InputChannel;
|
|
|
|
|
|
|
|
class InputReaderInterface;
|
|
|
|
class InputReaderPolicyInterface;
|
Native input dispatch rewrite work in progress.
The old dispatch mechanism has been left in place and continues to
be used by default for now. To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.
Includes part of the new input event NDK API. Some details TBD.
To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument. The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points. The ViewRoot then
provides the InputChannel to the InputQueue. Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue. This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.
There can be zero or more targets for any given input event. Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets). Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.
End-to-end event dispatch mostly works!
To do: event injection, rate limiting, ANRs, testing, optimization, etc.
Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
2010-04-23 01:58:52 +00:00
|
|
|
class InputReaderThread;
|
2010-06-15 08:31:58 +00:00
|
|
|
|
|
|
|
class InputDispatcherInterface;
|
|
|
|
class InputDispatcherPolicyInterface;
|
Native input dispatch rewrite work in progress.
The old dispatch mechanism has been left in place and continues to
be used by default for now. To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.
Includes part of the new input event NDK API. Some details TBD.
To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument. The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points. The ViewRoot then
provides the InputChannel to the InputQueue. Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue. This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.
There can be zero or more targets for any given input event. Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets). Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.
End-to-end event dispatch mostly works!
To do: event injection, rate limiting, ANRs, testing, optimization, etc.
Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
2010-04-23 01:58:52 +00:00
|
|
|
class InputDispatcherThread;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The input manager is the core of the system event processing.
|
|
|
|
*
|
|
|
|
* The input manager uses two threads.
|
|
|
|
*
|
|
|
|
* 1. The InputReaderThread (called "InputReader") reads and preprocesses raw input events,
|
|
|
|
* applies policy, and posts messages to a queue managed by the DispatcherThread.
|
|
|
|
* 2. The InputDispatcherThread (called "InputDispatcher") thread waits for new events on the
|
|
|
|
* queue and asynchronously dispatches them to applications.
|
|
|
|
*
|
|
|
|
* By design, the InputReaderThread class and InputDispatcherThread class do not share any
|
|
|
|
* internal state. Moreover, all communication is done one way from the InputReaderThread
|
|
|
|
* into the InputDispatcherThread and never the reverse. Both classes may interact with the
|
|
|
|
* InputDispatchPolicy, however.
|
|
|
|
*
|
|
|
|
* The InputManager class never makes any calls into Java itself. Instead, the
|
|
|
|
* InputDispatchPolicy is responsible for performing all external interactions with the
|
|
|
|
* system, including calling DVM services.
|
|
|
|
*/
|
|
|
|
class InputManagerInterface : public virtual RefBase {
|
|
|
|
protected:
|
|
|
|
InputManagerInterface() { }
|
|
|
|
virtual ~InputManagerInterface() { }
|
|
|
|
|
|
|
|
public:
|
|
|
|
/* Starts the input manager threads. */
|
|
|
|
virtual status_t start() = 0;
|
|
|
|
|
|
|
|
/* Stops the input manager threads and waits for them to exit. */
|
|
|
|
virtual status_t stop() = 0;
|
|
|
|
|
|
|
|
/* Registers an input channel prior to using it as the target of an event. */
|
|
|
|
virtual status_t registerInputChannel(const sp<InputChannel>& inputChannel) = 0;
|
|
|
|
|
|
|
|
/* Unregisters an input channel. */
|
|
|
|
virtual status_t unregisterInputChannel(const sp<InputChannel>& inputChannel) = 0;
|
|
|
|
|
2010-06-18 03:52:56 +00:00
|
|
|
/* Injects an input event and optionally waits for sync.
|
|
|
|
* This method may block even if sync is false because it must wait for previous events
|
|
|
|
* to be dispatched before it can determine whether input event injection will be
|
|
|
|
* permitted based on the current input focus.
|
|
|
|
* Returns one of the INPUT_EVENT_INJECTION_XXX constants.
|
|
|
|
*/
|
|
|
|
virtual int32_t injectInputEvent(const InputEvent* event,
|
|
|
|
int32_t injectorPid, int32_t injectorUid, bool sync, int32_t timeoutMillis) = 0;
|
|
|
|
|
2010-06-22 08:27:15 +00:00
|
|
|
/* Preempts input dispatch in progress by making pending synchronous
|
|
|
|
* dispatches asynchronous instead. This method is generally called during a focus
|
|
|
|
* transition from one application to the next so as to enable the new application
|
|
|
|
* to start receiving input as soon as possible without having to wait for the
|
|
|
|
* old application to finish up.
|
|
|
|
*/
|
|
|
|
virtual void preemptInputDispatch() = 0;
|
|
|
|
|
2010-06-15 08:31:58 +00:00
|
|
|
/* Gets input device configuration. */
|
2010-07-24 04:28:06 +00:00
|
|
|
virtual void getInputConfiguration(InputConfiguration* outConfiguration) = 0;
|
2010-06-15 08:31:58 +00:00
|
|
|
|
2010-07-24 04:28:06 +00:00
|
|
|
/* Gets information about the specified input device.
|
|
|
|
* Returns OK if the device information was obtained or NAME_NOT_FOUND if there
|
|
|
|
* was no such device.
|
Native input dispatch rewrite work in progress.
The old dispatch mechanism has been left in place and continues to
be used by default for now. To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.
Includes part of the new input event NDK API. Some details TBD.
To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument. The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points. The ViewRoot then
provides the InputChannel to the InputQueue. Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue. This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.
There can be zero or more targets for any given input event. Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets). Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.
End-to-end event dispatch mostly works!
To do: event injection, rate limiting, ANRs, testing, optimization, etc.
Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
2010-04-23 01:58:52 +00:00
|
|
|
*/
|
2010-07-24 04:28:06 +00:00
|
|
|
virtual status_t getInputDeviceInfo(int32_t deviceId, InputDeviceInfo* outDeviceInfo) = 0;
|
|
|
|
|
|
|
|
/* Gets the list of all registered device ids. */
|
|
|
|
virtual void getInputDeviceIds(Vector<int32_t>& outDeviceIds) = 0;
|
|
|
|
|
|
|
|
/* Queries current input state. */
|
|
|
|
virtual int32_t getScanCodeState(int32_t deviceId, uint32_t sourceMask,
|
|
|
|
int32_t scanCode) = 0;
|
|
|
|
virtual int32_t getKeyCodeState(int32_t deviceId, uint32_t sourceMask,
|
|
|
|
int32_t keyCode) = 0;
|
|
|
|
virtual int32_t getSwitchState(int32_t deviceId, uint32_t sourceMask,
|
|
|
|
int32_t sw) = 0;
|
Native input dispatch rewrite work in progress.
The old dispatch mechanism has been left in place and continues to
be used by default for now. To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.
Includes part of the new input event NDK API. Some details TBD.
To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument. The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points. The ViewRoot then
provides the InputChannel to the InputQueue. Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue. This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.
There can be zero or more targets for any given input event. Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets). Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.
End-to-end event dispatch mostly works!
To do: event injection, rate limiting, ANRs, testing, optimization, etc.
Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
2010-04-23 01:58:52 +00:00
|
|
|
|
2010-06-15 08:31:58 +00:00
|
|
|
/* Determines whether physical keys exist for the given framework-domain key codes. */
|
2010-07-24 04:28:06 +00:00
|
|
|
virtual bool hasKeys(int32_t deviceId, uint32_t sourceMask,
|
|
|
|
size_t numCodes, const int32_t* keyCodes, uint8_t* outFlags) = 0;
|
Native input dispatch rewrite work in progress.
The old dispatch mechanism has been left in place and continues to
be used by default for now. To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.
Includes part of the new input event NDK API. Some details TBD.
To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument. The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points. The ViewRoot then
provides the InputChannel to the InputQueue. Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue. This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.
There can be zero or more targets for any given input event. Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets). Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.
End-to-end event dispatch mostly works!
To do: event injection, rate limiting, ANRs, testing, optimization, etc.
Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
2010-04-23 01:58:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class InputManager : public InputManagerInterface {
|
|
|
|
protected:
|
|
|
|
virtual ~InputManager();
|
|
|
|
|
|
|
|
public:
|
2010-06-15 08:31:58 +00:00
|
|
|
InputManager(
|
|
|
|
const sp<EventHubInterface>& eventHub,
|
|
|
|
const sp<InputReaderPolicyInterface>& readerPolicy,
|
|
|
|
const sp<InputDispatcherPolicyInterface>& dispatcherPolicy);
|
|
|
|
|
|
|
|
// (used for testing purposes)
|
|
|
|
InputManager(
|
|
|
|
const sp<InputReaderInterface>& reader,
|
|
|
|
const sp<InputDispatcherInterface>& dispatcher);
|
Native input dispatch rewrite work in progress.
The old dispatch mechanism has been left in place and continues to
be used by default for now. To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.
Includes part of the new input event NDK API. Some details TBD.
To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument. The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points. The ViewRoot then
provides the InputChannel to the InputQueue. Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue. This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.
There can be zero or more targets for any given input event. Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets). Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.
End-to-end event dispatch mostly works!
To do: event injection, rate limiting, ANRs, testing, optimization, etc.
Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
2010-04-23 01:58:52 +00:00
|
|
|
|
|
|
|
virtual status_t start();
|
|
|
|
virtual status_t stop();
|
|
|
|
|
|
|
|
virtual status_t registerInputChannel(const sp<InputChannel>& inputChannel);
|
|
|
|
virtual status_t unregisterInputChannel(const sp<InputChannel>& inputChannel);
|
|
|
|
|
2010-06-18 03:52:56 +00:00
|
|
|
virtual int32_t injectInputEvent(const InputEvent* event,
|
|
|
|
int32_t injectorPid, int32_t injectorUid, bool sync, int32_t timeoutMillis);
|
|
|
|
|
2010-06-22 08:27:15 +00:00
|
|
|
virtual void preemptInputDispatch();
|
|
|
|
|
2010-07-24 04:28:06 +00:00
|
|
|
virtual void getInputConfiguration(InputConfiguration* outConfiguration);
|
|
|
|
virtual status_t getInputDeviceInfo(int32_t deviceId, InputDeviceInfo* outDeviceInfo);
|
|
|
|
virtual void getInputDeviceIds(Vector<int32_t>& outDeviceIds);
|
|
|
|
virtual int32_t getScanCodeState(int32_t deviceId, uint32_t sourceMask,
|
|
|
|
int32_t scanCode);
|
|
|
|
virtual int32_t getKeyCodeState(int32_t deviceId, uint32_t sourceMask,
|
|
|
|
int32_t keyCode);
|
|
|
|
virtual int32_t getSwitchState(int32_t deviceId, uint32_t sourceMask,
|
|
|
|
int32_t sw);
|
|
|
|
virtual bool hasKeys(int32_t deviceId, uint32_t sourceMask,
|
|
|
|
size_t numCodes, const int32_t* keyCodes, uint8_t* outFlags);
|
Native input dispatch rewrite work in progress.
The old dispatch mechanism has been left in place and continues to
be used by default for now. To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.
Includes part of the new input event NDK API. Some details TBD.
To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument. The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points. The ViewRoot then
provides the InputChannel to the InputQueue. Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue. This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.
There can be zero or more targets for any given input event. Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets). Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.
End-to-end event dispatch mostly works!
To do: event injection, rate limiting, ANRs, testing, optimization, etc.
Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
2010-04-23 01:58:52 +00:00
|
|
|
|
|
|
|
private:
|
2010-06-15 08:31:58 +00:00
|
|
|
sp<InputReaderInterface> mReader;
|
|
|
|
sp<InputReaderThread> mReaderThread;
|
Native input dispatch rewrite work in progress.
The old dispatch mechanism has been left in place and continues to
be used by default for now. To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.
Includes part of the new input event NDK API. Some details TBD.
To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument. The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points. The ViewRoot then
provides the InputChannel to the InputQueue. Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue. This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.
There can be zero or more targets for any given input event. Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets). Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.
End-to-end event dispatch mostly works!
To do: event injection, rate limiting, ANRs, testing, optimization, etc.
Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
2010-04-23 01:58:52 +00:00
|
|
|
|
2010-06-15 08:31:58 +00:00
|
|
|
sp<InputDispatcherInterface> mDispatcher;
|
Native input dispatch rewrite work in progress.
The old dispatch mechanism has been left in place and continues to
be used by default for now. To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.
Includes part of the new input event NDK API. Some details TBD.
To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument. The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points. The ViewRoot then
provides the InputChannel to the InputQueue. Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue. This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.
There can be zero or more targets for any given input event. Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets). Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.
End-to-end event dispatch mostly works!
To do: event injection, rate limiting, ANRs, testing, optimization, etc.
Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
2010-04-23 01:58:52 +00:00
|
|
|
sp<InputDispatcherThread> mDispatcherThread;
|
|
|
|
|
2010-06-15 08:31:58 +00:00
|
|
|
void initialize();
|
Native input dispatch rewrite work in progress.
The old dispatch mechanism has been left in place and continues to
be used by default for now. To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.
Includes part of the new input event NDK API. Some details TBD.
To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument. The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points. The ViewRoot then
provides the InputChannel to the InputQueue. Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue. This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.
There can be zero or more targets for any given input event. Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets). Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.
End-to-end event dispatch mostly works!
To do: event injection, rate limiting, ANRs, testing, optimization, etc.
Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
2010-04-23 01:58:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace android
|
|
|
|
|
|
|
|
#endif // _UI_INPUT_MANAGER_H
|