Double click 转成power之后的上报
2016-03-17 16:27
246 查看
首先来到了
void KeyboardInputMapper::process(const RawEvent* rawEvent) {
switch (rawEvent->type) {
case EV_KEY: {
int32_t scanCode = rawEvent->code;
int32_t usageCode = mCurrentHidUsage;
mCurrentHidUsage = 0;
ALOGD("matt-KeyboardInputMapper::process-scanCode=%d ,%d ",scanCode,usageCode);
if (isKeyboardOrGamepadKey(scanCode)) { //双击灭屏的时候过不了这一关,所以双击灭屏是更上层做的
processKey(rawEvent->when, rawEvent->value != 0, scanCode, usageCode);
}
break;
}
}
status_t KeyLayoutMap::mapKey(int32_t scanCode, int32_t usageCode,
int32_t* outKeyCode, uint32_t* outFlags) const {
ALOGD("matt-mapKey11: scanCode=%d, usageCode=0x%08x ~ Result keyCode=%d, outFlags=0x%08x.",
scanCode, usageCode, *outKeyCode, *outFlags);
const Key* key = getKey(scanCode, usageCode);
if (!key) {
#if DEBUG_MAPPING
ALOGD("matt-mapKey: scanCode=%d, usageCode=0x%08x ~ Failed.", scanCode, usageCode);
#endif
*outKeyCode = AKEYCODE_UNKNOWN;
*outFlags = 0;
return NAME_NOT_FOUND;
}
ALOGD("matt-mapKey: key->keyCode=%d ", key->keyCode);
*outKeyCode = key->keyCode;
*outFlags = key->flags;
#if DEBUG_MAPPING
ALOGD("matt-mapKey: scanCode=%d, usageCode=0x%08x ~ Result keyCode=%d, outFlags=0x%08x.",
scanCode, usageCode, *outKeyCode, *outFlags);
#endif
return NO_ERROR;
}
const KeyLayoutMap::Key* KeyLayoutMap::getKey(int32_t scanCode, int32_t usageCode) const {
if (usageCode) {
ssize_t index = mKeysByUsageCode.indexOfKey(usageCode);
if (index >= 0) {
return &mKeysByUsageCode.valueAt(index);
}
}
if (scanCode) {
ssize_t index = mKeysByScanCode.indexOfKey(scanCode); //这里有妖额子
ALOGD("matt-mapKey: index=%d",index); //最奇怪的就是同样的进来,却是不同的结果
if (index >= 0) {
return &mKeysByScanCode.valueAt(index);
}
}
return NULL;
}
双击之后的log:
01-01 10:57:47.389 1687 2444 D InputReader: matt-KeyboardInputMapper::process-scanCode=116 ,0
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey1
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey11: scanCode=116, usageCode=0x00000000 ~ Result keyCode=0, outFlags=0x00000055.
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey: index=7
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey: key->keyCode=820
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey: scanCode=116, usageCode=0x00000000 ~ Result keyCode=820, outFlags=0x00000003.
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey2
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey3
01-01 10:57:47.390 1687 2444 D InputReader: matt-processKey keyCode=820
01-01 10:57:47.390 1687 2444 D InputReader: matt-processKey keyCode2=820
01-01 10:57:47.390 1687 2444 D InputReader: matt-KeyboardInputMapper::process-scanCode=116 ,0
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey1
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey11: scanCode=116, usageCode=0x00000000 ~ Result keyCode=0, outFlags=0x00000055.
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey: index=7
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey: key->keyCode=820
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey: scanCode=116, usageCode=0x00000000 ~ Result keyCode=820, outFlags=0x00000003.
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey2
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey3
01-01 10:57:47.390 1687 2444 D InputReader: matt-processKey keyCode=820
01-01 10:57:47.390 1687 2444 D InputReader: matt-processKey keyCode4-=820
01-01 10:57:47.390 1687 2444 D InputReader: matt-processKey keyCode4=820
按下真正的power key的log:
01-01 10:58:21.011 1687 2444 D InputReader: matt-KeyboardInputMapper::process-scanCode=116 ,0
01-01 10:58:21.011 1687 2444 D EventHub: matt- EventHub::mapKey
01-01 10:58:21.011 1687 2444 D EventHub: matt- EventHub::mapKey1
01-01 10:58:21.011 1687 2444 D KeyLayoutMap: matt-mapKey11: scanCode=116, usageCode=0x00000000 ~ Result keyCode=0, outFlags=0x00000055.
01-01 10:58:21.011 1687 2444 D KeyLayoutMap: matt-mapKey: index=110
01-01 10:58:21.011 1687 2444 D KeyLayoutMap: matt-mapKey: key->keyCode=26
01-01 10:58:21.011 1687 2444 D KeyLayoutMap: matt-mapKey: scanCode=116, usageCode=0x00000000 ~ Result keyCode=26, outFlags=0x00000000.
01-01 10:58:21.011 1687 2444 D EventHub: matt- EventHub::mapKey2
01-01 10:58:21.011 1687 2444 D EventHub: matt- EventHub::mapKey3
01-01 10:58:21.011 1687 2444 D InputReader: matt-processKey keyCode=26
01-01 10:58:21.011 1687 2444 D InputReader: matt-processKey keyCode2=26
01-01 10:58:21.128 1687 2444 D InputReader: matt-KeyboardInputMapper::process-scanCode=116 ,0
01-01 10:58:21.128 1687 2444 D EventHub: matt- EventHub::mapKey
01-01 10:58:21.128 1687 2444 D EventHub: matt- EventHub::mapKey1
01-01 10:58:21.128 1687 2444 D KeyLayoutMap: matt-mapKey11: scanCode=116, usageCode=0x00000000 ~ Result keyCode=0, outFlags=0x00000055.
01-01 10:58:21.128 1687 2444 D KeyLayoutMap: matt-mapKey: index=110
01-01 10:58:21.128 1687 2444 D KeyLayoutMap: matt-mapKey: key->keyCode=26
01-01 10:58:21.128 1687 2444 D KeyLayoutMap: matt-mapKey: scanCode=116, usageCode=0x00000000 ~ Result keyCode=26, outFlags=0x00000000.
01-01 10:58:21.128 1687 2444 D EventHub: matt- EventHub::mapKey2
01-01 10:58:21.128 1687 2444 D EventHub: matt- EventHub::mapKey3
01-01 10:58:21.128 1687 2444 D InputReader: matt-processKey keyCode=26
01-01 10:58:21.128 1687 2444 D InputReader: matt-processKey keyCode4-=26
01-01 10:58:21.128 1687 2444 D InputReader: matt-processKey keyCode4=26
哪怕到了inputdispatch里还算不同的keycode,到mLooper->wake();为止都是
void KeyboardInputMapper::process(const RawEvent* rawEvent) {
switch (rawEvent->type) {
case EV_KEY: {
int32_t scanCode = rawEvent->code;
int32_t usageCode = mCurrentHidUsage;
mCurrentHidUsage = 0;
ALOGD("matt-KeyboardInputMapper::process-scanCode=%d ,%d ",scanCode,usageCode);
if (isKeyboardOrGamepadKey(scanCode)) { //双击灭屏的时候过不了这一关,所以双击灭屏是更上层做的
processKey(rawEvent->when, rawEvent->value != 0, scanCode, usageCode);
}
break;
}
}
status_t KeyLayoutMap::mapKey(int32_t scanCode, int32_t usageCode,
int32_t* outKeyCode, uint32_t* outFlags) const {
ALOGD("matt-mapKey11: scanCode=%d, usageCode=0x%08x ~ Result keyCode=%d, outFlags=0x%08x.",
scanCode, usageCode, *outKeyCode, *outFlags);
const Key* key = getKey(scanCode, usageCode);
if (!key) {
#if DEBUG_MAPPING
ALOGD("matt-mapKey: scanCode=%d, usageCode=0x%08x ~ Failed.", scanCode, usageCode);
#endif
*outKeyCode = AKEYCODE_UNKNOWN;
*outFlags = 0;
return NAME_NOT_FOUND;
}
ALOGD("matt-mapKey: key->keyCode=%d ", key->keyCode);
*outKeyCode = key->keyCode;
*outFlags = key->flags;
#if DEBUG_MAPPING
ALOGD("matt-mapKey: scanCode=%d, usageCode=0x%08x ~ Result keyCode=%d, outFlags=0x%08x.",
scanCode, usageCode, *outKeyCode, *outFlags);
#endif
return NO_ERROR;
}
const KeyLayoutMap::Key* KeyLayoutMap::getKey(int32_t scanCode, int32_t usageCode) const {
if (usageCode) {
ssize_t index = mKeysByUsageCode.indexOfKey(usageCode);
if (index >= 0) {
return &mKeysByUsageCode.valueAt(index);
}
}
if (scanCode) {
ssize_t index = mKeysByScanCode.indexOfKey(scanCode); //这里有妖额子
ALOGD("matt-mapKey: index=%d",index); //最奇怪的就是同样的进来,却是不同的结果
if (index >= 0) {
return &mKeysByScanCode.valueAt(index);
}
}
return NULL;
}
双击之后的log:
01-01 10:57:47.389 1687 2444 D InputReader: matt-KeyboardInputMapper::process-scanCode=116 ,0
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey1
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey11: scanCode=116, usageCode=0x00000000 ~ Result keyCode=0, outFlags=0x00000055.
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey: index=7
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey: key->keyCode=820
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey: scanCode=116, usageCode=0x00000000 ~ Result keyCode=820, outFlags=0x00000003.
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey2
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey3
01-01 10:57:47.390 1687 2444 D InputReader: matt-processKey keyCode=820
01-01 10:57:47.390 1687 2444 D InputReader: matt-processKey keyCode2=820
01-01 10:57:47.390 1687 2444 D InputReader: matt-KeyboardInputMapper::process-scanCode=116 ,0
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey1
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey11: scanCode=116, usageCode=0x00000000 ~ Result keyCode=0, outFlags=0x00000055.
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey: index=7
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey: key->keyCode=820
01-01 10:57:47.390 1687 2444 D KeyLayoutMap: matt-mapKey: scanCode=116, usageCode=0x00000000 ~ Result keyCode=820, outFlags=0x00000003.
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey2
01-01 10:57:47.390 1687 2444 D EventHub: matt- EventHub::mapKey3
01-01 10:57:47.390 1687 2444 D InputReader: matt-processKey keyCode=820
01-01 10:57:47.390 1687 2444 D InputReader: matt-processKey keyCode4-=820
01-01 10:57:47.390 1687 2444 D InputReader: matt-processKey keyCode4=820
按下真正的power key的log:
01-01 10:58:21.011 1687 2444 D InputReader: matt-KeyboardInputMapper::process-scanCode=116 ,0
01-01 10:58:21.011 1687 2444 D EventHub: matt- EventHub::mapKey
01-01 10:58:21.011 1687 2444 D EventHub: matt- EventHub::mapKey1
01-01 10:58:21.011 1687 2444 D KeyLayoutMap: matt-mapKey11: scanCode=116, usageCode=0x00000000 ~ Result keyCode=0, outFlags=0x00000055.
01-01 10:58:21.011 1687 2444 D KeyLayoutMap: matt-mapKey: index=110
01-01 10:58:21.011 1687 2444 D KeyLayoutMap: matt-mapKey: key->keyCode=26
01-01 10:58:21.011 1687 2444 D KeyLayoutMap: matt-mapKey: scanCode=116, usageCode=0x00000000 ~ Result keyCode=26, outFlags=0x00000000.
01-01 10:58:21.011 1687 2444 D EventHub: matt- EventHub::mapKey2
01-01 10:58:21.011 1687 2444 D EventHub: matt- EventHub::mapKey3
01-01 10:58:21.011 1687 2444 D InputReader: matt-processKey keyCode=26
01-01 10:58:21.011 1687 2444 D InputReader: matt-processKey keyCode2=26
01-01 10:58:21.128 1687 2444 D InputReader: matt-KeyboardInputMapper::process-scanCode=116 ,0
01-01 10:58:21.128 1687 2444 D EventHub: matt- EventHub::mapKey
01-01 10:58:21.128 1687 2444 D EventHub: matt- EventHub::mapKey1
01-01 10:58:21.128 1687 2444 D KeyLayoutMap: matt-mapKey11: scanCode=116, usageCode=0x00000000 ~ Result keyCode=0, outFlags=0x00000055.
01-01 10:58:21.128 1687 2444 D KeyLayoutMap: matt-mapKey: index=110
01-01 10:58:21.128 1687 2444 D KeyLayoutMap: matt-mapKey: key->keyCode=26
01-01 10:58:21.128 1687 2444 D KeyLayoutMap: matt-mapKey: scanCode=116, usageCode=0x00000000 ~ Result keyCode=26, outFlags=0x00000000.
01-01 10:58:21.128 1687 2444 D EventHub: matt- EventHub::mapKey2
01-01 10:58:21.128 1687 2444 D EventHub: matt- EventHub::mapKey3
01-01 10:58:21.128 1687 2444 D InputReader: matt-processKey keyCode=26
01-01 10:58:21.128 1687 2444 D InputReader: matt-processKey keyCode4-=26
01-01 10:58:21.128 1687 2444 D InputReader: matt-processKey keyCode4=26
哪怕到了inputdispatch里还算不同的keycode,到mLooper->wake();为止都是
相关文章推荐
- poj1328 radar installation
- Java循环基础
- do { x } while (__LINE__ == -1)
- 计算前50个素数
- [leetcode] @python 115. Distinct Subsequences
- .net4.0调用非托管DLL的异常捕获
- sed 递归替换
- 学习英语
- 【编程工具】MyEclipse中的常用快捷键
- spring mvc3 静态文件放在WEB-INF下无法访问解决和解决@Controller失效问题
- python 刷题:实现队列
- Servlet映射的匹配原则,优先级
- uva 10954 add all
- IOS-57-导致内存未释放的常见原因(现象:dealloc不执行等)
- 牛顿下山法
- BB-Black: 如何擦除emmc里的内容?
- nginx tomcat 负载均衡
- 学习之spring属性文件注入
- Java流操作之转换流
- NOSQL的学习