在一些系统开发中(例如机顶盒)有可能遇到需求不响应鼠标按键,在开发中怎么解决呢?下面我来给大家演示:
1.系统中按键的响应都是通过在ViewRootImpl中传递给View的,所以要想屏蔽按键就要在ViewRootImpl.java中寻找;
2.在setView中sWindowSession.add(mWindow, mSeq, mWindowAttributes,getHostVisibility(), mAttachInfo.mContentInsets,mInputChannel);建立View与WMS的联系这样WMS就能把消息传递给View了,但是怎么传递的呢?答案是:mInputChannel.
注册:
if (mInputChannel != null) {
if (mInputQueueCallback != null) {
mInputQueue = new InputQueue(mInputChannel);
mInputQueueCallback.onInputQueueCreated(mInputQueue);
} else {
InputQueue.registerInputChannel(mInputChannel, mInputHandler,
Looper.myQueue());