码迷,mamicode.com
首页 > 移动开发 > 详细

android kl 文件的作用【转】

时间:2017-10-21 18:56:45      阅读:408      评论:0      收藏:0      [点我收藏+]

标签:res   pre   win   data   notice   ice   final   als   virtual   

本文转载自:http://blog.csdn.net/u013308744/article/details/49274069

首先看touchscreen的kl文件


# Copyright (c) 2014, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above
#       copyright notice, this list of conditions and the following
#       disclaimer in the documentation and/or other materials provided
#       with the distribution.
#     * Neither the name of The Linux Foundation nor the names of its
#       contributors may be used to endorse or promote products derived
#       from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


key 158     BACK              VIRTUAL WAKE
key 102     HOME              VIRTUAL WAKE
key 580     APP_SWITCH        VIRTUAL WAKE
key 116     GESTURE_DOUBLE_CLICK             VIRTUAL  WAKE
key 46      GESTURE_C                 VIRTUAL WAKE
key 18      GESTURE_E                 VIRTUAL WAKE
key 31      GESTURE_S                 VIRTUAL WAKE
key 47      GESTURE_V                 VIRTUAL WAKE
key 17      GESTURE_W                 VIRTUAL WAKE
key 44      GESTURE_Z                 VIRTUAL WAKE





那么这个kl有啥用呢,众所周知,android kernel和framework是不同的两层,也就是说,kernel里认识的
key值是158之类的这种数字,这个158是scankode,它往framework上报的时候也只会报这样的数字,但是framework不认识这个数字是什么,所以framework需要先解析kl文件,map起来,这样kernel传值上来的时候才会知道到底是什么key,也就是说转换scancode 158变成KeyCodeLabel也就是BACK,然后back再转换成4这个keycode

首先

key 580     APP_SWITCH        VIRTUAL WAKE

这里的580是scancode,转换撑了APP_SWITCH这个keycodelabel

InputEventLabels.h里的

 DEFINE_KEYCODE(APP_SWITCH),

#define DEFINE_KEYCODE(key) { #key, AKEYCODE_##key }

这里拼接了AKEYCODE_APP_SWITCH

 

Keycodes.h (native\include\android):    AKEYCODE_APP_SWITCH      = 187,
KeyEvent.java (base\core\java\android\view):    public static final int KEYCODE_APP_SWITCH      = 187;

然后就变成了keycode 187

android kl 文件的作用【转】

标签:res   pre   win   data   notice   ice   final   als   virtual   

原文地址:http://www.cnblogs.com/zzb-Dream-90Time/p/7705390.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!