summaryrefslogtreecommitdiff
path: root/services/inputflinger/dispatcher/InputDispatcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/inputflinger/dispatcher/InputDispatcher.cpp')
-rw-r--r--services/inputflinger/dispatcher/InputDispatcher.cpp18
1 files changed, 5 insertions, 13 deletions
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(),