首先是
void TouchInputMapper::process(const RawEvent* rawEvent) {
if (rawEvent->type == EV_SYN && rawEvent->code == SYN_REPORT) {
ALOGD("matt- TouchInputMapper::process ");
sync(rawEvent->when);
}
}
然后是
void TouchInputMapper::sync(nsecs_t when) {
ALOGD("matt- TouchInputMapper::sync ");
processRawTouches(false /*timeout*/);
}
之后是
oid TouchInputMapper::processRawTouches(bool timeout) {
ALOGD("matt-processRawTouches");
cookAndDispatch(mCurrentRawState.when);
}
到了
void TouchInputMapper::cookAndDispatch(nsecs_t when) {
// Always start with a clean state.
mCurrentCookedState.clear();
ALOGD("matt-cookAndDispatch");
if (consumeRawTouches(when, policyFlags)) {
mCurrentRawState.rawPointerData.clear();
}
}
之后是
bool TouchInputMapper::consumeRawTouches(nsecs_t when, uint32_t policyFlags) {
// Check for release of a virtual key.
if (mCurrentVirtualKey.down) {
if (mCurrentRawState.rawPointerData.touchingIdBits.isEmpty()) {
// Pointer went up while virtual key was down.
mCurrentVirtualKey.down = false;
if (!mCurrentVirtualKey.ignored) {
#if DEBUG_VIRTUAL_KEYS
ALOGD("matt-VirtualKeys: Generating key up: keyCode=%d, scanCode=%d",
mCurrentVirtualKey.keyCode, mCurrentVirtualKey.scanCode);
#endif
然后是
void TouchInputMapper::dispatchVirtualKey(nsecs_t when, uint32_t policyFlags,
int32_t keyEventAction, int32_t keyEventFlags) {
int32_t keyCode = mCurrentVirtualKey.keyCode;
int32_t scanCode = mCurrentVirtualKey.scanCode;
nsecs_t downTime = mCurrentVirtualKey.downTime;
int32_t metaState = mContext->getGlobalMetaState();
policyFlags |= POLICY_FLAG_VIRTUAL;
NotifyKeyArgs args(when, getDeviceId(), AINPUT_SOURCE_KEYBOARD, policyFlags,
keyEventAction, keyEventFlags, keyCode, scanCode, metaState, downTime);
ALOGD("matt- getListener()->notifyKey(&args)1" );
getListener()->notifyKey(&args);
}
然后到了inputdispacher.cpp
void InputDispatcher::notifyKey(const NotifyKeyArgs* args) {
//#if DEBUG_INBOUND_EVENT_DETAILS
ALOGD("notifyKey - eventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, action=0x%x, "
"flags=0x%x, keyCode=0x%x, scanCode=0x%x, metaState=0x%x, downTime=%lld",
args->eventTime, args->deviceId, args->source, args->policyFlags,
args->action, args->flags, args->keyCode, args->scanCode,
args->metaState, args->downTime);
//#endif