diff options
-rw-r--r-- | include/input/Input.h | 6 | ||||
-rw-r--r-- | libs/input/Input.cpp | 42 | ||||
-rw-r--r-- | services/inputflinger/dispatcher/InputDispatcher.cpp | 18 |
3 files changed, 5 insertions, 61 deletions
diff --git a/include/input/Input.h b/include/input/Input.h index 57a05ada90..54b4e5a737 100644 --- a/include/input/Input.h +++ b/include/input/Input.h @@ -227,10 +227,6 @@ enum { // Disables automatic key repeating behavior. POLICY_FLAG_DISABLE_KEY_REPEAT = 0x08000000, - // Indicates whether an injected event is an unmodified copy of what was originally - // a real input event. - POLICY_FLAGS_INJECTED_IS_UNCHANGED = 0x10000000, - /* These flags are set by the input reader policy as it intercepts each event. */ // Indicates that the device was in an interactive state when the @@ -697,8 +693,6 @@ public: void copyFrom(const MotionEvent* other, bool keepHistory); - bool equals(const MotionEvent* other) const; - void addSample( nsecs_t eventTime, const PointerCoords* pointerCoords); diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp index 36428a3727..31aa685391 100644 --- a/libs/input/Input.cpp +++ b/libs/input/Input.cpp @@ -17,7 +17,6 @@ #define LOG_TAG "Input" //#define LOG_NDEBUG 0 -#include <cmath> #include <cutils/compiler.h> #include <limits.h> #include <string.h> @@ -386,47 +385,6 @@ void MotionEvent::copyFrom(const MotionEvent* other, bool keepHistory) { } } -bool MotionEvent::equals(const MotionEvent* other) const { - /* - * All fields are checked for precise equality except for mDownTime - * which is not checked because: - * 1) magnify accessibility service uses MotionEvent.setDownTime() - * 2) fw/b InputManagerService converts from ns to ms so precision is - * different after inputflinger -> system server -> inputflinger - * round trip. - */ - return mId == other->mId - && mDeviceId == other->mDeviceId - && mSource == other->mSource - && mDisplayId == other->mDisplayId - && mAction == other->mAction - && mActionButton == other->mActionButton - && mFlags == other->mFlags - && mEdgeFlags == other->mEdgeFlags - && mMetaState == other->mMetaState - && mButtonState == other->mButtonState - && mClassification == other->mClassification - && mXScale == other->mXScale - && mYScale == other->mYScale - && mXOffset == other->mXOffset - && mYOffset == other->mYOffset - && mXPrecision == other->mXPrecision - && mYPrecision == other->mYPrecision - && ((std::isnan(mRawXCursorPosition) && std::isnan(other->mRawXCursorPosition)) - || mRawXCursorPosition == other->mRawXCursorPosition) - && ((std::isnan(mRawYCursorPosition) && std::isnan(other->mRawYCursorPosition)) - || mRawYCursorPosition == other->mRawYCursorPosition) - && mPointerProperties.size() == other->mPointerProperties.size() - && std::equal(mPointerProperties.begin(), mPointerProperties.end(), - other->mPointerProperties.begin()) - && mSampleEventTimes.size() == other->mSampleEventTimes.size() - && std::equal(mSampleEventTimes.begin(), mSampleEventTimes.end(), - other->mSampleEventTimes.begin()) - && mSamplePointerCoords.size() == other->mSamplePointerCoords.size() - && std::equal(mSamplePointerCoords.begin(), mSamplePointerCoords.end(), - other->mSamplePointerCoords.begin()); -} - void MotionEvent::addSample( int64_t eventTime, const PointerCoords* pointerCoords) { diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp index 95704f2527..dd0082c09e 100644 --- a/services/inputflinger/dispatcher/InputDispatcher.cpp +++ b/services/inputflinger/dispatcher/InputDispatcher.cpp @@ -3291,8 +3291,6 @@ int32_t InputDispatcher::injectInputEvent(const InputEvent* event, int32_t injec if (hasInjectionPermission(injectorPid, injectorUid)) { policyFlags |= POLICY_FLAG_TRUSTED; } - // Override device ID if the injected event is not an unmodified real input. - bool forceVirtualKeyboardId = !(policyFlags & POLICY_FLAGS_INJECTED_IS_UNCHANGED); std::queue<EventEntry*> injectedEntries; switch (event->getType()) { @@ -3305,14 +3303,11 @@ int32_t InputDispatcher::injectInputEvent(const InputEvent* event, int32_t injec int32_t flags = incomingKey.getFlags(); int32_t keyCode = incomingKey.getKeyCode(); - int32_t deviceId = forceVirtualKeyboardId - ? VIRTUAL_KEYBOARD_ID - : incomingKey.getDeviceId(); int32_t metaState = incomingKey.getMetaState(); - accelerateMetaShortcuts(deviceId, action, + accelerateMetaShortcuts(VIRTUAL_KEYBOARD_ID, action, /*byref*/ keyCode, /*byref*/ metaState); KeyEvent keyEvent; - keyEvent.initialize(incomingKey.getId(), deviceId, incomingKey.getSource(), + keyEvent.initialize(incomingKey.getId(), VIRTUAL_KEYBOARD_ID, incomingKey.getSource(), incomingKey.getDisplayId(), INVALID_HMAC, action, flags, keyCode, incomingKey.getScanCode(), metaState, incomingKey.getRepeatCount(), incomingKey.getDownTime(), incomingKey.getEventTime()); @@ -3333,7 +3328,7 @@ int32_t InputDispatcher::injectInputEvent(const InputEvent* event, int32_t injec mLock.lock(); KeyEntry* injectedEntry = new KeyEntry(incomingKey.getId(), incomingKey.getEventTime(), - deviceId, incomingKey.getSource(), + VIRTUAL_KEYBOARD_ID, incomingKey.getSource(), incomingKey.getDisplayId(), policyFlags, action, flags, keyCode, incomingKey.getScanCode(), metaState, incomingKey.getRepeatCount(), incomingKey.getDownTime()); @@ -3351,9 +3346,6 @@ int32_t InputDispatcher::injectInputEvent(const InputEvent* event, int32_t injec if (!validateMotionEvent(action, actionButton, pointerCount, pointerProperties)) { return INPUT_EVENT_INJECTION_FAILED; } - int32_t deviceId = forceVirtualKeyboardId - ? VIRTUAL_KEYBOARD_ID - : motionEvent->getDeviceId(); if (!(policyFlags & POLICY_FLAG_FILTERED)) { nsecs_t eventTime = motionEvent->getEventTime(); @@ -3369,7 +3361,7 @@ int32_t InputDispatcher::injectInputEvent(const InputEvent* event, int32_t injec const nsecs_t* sampleEventTimes = motionEvent->getSampleEventTimes(); const PointerCoords* samplePointerCoords = motionEvent->getSamplePointerCoords(); MotionEntry* injectedEntry = - new MotionEntry(motionEvent->getId(), *sampleEventTimes, deviceId, + new MotionEntry(motionEvent->getId(), *sampleEventTimes, VIRTUAL_KEYBOARD_ID, motionEvent->getSource(), motionEvent->getDisplayId(), policyFlags, action, actionButton, motionEvent->getFlags(), motionEvent->getMetaState(), motionEvent->getButtonState(), @@ -3386,7 +3378,7 @@ int32_t InputDispatcher::injectInputEvent(const InputEvent* event, int32_t injec samplePointerCoords += pointerCount; MotionEntry* nextInjectedEntry = new MotionEntry(motionEvent->getId(), *sampleEventTimes, - deviceId, motionEvent->getSource(), + VIRTUAL_KEYBOARD_ID, motionEvent->getSource(), motionEvent->getDisplayId(), policyFlags, action, actionButton, motionEvent->getFlags(), motionEvent->getMetaState(), motionEvent->getButtonState(), |