WindowManagerService.java (base\services\java\com\android\server)中的按键分发线程 private void process() 中有这段代码(问题在代码中)
else if (lastKey != null) //这个lastkey是什么意思,找不到解释,是消息队列中的上一个按键吗?
{
curTime = SystemClock.uptimeMillis();//获取的什么时间 // Timeout occurred while key was down. If it is at or
// past the key repeat time, dispatch the repeat.
if (DEBUG_INPUT) Slog.v(
TAG, "Key timeout: repeat=" + nextKeyTime
+ ", now=" + curTime);
if (curTime < nextKeyTime) //什么意思
{
continue;
} lastKeyTime = nextKeyTime;
nextKeyTime = nextKeyTime + KEY_REPEAT_DELAY;
keyRepeatCount++;
if (DEBUG_INPUT) Slog.v(
TAG, "Key repeat: count=" + keyRepeatCount
+ ", next @ " + nextKeyTime);
KeyEvent newEvent;
if (downTime != 0 && (downTime
+ ViewConfiguration.getLongPressTimeout())
<= curTime) //该分支怎么理解
{
newEvent = KeyEvent.changeTimeRepeat(lastKey,
curTime, keyRepeatCount,
lastKey.getFlags() | KeyEvent.FLAG_LONG_PRESS);
downTime = 0;
} else {
newEvent = KeyEvent.changeTimeRepeat(lastKey,
curTime, keyRepeatCount);
}
// dispatchKey(newEvent, 0, 0);//按键事件分发给谁了?
最好能解释一下QueuedEvent和KeyEvent不胜感激!!!问题有点多
else if (lastKey != null) //这个lastkey是什么意思,找不到解释,是消息队列中的上一个按键吗?
{
curTime = SystemClock.uptimeMillis();//获取的什么时间 // Timeout occurred while key was down. If it is at or
// past the key repeat time, dispatch the repeat.
if (DEBUG_INPUT) Slog.v(
TAG, "Key timeout: repeat=" + nextKeyTime
+ ", now=" + curTime);
if (curTime < nextKeyTime) //什么意思
{
continue;
} lastKeyTime = nextKeyTime;
nextKeyTime = nextKeyTime + KEY_REPEAT_DELAY;
keyRepeatCount++;
if (DEBUG_INPUT) Slog.v(
TAG, "Key repeat: count=" + keyRepeatCount
+ ", next @ " + nextKeyTime);
KeyEvent newEvent;
if (downTime != 0 && (downTime
+ ViewConfiguration.getLongPressTimeout())
<= curTime) //该分支怎么理解
{
newEvent = KeyEvent.changeTimeRepeat(lastKey,
curTime, keyRepeatCount,
lastKey.getFlags() | KeyEvent.FLAG_LONG_PRESS);
downTime = 0;
} else {
newEvent = KeyEvent.changeTimeRepeat(lastKey,
curTime, keyRepeatCount);
}
// dispatchKey(newEvent, 0, 0);//按键事件分发给谁了?
最好能解释一下QueuedEvent和KeyEvent不胜感激!!!问题有点多
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货