diff options
Diffstat (limited to 'services/inputflinger/dispatcher/include/InputDispatcherInterface.h')
-rw-r--r-- | services/inputflinger/dispatcher/include/InputDispatcherInterface.h | 113 |
1 files changed, 38 insertions, 75 deletions
diff --git a/services/inputflinger/dispatcher/include/InputDispatcherInterface.h b/services/inputflinger/dispatcher/include/InputDispatcherInterface.h index 43428a0130..9b002f437c 100644 --- a/services/inputflinger/dispatcher/include/InputDispatcherInterface.h +++ b/services/inputflinger/dispatcher/include/InputDispatcherInterface.h @@ -18,21 +18,36 @@ #define _UI_INPUT_INPUTDISPATCHER_INPUTDISPATCHERINTERFACE_H #include <InputListener.h> -#include <android-base/result.h> -#include <android/FocusRequest.h> -#include <android/os/BlockUntrustedTouchesMode.h> -#include <android/os/ISetInputWindowsListener.h> -#include <android/os/InputEventInjectionResult.h> -#include <android/os/InputEventInjectionSync.h> -#include <input/InputApplication.h> -#include <input/InputDevice.h> -#include <input/InputTransport.h> -#include <input/InputWindow.h> +#include <input/ISetInputWindowsListener.h> #include <unordered_map> - namespace android { +class InputApplicationHandle; +class InputChannel; +class InputWindowHandle; + +/* + * Constants used to report the outcome of input event injection. + */ +enum { + /* (INTERNAL USE ONLY) Specifies that injection is pending and its outcome is unknown. */ + INPUT_EVENT_INJECTION_PENDING = -1, + + /* Injection succeeded. */ + INPUT_EVENT_INJECTION_SUCCEEDED = 0, + + /* Injection failed because the injector did not have permission to inject + * into the application with input focus. */ + INPUT_EVENT_INJECTION_PERMISSION_DENIED = 1, + + /* Injection failed because there were no available input targets. */ + INPUT_EVENT_INJECTION_FAILED = 2, + + /* Injection failed due to a timeout. */ + INPUT_EVENT_INJECTION_TIMED_OUT = 3 +}; + /* Notifies the system about input events generated by the input reader. * The dispatcher is expected to be mostly asynchronous. */ class InputDispatcherInterface : public virtual RefBase, public InputListenerInterface { @@ -74,10 +89,9 @@ public: * * This method may be called on any thread (usually by the input manager). */ - virtual android::os::InputEventInjectionResult injectInputEvent( - const InputEvent* event, int32_t injectorPid, int32_t injectorUid, - android::os::InputEventInjectionSync syncMode, std::chrono::milliseconds timeout, - uint32_t policyFlags) = 0; + virtual int32_t injectInputEvent(const InputEvent* event, int32_t injectorPid, + int32_t injectorUid, int32_t syncMode, + std::chrono::milliseconds timeout, uint32_t policyFlags) = 0; /* * Check whether InputEvent actually happened by checking the signature of the event. @@ -99,8 +113,7 @@ public: * This method may be called on any thread (usually by the input manager). */ virtual void setFocusedApplication( - int32_t displayId, - const std::shared_ptr<InputApplicationHandle>& inputApplicationHandle) = 0; + int32_t displayId, const sp<InputApplicationHandle>& inputApplicationHandle) = 0; /* Sets the focused display. * @@ -130,50 +143,19 @@ public: */ virtual void setInTouchMode(bool inTouchMode) = 0; - /** - * Sets the maximum allowed obscuring opacity by UID to propagate touches. - * For certain window types (eg. SAWs), the decision of honoring - * FLAG_NOT_TOUCHABLE or not depends on the combined obscuring opacity of - * the windows above the touch-consuming window. - */ - virtual void setMaximumObscuringOpacityForTouch(float opacity) = 0; - - /** - * Sets the mode of the block untrusted touches feature. - * - * TODO(b/169067926): Clean-up feature modes. - */ - virtual void setBlockUntrustedTouchesMode(android::os::BlockUntrustedTouchesMode mode) = 0; - /* Transfers touch focus from one window to another window. * * Returns true on success. False if the window did not actually have touch focus. */ - virtual bool transferTouchFocus(const sp<IBinder>& fromToken, const sp<IBinder>& toToken, - bool isDragDrop) = 0; + virtual bool transferTouchFocus(const sp<IBinder>& fromToken, const sp<IBinder>& toToken) = 0; - /** - * Transfer touch focus to the provided channel, no matter where the current touch is. - * - * Return true on success, false if there was no on-going touch. - */ - virtual bool transferTouch(const sp<IBinder>& destChannelToken) = 0; - - /** - * Sets focus on the specified window. - */ - virtual void setFocusedWindow(const FocusRequest&) = 0; - - /** - * Creates an input channel that may be used as targets for input events. + /* Registers input channels that may be used as targets for input events. * * This method may be called on any thread (usually by the input manager). */ - virtual base::Result<std::unique_ptr<InputChannel>> createInputChannel( - const std::string& name) = 0; + virtual status_t registerInputChannel(const sp<InputChannel>& inputChannel) = 0; - /** - * Creates an input channel to be used to monitor input events. + /* Registers input channels to be used to monitor input events. * * Each monitor must target a specific display and will only receive input events sent to that * display. If the monitor is a gesture monitor, it will only receive pointer events on the @@ -181,39 +163,20 @@ public: * * This method may be called on any thread (usually by the input manager). */ - virtual base::Result<std::unique_ptr<InputChannel>> createInputMonitor(int32_t displayId, - bool gestureMonitor, - const std::string& name, - int32_t pid) = 0; + virtual status_t registerInputMonitor(const sp<InputChannel>& inputChannel, int32_t displayId, + bool gestureMonitor) = 0; - /* Removes input channels that will no longer receive input events. + /* Unregister input channels that will no longer receive input events. * * This method may be called on any thread (usually by the input manager). */ - virtual status_t removeInputChannel(const sp<IBinder>& connectionToken) = 0; + virtual status_t unregisterInputChannel(const sp<InputChannel>& inputChannel) = 0; /* Allows an input monitor steal the current pointer stream away from normal input windows. * * This method may be called on any thread (usually by the input manager). */ virtual status_t pilferPointers(const sp<IBinder>& token) = 0; - - /** - * Enables Pointer Capture on the specified window if the window has focus. - * - * InputDispatcher is the source of truth of Pointer Capture. - */ - virtual void requestPointerCapture(const sp<IBinder>& windowToken, bool enabled) = 0; - /* Flush input device motion sensor. - * - * Returns true on success. - */ - virtual bool flushSensor(int deviceId, InputDeviceSensorType sensorType) = 0; - - /** - * Called when a display has been removed from the system. - */ - virtual void displayRemoved(int32_t displayId) = 0; }; } // namespace android |