Loading services/inputflinger/dispatcher/InputDispatcher.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -252,6 +252,10 @@ InputDispatcher::InputDispatcher(const sp<InputDispatcherPolicyInterface>& polic mDispatchEnabled(false), mDispatchFrozen(false), mInputFilterEnabled(false), // mInTouchMode will be initialized by the WindowManager to the default device config. // To avoid leaking stack in case that call never comes, and for tests, // initialize it here anyways. mInTouchMode(true), mFocusedDisplayId(ADISPLAY_ID_DEFAULT), mInputTargetWaitCause(INPUT_TARGET_WAIT_CAUSE_NONE) { mLooper = new Looper(false); Loading Loading @@ -3538,6 +3542,11 @@ void InputDispatcher::setInputFilterEnabled(bool enabled) { mLooper->wake(); } void InputDispatcher::setInTouchMode(bool inTouchMode) { std::scoped_lock lock(mLock); mInTouchMode = inTouchMode; } bool InputDispatcher::transferTouchFocus(const sp<IBinder>& fromToken, const sp<IBinder>& toToken) { if (fromToken == toToken) { if (DEBUG_FOCUS) { Loading services/inputflinger/dispatcher/InputDispatcher.h +2 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,7 @@ public: virtual void setFocusedDisplay(int32_t displayId) override; virtual void setInputDispatchMode(bool enabled, bool frozen) override; virtual void setInputFilterEnabled(bool enabled) override; virtual void setInTouchMode(bool inTouchMode) override; virtual bool transferTouchFocus(const sp<IBinder>& fromToken, const sp<IBinder>& toToken) override; Loading Loading @@ -247,6 +248,7 @@ private: bool mDispatchEnabled GUARDED_BY(mLock); bool mDispatchFrozen GUARDED_BY(mLock); bool mInputFilterEnabled GUARDED_BY(mLock); bool mInTouchMode GUARDED_BY(mLock); std::unordered_map<int32_t, std::vector<sp<InputWindowHandle>>> mWindowHandlesByDisplay GUARDED_BY(mLock); Loading services/inputflinger/dispatcher/include/InputDispatcherInterface.h +8 −0 Original line number Diff line number Diff line Loading @@ -116,6 +116,14 @@ public: */ virtual void setInputFilterEnabled(bool enabled) = 0; /** * Set the touch mode state. * Touch mode is a global state that apps may enter / exit based on specific * user interactions with input devices. * If true, the device is in touch mode. */ virtual void setInTouchMode(bool inTouchMode) = 0; /* Transfers touch focus from one window to another window. * * Returns true on success. False if the window did not actually have touch focus. Loading Loading
services/inputflinger/dispatcher/InputDispatcher.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -252,6 +252,10 @@ InputDispatcher::InputDispatcher(const sp<InputDispatcherPolicyInterface>& polic mDispatchEnabled(false), mDispatchFrozen(false), mInputFilterEnabled(false), // mInTouchMode will be initialized by the WindowManager to the default device config. // To avoid leaking stack in case that call never comes, and for tests, // initialize it here anyways. mInTouchMode(true), mFocusedDisplayId(ADISPLAY_ID_DEFAULT), mInputTargetWaitCause(INPUT_TARGET_WAIT_CAUSE_NONE) { mLooper = new Looper(false); Loading Loading @@ -3538,6 +3542,11 @@ void InputDispatcher::setInputFilterEnabled(bool enabled) { mLooper->wake(); } void InputDispatcher::setInTouchMode(bool inTouchMode) { std::scoped_lock lock(mLock); mInTouchMode = inTouchMode; } bool InputDispatcher::transferTouchFocus(const sp<IBinder>& fromToken, const sp<IBinder>& toToken) { if (fromToken == toToken) { if (DEBUG_FOCUS) { Loading
services/inputflinger/dispatcher/InputDispatcher.h +2 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,7 @@ public: virtual void setFocusedDisplay(int32_t displayId) override; virtual void setInputDispatchMode(bool enabled, bool frozen) override; virtual void setInputFilterEnabled(bool enabled) override; virtual void setInTouchMode(bool inTouchMode) override; virtual bool transferTouchFocus(const sp<IBinder>& fromToken, const sp<IBinder>& toToken) override; Loading Loading @@ -247,6 +248,7 @@ private: bool mDispatchEnabled GUARDED_BY(mLock); bool mDispatchFrozen GUARDED_BY(mLock); bool mInputFilterEnabled GUARDED_BY(mLock); bool mInTouchMode GUARDED_BY(mLock); std::unordered_map<int32_t, std::vector<sp<InputWindowHandle>>> mWindowHandlesByDisplay GUARDED_BY(mLock); Loading
services/inputflinger/dispatcher/include/InputDispatcherInterface.h +8 −0 Original line number Diff line number Diff line Loading @@ -116,6 +116,14 @@ public: */ virtual void setInputFilterEnabled(bool enabled) = 0; /** * Set the touch mode state. * Touch mode is a global state that apps may enter / exit based on specific * user interactions with input devices. * If true, the device is in touch mode. */ virtual void setInTouchMode(bool inTouchMode) = 0; /* Transfers touch focus from one window to another window. * * Returns true on success. False if the window did not actually have touch focus. Loading