android4.x 增加一个新按键&&修改android默认语言

修改一下文件


一, kernel  ,,,不说了


二, android


1,android\frameworks\base\data\keyboards\qwerty.kl

2,android\frameworks\base\data\keyboards\Generic.kl

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


4,frameworks/base/include/androidfw/KeycodeLabels.h

static const KeycodeLabel KEYCODES[] = {
    { "SOFT_LEFT", 1 },
    { "SOFT_RIGHT", 2 },
    { "HOME", 3 },
    { "BACK", 4 },
    { "CALL", 5 },
    { "ENDCALL", 6 },
    { "0", 7 },


5,,frameworks/native/include/android/keycodes.h 



6,,vi frameworks/base/core/java/android/view/KeyEvent.java 

      public static final int KEYCODE_ASSIST          = 219;


 ++   public static final int KEYCODE_KNOCK_RIGHT     = 252;//add by jiangdou
  ++  public static final int KEYCODE_KNOCK_LEFT      = 253;//add by jiangdou


.....()...

    private static void populateKeycodeSymbolicNames() {
        SparseArray<String> names = KEYCODE_SYMBOLIC_NAMES;
        names.append(KEYCODE_UNKNOWN, "KEYCODE_UNKNOWN");

    names.append(KEYCODE_ASSIST, "KEYCODE_ASSIST");
   ++     names.append(KEYCODE_KNOCK_RIGHT, "KEYCODE_KNOCK_RIGHT");//add by jiangdou
    ++    names.append(KEYCODE_KNOCK_LEFT, "KEYCODE_KNOCK_LEFT");//add by jiangdou

......()....




7,  vi frameworks/base/libs/androidfw/Input.cpp

...............()....

bool KeyEvent::hasDefaultAction(int32_t keyCode) {
    switch (keyCode) {
        case AKEYCODE_HOME:

case AKEYCODE_MEDIA_RECORD:
   ++     case AKEYCODE_KNOCK_RIGHT:
   ++     case AKEYCODE_KNOCK_LEFT:


..............().........

8,,,,vi external/webkit/Source/WebKit/android/plugins/ANPKeyCodes.h

.......()....


       kAppSwitch_ANPKeyCode = 187,

++   kKnockRight_ANPKeyCode = 252,
++    kKnockLeft_ANPKeyCode = 253,


9编译ERROR


编译出错:

out/target/common/obj/PACKAGING/public_api.txt:22549: error 17: Field android.view.KeyEvent.KEYCODE_STAR has changed value from 17 to 227
out/target/common/obj/PACKAGING/public_api.txt:22636: error 17: Field android.view.KeyEvent.KEYCODE_POUND has changed value from 18 to 228


******************************
You have tried to change the API from what has been previously released in
an SDK.  Please fix the errors listed above.
******************************

解决办法:

自己找到了在framework/base/api 下有n(n取决于你源码的版本,如果你源码的版本是4.0.4 ,那么就 有分别以 1~ 15命名的xml或txt,就是api level)个xml或txt文档,分别对应android api 的不同版本。   在这些xml中,把你在framework层中修改的地方对应进去。 如我这个错误的地方,在15.txt 和 current.xml 中找到“KEYCODE_STAR”,把里面的value 值改成和你代码中值一致就可以了。

modify

1,     vi  framework/base/api/15.txt

         field public static final int KEYCODE_ZOOM_IN = 168; // 0xa8
  ++  field public static final int KEYCODE_KNOCK_RIGHT = 252; // 0xFC
  ++  field public static final int KEYCODE_KNOCK_LEFT = 253; // 0xFD
        field public static final int KEYCODE_ZOOM_OUT = 169; // 0xa9

2,   vi  framework/base/api/16.txt

            field public static final int KEYCODE_ZOOM_IN = 168; // 0xa8
  ++  field public static final int KEYCODE_KNOCK_RIGHT = 252; // 0xFC
  ++  field public static final int KEYCODE_KNOCK_LEFT = 253; // 0xFD
        field public static final int KEYCODE_ZOOM_OUT = 169; // 0xa9

3,   vi  framework/base/api/17.txt

            field public static final int KEYCODE_ZOOM_IN = 168; // 0xa8
  ++  field public static final int KEYCODE_KNOCK_RIGHT = 252; // 0xFC
  ++  field public static final int KEYCODE_KNOCK_LEFT = 253; // 0xFD
        field public static final int KEYCODE_ZOOM_OUT = 169; // 0xa9

4   2,   vi  framework/base/api/16.txt

           field public static final int KEYCODE_ZOOM_IN = 168; // 0xa8
  ++  field public static final int KEYCODE_KNOCK_RIGHT = 252; // 0xFC
  ++  field public static final int KEYCODE_KNOCK_LEFT = 253; // 0xFD
        field public static final int KEYCODE_ZOOM_OUT = 169; // 0xa9

5,,,  vi frameworks/base/api/current.txt 

           field public static final int KEYCODE_ZOOM_IN = 168; // 0xa8
  ++  field public static final int KEYCODE_KNOCK_RIGHT = 252; // 0xFC
  ++  field public static final int KEYCODE_KNOCK_LEFT = 253; // 0xFD
        field public static final int KEYCODE_ZOOM_OUT = 169; // 0xa9

====================================我是分割线=============================================

====================================我是分割线=============================================

修改android默认语言

vi   vi device/softwinner/wing-common/ProductCommon.mk



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值