本文主要是介绍gt9xx系列------实现实体按键的unpin解锁,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
由于gt的虚拟按键的上报不是上报坐标而是类似电源按键的实体按键所以需要修改之前的unpin步骤
if ((( rawEvent->code==139)&&(rawEvent->value==1))||((rawEvent->code==158)&&(rawEvent->value==1))) //有按键按下
{
if( unpinkey[0]==0) //第一次数组0肯定为空,先存一个
{
ALOGD("matt-1 ");
unpinkey[0]=rawEvent->code;
}else //第二步肯定是按键抬起或者按键按下,如果是按下,则存入第二个数组
{
ALOGD("matt-2");
unpinkey[1]=rawEvent->code;
}
}
ALOGD("matt-rawEvent->value+1=%d ",rawEvent->value);
if ((( rawEvent->code==139)&&(rawEvent->value==0))||((rawEvent->code==158)&&(rawEvent->value==0))) //有按键抬起则清除之前存的数组中的按键
{
if( unpinkey[0]==rawEvent->code)
{
ALOGD("matt-3");
unpinkey[0]=0;
}else
{
ALOGD("matt-4");
unpinkey[1]=0;
}
}
//ALOGD("matt-unpinkey[0]->code=%d ,unpinkey[1]->code=%d,unpinkey[1]->value=%d,unpinkey[1]->value=%d",unpinkey[0]->code,unpinkey[0]->value,unpinkey[1]->code,unpinkey[1]->value);
if((unpinkey[1]!=0)&&(unpinkey[0]!=0))
{
ALOGD("matt-5");
for( ii=0;ii<2;ii++)
{
if(unpinkey[ii]==139)
{
scanCode=unpinkey[ii];
scanCodechange=187;
}else
{
scanCode=unpinkey[ii];
scanCodechange=4;
}
NotifyKeyArgs args(rawEvent->when, getDeviceId(), AINPUT_SOURCE_KEYBOARD, 2,0, 72, scanCodechange, scanCode, 0, rawEvent->when);
getListener()->notifyKey(&args);
// processKey(rawEvent->when, 1, unpinkey[ii], 0);
}
ALOGD("matt-6");
if(ii >= 2) screen_unpin = true;
else screen_unpin = false;
}
if (screen_unpin&&(rawEvent->value==0))
{
ALOGD("matt-7");
if((rawEvent->code == 139)||(rawEvent->code == 158))
{
ALOGD("matt-8");
screen_unpin = false;
int current_keycode = 0;
int current_scancode = 0;
current_keycode = rawEvent->code;
if(current_keycode == 139)
{
ALOGD("matt-9");
processKey(rawEvent->when, 1, 158, 0);
}
else
{
ALOGD("matt-10");
processKey(rawEvent->when, 1, 139, 0);
}
}
}
//matthew_xuan
if (isKeyboardOrGamepadKey(scanCode)) {
#if DEBUG_VIRTUAL_KEYS_FT
ALOGD("KeyboardInputMapper::process: usageCode=%d, scanCode=%d",usageCode, scanCode);
#endif
processKey(rawEvent->when, rawEvent->value != 0, scanCode, usageCode);
}
这篇关于gt9xx系列------实现实体按键的unpin解锁的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!