android 4.4 添加物理按键

kernel下添加


linux-3.4/drivers/input/keyboard/Makefile

linux-3.4/drivers/input/keyboard/sw-keyboard.c

 sw_scankeycodes[]={

[1] = KEY_GPS,

}


android 下添加

device/softwinner/wing-k70/configs/sw-keyboard.kl

key 249 GPS WAKE


frameworks/base/core/res/values/attrs.xml

<enum name="KEYCODE_GPS" value="249" />


frameworks/native/libs/input/input.cpp

 isSystemKey( int32_t keyCode){

        case AKEYCODE_GSP:

        return true;

}

frameworks/native/include/android/keycodes.h


       AKEYCODE_GPS = 249,


frameworks/base/core/java/android/view/keyEvent.java


public static final int KEYCODE_GPS = 249;

private static final int LAST_KEYCODE = KEYCODE_GSP;


populateKeycodeSymbolicName()

names.append(KEYCODE_MEDIA_AUDIO_TRACK,"KEYCODE_GPS");


frameworks/base/policy/src/com/android/internal/policy/impl/phoneWindowManager.java


interceptKeyBeforeDispatching()

else if(keyCode == KeyEvent.KEYCODE_GPS){ //frameworks 中处理物理按键

}


阅读更多
上一篇如何Android中自定义Navigationbar
下一篇调用startActivityForResult后,onActivityResult为什么立刻响应
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭