android 在工模(工厂模式)里面屏蔽使用方向键和ok键的
/frameworks/base/core/java/android/view$KeyEvent.java
/** Whether key will, by default, trigger a click on the focused view.
* @hide
*/
@UnsupportedAppUsage
public static final boolean isConfirmKey(int keyCode) {
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_CENTER:case KeyEvent.KEYCODE_DPAD_UP:
case KeyEvent.KEYCODE_DPAD_DOWN:
case KeyEvent.KEYCODE_DPAD_LEFT:
case KeyEvent.KEYCODE_DPAD_RIGHT:
//*/
boolean isTestKey = "1".equals(android.os.SystemProperties.get("sys.keyboardtest.key",0));
if(isTestKey) return false;
//*/
case KeyEvent.KEYCODE_ENTER:
case KeyEvent.KEYCODE_SPACE:
case KeyEvent.KEYCODE_NUMPAD_ENTER:
return true;
default:
return false;
}
}
/vendor/freeme/packages/apps/FreemeFactoryTest/src/com/freeme/factory/input$KeyboardTest.java
@Override
public void onStart() {
super.onStart();
mRecentSettingsObserver.observe();android.os.SystemProperties.set("sys.keyboardtest.key",1);
}@Override
public void onStop() {android.os.SystemProperties.set("sys.keyboardtest.key",0);
mRecentSettingsObserver.release();
super.onStop();
}
原文地址:https://blog.csdn.net/qq_46687516/article/details/143672949
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!