河南省建设厅电话号码是多少,seo技术代理,加速wordpress 插件,东莞网站平台费用需求 #xff1a; tv上部分app不支持光标选中#xff0c;如亚马逊#xff0c;插上鼠标不方便#xff0c;即可以用遥控器模拟鼠标滚动和点击 1.拦截上下左右键
在WMS::PhoneWindowManager::interceptKeyBeforeQueueing中监听上下左右左右键#xff0c;进行拦截。
Overrid… 需求 tv上部分app不支持光标选中如亚马逊插上鼠标不方便即可以用遥控器模拟鼠标滚动和点击 1.拦截上下左右键
在WMS::PhoneWindowManager::interceptKeyBeforeQueueing中监听上下左右左右键进行拦截。
Overridepublic long interceptKeyBeforeDispatching(WindowState win, KeyEvent event, int policyFlags) {//是否开启鼠标模式String mstate SystemProperties.get(sys.KeyMouse.mKeyMouseState);//是否开启鼠标滚轮模式String mMode SystemProperties.get(sys.mouse.mousemode1);if (mstate.equals(on) ((keyCode KeyEvent.KEYCODE_DPAD_LEFT)|| (keyCode KeyEvent.KEYCODE_DPAD_RIGHT)|| (keyCode KeyEvent.KEYCODE_DPAD_UP)|| (keyCode KeyEvent.KEYCODE_DPAD_DOWN))) {if(down){if (mMode.equals(false)) {try{// 显示鼠标键mWindowManager.dispatchMouse(0,0);}catch(Exception e){}} else {Message msg new Message();msg.what keyCode;Bundle bundle new Bundle();bundle.putInt(repeatCount, repeatCount);msg.setData(bundle);mKeyMouseHandler.sendMessage(msg);}}return -1;}
}public Handler mKeyMouseHandler new Handler(){public void handleMessage(Message msg){Bundle bundle msg.getData();int repeatNum bundle.getInt(repeatCount);switch(msg.what){case KeyEvent.KEYCODE_DPAD_LEFT:if(repeatNum0){//移动的距离mdeltax-16.0f;mdeltay0;}else{mdeltax-8.0f;mdeltay0;}break;case KeyEvent.KEYCODE_DPAD_RIGHT://移动的距离if(repeatNum0){mdeltax16.0f;mdeltay0;}else{mdeltax8.0f;mdeltay0;}break;case KeyEvent.KEYCODE_DPAD_UP://移动的距离if(repeatNum0){mdeltax0;mdeltay-16.0f;}else{mdeltax0;mdeltay-8.0f;}break;case KeyEvent.KEYCODE_DPAD_DOWN://移动的距离if(repeatNum0){mdeltax0;mdeltay16.0f;}else{mdeltax0;mdeltay8.0f;}break;case KeyEvent.KEYCODE_MOUSE_SWITCH://位置不变重新显示mdeltax0;mdeltay0;break; }try{mWindowManager.dispatchMouse(mdeltax,mdeltay);}catch(Exception e){}}};
2.调整鼠标滚动逻辑 如果只需要鼠标上下移动上述修改即可鼠标移动到屏幕周围会自动切为滚动模式但是如果部分app上下有部分导航栏即需要主动将鼠标切为滚轮模式。 修改位置 frameworks/native/services/inputflinger/InputReader.cpp
void KeyMouseInputMapper::sync(nsecs_t when) {int32_t lastButtonState mButtonState;int32_t currentButtonState mCursorButtonAccumulator.getButtonState();mButtonState currentButtonState;char *mKeyLocknew char[PROPERTY_VALUE_MAX];memset(mKeyLock,0,5);property_get(sys.KeyMouse.mKeyMouseState,mKeyLock,off);char *mousemodenew char[PROPERTY_VALUE_MAX];memset(mousemode,0,5);property_get(sys.mouse.mousemode1,mousemode,true);bool scrolled 0;float vscroll,hscroll;int32_t keystate AKEY_STATE_UNKNOWN;bool wasDown isPointerDown(lastButtonState);bool down isPointerDown(currentButtonState);keystate getScanCodeState(AINPUT_SOURCE_MOUSE,scrollkey);bool downChanged;if (!wasDown down) {mDownTime when;downChanged true;} else if (wasDown !down) {downChanged true;} else {downChanged false;}nsecs_t downTime mDownTime;//int32_t buttonsPressed0;//int32_t buttonsReleased0;int32_t buttonsPressed currentButtonState ~lastButtonState;int32_t buttonsReleased lastButtonState ~currentButtonState;if(strcmp(mKeyLock,off)0) return;PointerProperties pointerProperties;pointerProperties.clear();pointerProperties.id 0;pointerProperties.toolType AMOTION_EVENT_TOOL_TYPE_MOUSE;PointerCoords pointerCoords;pointerCoords.clear();int32_t displayId;if (mPointerController ! NULL) {float x, y;float minX, minY, maxX, maxY;mPointerController-getPosition(x, y);pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_X, x);pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, y);displayId ADISPLAY_ID_DEFAULT;//滚动模式后判断上下左右键即滚动if(strcmp(mousemode,false)0) {if(scrollkey KEY_LEFT){scrolled 1;vscroll 0;hscroll -3.0f;if(keystateAKEY_STATE_DOWN)buttonsPressed 1;elsebuttonsReleased 1;}else if(scrollkey KEY_UP){scrolled 1;vscroll 3.0f;hscroll 0;}else if(scrollkey KEY_RIGHT){scrolled 1;vscroll 0;hscroll 3.0f;if(keystateAKEY_STATE_DOWN)buttonsPressed 1;elsebuttonsReleased 1;}else if(scrollkey KEY_DOWN){scrolled 1;vscroll -3.0f;hscroll 0;}}else{if (mPointerController-getBounds(minX, minY, maxX, maxY)) {if((xminX)(scrollkey KEY_LEFT)){scrolled 1;vscroll 0;hscroll -3.0f;if(keystateAKEY_STATE_DOWN)buttonsPressed 1;elsebuttonsReleased 1;}else if((yminY)(scrollkey KEY_UP)){scrolled 1;vscroll 3.0f;hscroll 0;}else if((xmaxX)(scrollkey KEY_RIGHT)){scrolled 1;vscroll 0;hscroll 3.0f;if(keystateAKEY_STATE_DOWN)buttonsPressed 1;elsebuttonsReleased 1;}else if((ymaxY)(scrollkey KEY_DOWN)){scrolled 1;vscroll -3.0f;hscroll 0;}}}}uint32_t policyFlags 0;if ((buttonsPressed || scrolled) getDevice()-isExternal()) {policyFlags | POLICY_FLAG_WAKE;}mSource AINPUT_SOURCE_MOUSE;// Send motion event.if (downChanged || scrolled) {int32_t metaState mContext-getGlobalMetaState();int32_t buttonState lastButtonState;int32_t motionEventAction;if (downChanged) {motionEventAction down ? AMOTION_EVENT_ACTION_DOWN : AMOTION_EVENT_ACTION_UP;} else {motionEventAction AMOTION_EVENT_ACTION_MOVE;}if (buttonsReleased) {BitSet32 released(buttonsReleased);while (!released.isEmpty()) {int32_t actionButton BitSet32::valueForBit(released.clearFirstMarkedBit());buttonState ~actionButton;NotifyMotionArgs releaseArgs(when, getDeviceId(), mSource, policyFlags,AMOTION_EVENT_ACTION_BUTTON_RELEASE, actionButton, 0,metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE,displayId, /* deviceTimestamp */ 0, 1, pointerProperties, pointerCoords,1, 1, downTime);getListener()-notifyMotion(releaseArgs);buttonsReleased 0;}}NotifyMotionArgs args(when, getDeviceId(), mSource, policyFlags,motionEventAction, 0, 0,metaState, currentButtonState, AMOTION_EVENT_EDGE_FLAG_NONE,displayId, 0, 1, pointerProperties, pointerCoords, 1, 1, downTime);getListener()-notifyMotion(args);if (buttonsPressed) {BitSet32 pressed(buttonsPressed);while (!pressed.isEmpty()) {int32_t actionButton BitSet32::valueForBit(pressed.clearFirstMarkedBit());buttonState | actionButton;NotifyMotionArgs pressArgs(when, getDeviceId(), mSource, policyFlags,AMOTION_EVENT_ACTION_BUTTON_PRESS, actionButton, 0,metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE,displayId, /* deviceTimestamp */ 0, 1, pointerProperties, pointerCoords,1, 1, downTime);getListener()-notifyMotion(pressArgs);buttonsPressed 0;}}}if ((scrolled)(keystateAKEY_STATE_DOWN)) {pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_VSCROLL, vscroll);pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_HSCROLL, hscroll);int32_t metaState mContext-getGlobalMetaState();NotifyMotionArgs scrollArgs(when, getDeviceId(), mSource, policyFlags,AMOTION_EVENT_ACTION_SCROLL, 0, 0, metaState, currentButtonState,AMOTION_EVENT_EDGE_FLAG_NONE,displayId, /* deviceTimestamp */ 0, 1, pointerProperties, pointerCoords,1, 1, downTime);getListener()-notifyMotion(scrollArgs);}}
文章转载自: http://www.morning.ktcrr.cn.gov.cn.ktcrr.cn http://www.morning.wdjcr.cn.gov.cn.wdjcr.cn http://www.morning.nnhrp.cn.gov.cn.nnhrp.cn http://www.morning.fxjnn.cn.gov.cn.fxjnn.cn http://www.morning.tjmfz.cn.gov.cn.tjmfz.cn http://www.morning.hphrz.cn.gov.cn.hphrz.cn http://www.morning.wklmj.cn.gov.cn.wklmj.cn http://www.morning.qjldz.cn.gov.cn.qjldz.cn http://www.morning.rxkq.cn.gov.cn.rxkq.cn http://www.morning.gxeqedd.cn.gov.cn.gxeqedd.cn http://www.morning.httpm.cn.gov.cn.httpm.cn http://www.morning.bfycr.cn.gov.cn.bfycr.cn http://www.morning.gassnw.com.gov.cn.gassnw.com http://www.morning.rscrj.cn.gov.cn.rscrj.cn http://www.morning.tqbyw.cn.gov.cn.tqbyw.cn http://www.morning.knnhd.cn.gov.cn.knnhd.cn http://www.morning.kpgft.cn.gov.cn.kpgft.cn http://www.morning.yqqxj26.cn.gov.cn.yqqxj26.cn http://www.morning.byywt.cn.gov.cn.byywt.cn http://www.morning.gqryh.cn.gov.cn.gqryh.cn http://www.morning.ldcrh.cn.gov.cn.ldcrh.cn http://www.morning.zlcsz.cn.gov.cn.zlcsz.cn http://www.morning.sqxr.cn.gov.cn.sqxr.cn http://www.morning.lddpj.cn.gov.cn.lddpj.cn http://www.morning.ghyfm.cn.gov.cn.ghyfm.cn http://www.morning.fllfc.cn.gov.cn.fllfc.cn http://www.morning.krwzy.cn.gov.cn.krwzy.cn http://www.morning.qphdp.cn.gov.cn.qphdp.cn http://www.morning.zxqxx.cn.gov.cn.zxqxx.cn http://www.morning.cjsnj.cn.gov.cn.cjsnj.cn http://www.morning.ljngm.cn.gov.cn.ljngm.cn http://www.morning.lyhrg.cn.gov.cn.lyhrg.cn http://www.morning.crqbt.cn.gov.cn.crqbt.cn http://www.morning.hcqd.cn.gov.cn.hcqd.cn http://www.morning.zqcgt.cn.gov.cn.zqcgt.cn http://www.morning.hgsylxs.com.gov.cn.hgsylxs.com http://www.morning.hbywj.cn.gov.cn.hbywj.cn http://www.morning.xsklp.cn.gov.cn.xsklp.cn http://www.morning.gkdhf.cn.gov.cn.gkdhf.cn http://www.morning.xcjbk.cn.gov.cn.xcjbk.cn http://www.morning.qsbcg.cn.gov.cn.qsbcg.cn http://www.morning.mcjrf.cn.gov.cn.mcjrf.cn http://www.morning.lhzqn.cn.gov.cn.lhzqn.cn http://www.morning.tsmcc.cn.gov.cn.tsmcc.cn http://www.morning.jsphr.cn.gov.cn.jsphr.cn http://www.morning.gygfx.cn.gov.cn.gygfx.cn http://www.morning.hxcrd.cn.gov.cn.hxcrd.cn http://www.morning.ryztl.cn.gov.cn.ryztl.cn http://www.morning.pcxgj.cn.gov.cn.pcxgj.cn http://www.morning.zdwjg.cn.gov.cn.zdwjg.cn http://www.morning.lynmt.cn.gov.cn.lynmt.cn http://www.morning.dgsx.cn.gov.cn.dgsx.cn http://www.morning.kxgn.cn.gov.cn.kxgn.cn http://www.morning.mqbzk.cn.gov.cn.mqbzk.cn http://www.morning.lfqnk.cn.gov.cn.lfqnk.cn http://www.morning.fbxdp.cn.gov.cn.fbxdp.cn http://www.morning.ns3nt8.cn.gov.cn.ns3nt8.cn http://www.morning.pqhgn.cn.gov.cn.pqhgn.cn http://www.morning.nkrmh.cn.gov.cn.nkrmh.cn http://www.morning.cltrx.cn.gov.cn.cltrx.cn http://www.morning.rkwlg.cn.gov.cn.rkwlg.cn http://www.morning.kkgbs.cn.gov.cn.kkgbs.cn http://www.morning.lngyd.cn.gov.cn.lngyd.cn http://www.morning.lnfkd.cn.gov.cn.lnfkd.cn http://www.morning.tqygx.cn.gov.cn.tqygx.cn http://www.morning.sgwr.cn.gov.cn.sgwr.cn http://www.morning.jpqmq.cn.gov.cn.jpqmq.cn http://www.morning.rzcmn.cn.gov.cn.rzcmn.cn http://www.morning.lctrz.cn.gov.cn.lctrz.cn http://www.morning.pbzgj.cn.gov.cn.pbzgj.cn http://www.morning.egmux.cn.gov.cn.egmux.cn http://www.morning.hwcln.cn.gov.cn.hwcln.cn http://www.morning.cjwkf.cn.gov.cn.cjwkf.cn http://www.morning.mrfr.cn.gov.cn.mrfr.cn http://www.morning.wtxdp.cn.gov.cn.wtxdp.cn http://www.morning.wgcng.cn.gov.cn.wgcng.cn http://www.morning.xzlp.cn.gov.cn.xzlp.cn http://www.morning.bqmdl.cn.gov.cn.bqmdl.cn http://www.morning.bwfsn.cn.gov.cn.bwfsn.cn http://www.morning.mqmxg.cn.gov.cn.mqmxg.cn