Loading core/java/com/android/internal/widget/MousePointerView.java +79 −1 Original line number Diff line number Diff line Loading @@ -16,10 +16,13 @@ package com.android.internal.widget; import android.app.Instrumentation; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; import android.os.SystemClock; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; Loading Loading @@ -47,7 +50,7 @@ public class MousePointerView extends View { if (mouseX == 0 && mouseY == 0) { } else if ((lastX == 0 && lastY == 0) || lastX - mouseX < 10.0f || lastY - mouseY < 10.0f) { // Draw mouse pointer // Draw mouse cursor mPath.rewind(); mPath.moveTo(mouseX, mouseY); mPath.lineTo(mouseX + 12.0f, mouseY + 12.0f); Loading @@ -69,6 +72,54 @@ public class MousePointerView extends View { } } private void mouseScrollUp() { long downTime = SystemClock.uptimeMillis(); long eventTime = SystemClock.uptimeMillis(); Instrumentation inst = new Instrumentation(); MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, mouseX, mouseY, 0); inst.sendPointerSync(event); eventTime = SystemClock.uptimeMillis(); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY + 5.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY + 10.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY + 15.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY + 25.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY + 35.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY + 45.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, mouseX, mouseY + 60.0f, 0); inst.sendPointerSync(event); } private void mouseScrollDown() { long downTime = SystemClock.uptimeMillis(); long eventTime = SystemClock.uptimeMillis(); Instrumentation inst = new Instrumentation(); MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, mouseX, mouseY, 0); inst.sendPointerSync(event); eventTime = SystemClock.uptimeMillis(); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY - 5.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY - 10.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY - 15.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY - 25.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY - 35.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY - 45.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, mouseX, mouseY - 60.0f, 0); inst.sendPointerSync(event); } public void addTouchEvent(MotionEvent event) { lastX = mouseX; lastY = mouseY; Loading @@ -77,9 +128,36 @@ public class MousePointerView extends View { postInvalidate(); } public void addKeyEvent(KeyEvent event) { if (event.getKeyCode() == 0x5c) { mouseScrollUp(); } else if (event.getKeyCode() == 0x5d) { mouseScrollDown(); } postInvalidate(); } @Override public boolean onTouchEvent(MotionEvent event) { addTouchEvent(event); return true; } @Override public boolean onTrackballEvent(MotionEvent event) { return super.onTrackballEvent(event); } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { addKeyEvent(event); return true; } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { return true; } } libs/ui/InputReader.cpp +27 −84 Original line number Diff line number Diff line Loading @@ -3338,29 +3338,7 @@ void MouseInputMapper::sync(nsecs_t when) { { // acquire lock AutoMutex _l(mLock); bool downChanged = fields & Accumulator::FIELD_BTN_MOUSE; if (downChanged) { if (mAccumulator.btnMouse) { mLocked.down = true; mLocked.downTime = when; } else { mLocked.down = false; } motionEventAction = mLocked.down ? AMOTION_EVENT_ACTION_DOWN : AMOTION_EVENT_ACTION_UP; } else { motionEventAction = AMOTION_EVENT_ACTION_MOVE; } if (fields & Accumulator::FIELD_BTN_RIGHT && mLocked.down) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnRight ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x03/*Keycode for home*/, 0x20 /*Scancode*/, mContext->getGlobalMetaState(), when); } else if (fields & Accumulator::FIELD_BTN_RIGHT) { if (fields & Accumulator::FIELD_BTN_RIGHT) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnRight ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, Loading @@ -3369,15 +3347,7 @@ void MouseInputMapper::sync(nsecs_t when) { mContext->getGlobalMetaState(), when); } if (fields & Accumulator::FIELD_BTN_MIDDLE && mLocked.down) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnMiddle ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x42/*Keycode for enter key*/, 0x27 /*Scancode*/, mContext->getGlobalMetaState(), when); } else if (fields & Accumulator::FIELD_BTN_MIDDLE) { if (fields & Accumulator::FIELD_BTN_MIDDLE) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnMiddle ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, Loading @@ -3386,15 +3356,7 @@ void MouseInputMapper::sync(nsecs_t when) { mContext->getGlobalMetaState(), when); } if (fields & Accumulator::FIELD_BTN_SIDE && mLocked.down) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnSide ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x16 /*Keycode for right key*/, 0x30 /*Scancode*/, mContext->getGlobalMetaState(), when); } else if (fields & Accumulator::FIELD_BTN_SIDE) { if (fields & Accumulator::FIELD_BTN_SIDE) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnSide ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, Loading @@ -3403,20 +3365,12 @@ void MouseInputMapper::sync(nsecs_t when) { mContext->getGlobalMetaState(), when); } if (fields & Accumulator::FIELD_BTN_EXTRA && mLocked.down) { if (fields & Accumulator::FIELD_BTN_EXTRA) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnExtra ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x15 /*Keycode for left key*/, 0x31 /*Scancode*/, mContext->getGlobalMetaState(), when); } else if (fields & Accumulator::FIELD_BTN_EXTRA) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnExtra ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x42/*Keycode for enter key*/, 0x27 /*Scancode*/, 0x54/*Keycode for search key*/, 0x21 /*Scancode*/, mContext->getGlobalMetaState(), when); } Loading @@ -3438,54 +3392,43 @@ void MouseInputMapper::sync(nsecs_t when) { mContext->getGlobalMetaState(), when); } bool scrollChanged = fields & Accumulator::FIELD_REL_WHEEL; if (mAccumulator.btnScrollUp && scrollChanged && mLocked.down) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_DOWN, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x57/*Keycode for next key*/, 0x28 /*Scancode*/, mContext->getGlobalMetaState(), when); getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x57/*Keycode for next key*/, 0x28 /*Scancode*/, mContext->getGlobalMetaState(), when); bool downChanged = fields & Accumulator::FIELD_BTN_MOUSE; if (downChanged) { if (mAccumulator.btnMouse) { mLocked.down = true; mLocked.downTime = when; } else { mLocked.down = false; } else if (mAccumulator.btnScrollUp && scrollChanged) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_DOWN, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x13/*Keycode for up key*/, 0x24 /*Scancode*/, mContext->getGlobalMetaState(), when); getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x13/*Keycode for up key*/, 0x24 /*Scancode*/, mContext->getGlobalMetaState(), when); motionEventAction = mLocked.down ? AMOTION_EVENT_ACTION_DOWN : AMOTION_EVENT_ACTION_UP; } else { motionEventAction = AMOTION_EVENT_ACTION_MOVE; } else if (mAccumulator.btnScrollDown && scrollChanged && mLocked.down) { bool scrollChanged = fields & Accumulator::FIELD_REL_WHEEL; if (mAccumulator.btnScrollUp && scrollChanged) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_DOWN, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x58/*Keycode for previous key*/, 0x29 /*Scancode*/, 0x5c/*Keycode for page up key*/, 0x24 /*Scancode*/, mContext->getGlobalMetaState(), when); getDispatcher()->notifyKey(when, getDeviceId(), getDispatcher()->notifyKey(when + (10 * 1000000LL), getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x58/*Keycode for previous key*/, 0x29 /*Scancode*/, mContext->getGlobalMetaState(), when); 0x5c/*Keycode for page up key*/, 0x24 /*Scancode*/, mContext->getGlobalMetaState(), when + (10 * 1000000LL)); } else if (mAccumulator.btnScrollDown && scrollChanged) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_DOWN, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x14/*Keycode for down key*/, 0x25 /*Scancode*/, 0x5d/*Keycode for page down key*/, 0x25 /*Scancode*/, mContext->getGlobalMetaState(), when); getDispatcher()->notifyKey(when, getDeviceId(), getDispatcher()->notifyKey(when + (10 * 1000000LL), getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x14/*Keycode for down key*/, 0x25 /*Scancode*/, mContext->getGlobalMetaState(), when); 0x5d/*Keycode for page down key*/, 0x25 /*Scancode*/, mContext->getGlobalMetaState(), when + (10 * 1000000LL)); } downTime = mLocked.downTime; Loading Loading
core/java/com/android/internal/widget/MousePointerView.java +79 −1 Original line number Diff line number Diff line Loading @@ -16,10 +16,13 @@ package com.android.internal.widget; import android.app.Instrumentation; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; import android.os.SystemClock; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; Loading Loading @@ -47,7 +50,7 @@ public class MousePointerView extends View { if (mouseX == 0 && mouseY == 0) { } else if ((lastX == 0 && lastY == 0) || lastX - mouseX < 10.0f || lastY - mouseY < 10.0f) { // Draw mouse pointer // Draw mouse cursor mPath.rewind(); mPath.moveTo(mouseX, mouseY); mPath.lineTo(mouseX + 12.0f, mouseY + 12.0f); Loading @@ -69,6 +72,54 @@ public class MousePointerView extends View { } } private void mouseScrollUp() { long downTime = SystemClock.uptimeMillis(); long eventTime = SystemClock.uptimeMillis(); Instrumentation inst = new Instrumentation(); MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, mouseX, mouseY, 0); inst.sendPointerSync(event); eventTime = SystemClock.uptimeMillis(); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY + 5.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY + 10.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY + 15.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY + 25.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY + 35.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY + 45.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, mouseX, mouseY + 60.0f, 0); inst.sendPointerSync(event); } private void mouseScrollDown() { long downTime = SystemClock.uptimeMillis(); long eventTime = SystemClock.uptimeMillis(); Instrumentation inst = new Instrumentation(); MotionEvent event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, mouseX, mouseY, 0); inst.sendPointerSync(event); eventTime = SystemClock.uptimeMillis(); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY - 5.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY - 10.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY - 15.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY - 25.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY - 35.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_MOVE, mouseX, mouseY - 45.0f, 0); inst.sendPointerSync(event); event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_UP, mouseX, mouseY - 60.0f, 0); inst.sendPointerSync(event); } public void addTouchEvent(MotionEvent event) { lastX = mouseX; lastY = mouseY; Loading @@ -77,9 +128,36 @@ public class MousePointerView extends View { postInvalidate(); } public void addKeyEvent(KeyEvent event) { if (event.getKeyCode() == 0x5c) { mouseScrollUp(); } else if (event.getKeyCode() == 0x5d) { mouseScrollDown(); } postInvalidate(); } @Override public boolean onTouchEvent(MotionEvent event) { addTouchEvent(event); return true; } @Override public boolean onTrackballEvent(MotionEvent event) { return super.onTrackballEvent(event); } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { addKeyEvent(event); return true; } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { return true; } }
libs/ui/InputReader.cpp +27 −84 Original line number Diff line number Diff line Loading @@ -3338,29 +3338,7 @@ void MouseInputMapper::sync(nsecs_t when) { { // acquire lock AutoMutex _l(mLock); bool downChanged = fields & Accumulator::FIELD_BTN_MOUSE; if (downChanged) { if (mAccumulator.btnMouse) { mLocked.down = true; mLocked.downTime = when; } else { mLocked.down = false; } motionEventAction = mLocked.down ? AMOTION_EVENT_ACTION_DOWN : AMOTION_EVENT_ACTION_UP; } else { motionEventAction = AMOTION_EVENT_ACTION_MOVE; } if (fields & Accumulator::FIELD_BTN_RIGHT && mLocked.down) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnRight ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x03/*Keycode for home*/, 0x20 /*Scancode*/, mContext->getGlobalMetaState(), when); } else if (fields & Accumulator::FIELD_BTN_RIGHT) { if (fields & Accumulator::FIELD_BTN_RIGHT) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnRight ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, Loading @@ -3369,15 +3347,7 @@ void MouseInputMapper::sync(nsecs_t when) { mContext->getGlobalMetaState(), when); } if (fields & Accumulator::FIELD_BTN_MIDDLE && mLocked.down) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnMiddle ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x42/*Keycode for enter key*/, 0x27 /*Scancode*/, mContext->getGlobalMetaState(), when); } else if (fields & Accumulator::FIELD_BTN_MIDDLE) { if (fields & Accumulator::FIELD_BTN_MIDDLE) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnMiddle ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, Loading @@ -3386,15 +3356,7 @@ void MouseInputMapper::sync(nsecs_t when) { mContext->getGlobalMetaState(), when); } if (fields & Accumulator::FIELD_BTN_SIDE && mLocked.down) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnSide ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x16 /*Keycode for right key*/, 0x30 /*Scancode*/, mContext->getGlobalMetaState(), when); } else if (fields & Accumulator::FIELD_BTN_SIDE) { if (fields & Accumulator::FIELD_BTN_SIDE) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnSide ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, Loading @@ -3403,20 +3365,12 @@ void MouseInputMapper::sync(nsecs_t when) { mContext->getGlobalMetaState(), when); } if (fields & Accumulator::FIELD_BTN_EXTRA && mLocked.down) { if (fields & Accumulator::FIELD_BTN_EXTRA) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnExtra ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x15 /*Keycode for left key*/, 0x31 /*Scancode*/, mContext->getGlobalMetaState(), when); } else if (fields & Accumulator::FIELD_BTN_EXTRA) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, mAccumulator.btnExtra ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x42/*Keycode for enter key*/, 0x27 /*Scancode*/, 0x54/*Keycode for search key*/, 0x21 /*Scancode*/, mContext->getGlobalMetaState(), when); } Loading @@ -3438,54 +3392,43 @@ void MouseInputMapper::sync(nsecs_t when) { mContext->getGlobalMetaState(), when); } bool scrollChanged = fields & Accumulator::FIELD_REL_WHEEL; if (mAccumulator.btnScrollUp && scrollChanged && mLocked.down) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_DOWN, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x57/*Keycode for next key*/, 0x28 /*Scancode*/, mContext->getGlobalMetaState(), when); getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x57/*Keycode for next key*/, 0x28 /*Scancode*/, mContext->getGlobalMetaState(), when); bool downChanged = fields & Accumulator::FIELD_BTN_MOUSE; if (downChanged) { if (mAccumulator.btnMouse) { mLocked.down = true; mLocked.downTime = when; } else { mLocked.down = false; } else if (mAccumulator.btnScrollUp && scrollChanged) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_DOWN, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x13/*Keycode for up key*/, 0x24 /*Scancode*/, mContext->getGlobalMetaState(), when); getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x13/*Keycode for up key*/, 0x24 /*Scancode*/, mContext->getGlobalMetaState(), when); motionEventAction = mLocked.down ? AMOTION_EVENT_ACTION_DOWN : AMOTION_EVENT_ACTION_UP; } else { motionEventAction = AMOTION_EVENT_ACTION_MOVE; } else if (mAccumulator.btnScrollDown && scrollChanged && mLocked.down) { bool scrollChanged = fields & Accumulator::FIELD_REL_WHEEL; if (mAccumulator.btnScrollUp && scrollChanged) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_DOWN, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x58/*Keycode for previous key*/, 0x29 /*Scancode*/, 0x5c/*Keycode for page up key*/, 0x24 /*Scancode*/, mContext->getGlobalMetaState(), when); getDispatcher()->notifyKey(when, getDeviceId(), getDispatcher()->notifyKey(when + (10 * 1000000LL), getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x58/*Keycode for previous key*/, 0x29 /*Scancode*/, mContext->getGlobalMetaState(), when); 0x5c/*Keycode for page up key*/, 0x24 /*Scancode*/, mContext->getGlobalMetaState(), when + (10 * 1000000LL)); } else if (mAccumulator.btnScrollDown && scrollChanged) { getDispatcher()->notifyKey(when, getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_DOWN, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x14/*Keycode for down key*/, 0x25 /*Scancode*/, 0x5d/*Keycode for page down key*/, 0x25 /*Scancode*/, mContext->getGlobalMetaState(), when); getDispatcher()->notifyKey(when, getDeviceId(), getDispatcher()->notifyKey(when + (10 * 1000000LL), getDeviceId(), AINPUT_SOURCE_DPAD, 0, AKEY_EVENT_ACTION_UP, AKEY_EVENT_FLAG_FROM_SYSTEM, 0x14/*Keycode for down key*/, 0x25 /*Scancode*/, mContext->getGlobalMetaState(), when); 0x5d/*Keycode for page down key*/, 0x25 /*Scancode*/, mContext->getGlobalMetaState(), when + (10 * 1000000LL)); } downTime = mLocked.downTime; Loading