博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
android kl 文件的作用【转】
阅读量:6699 次
发布时间:2019-06-25

本文共 2485 字,大约阅读时间需要 8 分钟。

本文转载自:

首先看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

你可能感兴趣的文章
Cacti 使用安装详解-企业级实例
查看>>
DNS简述
查看>>
linux ssh密钥登录配置
查看>>
Redis的七种武器及其适合的应用场景
查看>>
github和git@osc提交问题
查看>>
ASP.NET后台调用前台JS函数的三种常见方法
查看>>
easyui动态显示和隐藏表头
查看>>
平滑数据迁移,不影响服务
查看>>
Java5线程并发库之LOCK(锁)&CONDITION(条件)实现线程同步通信
查看>>
VBA语法基础
查看>>
VBA生成SQL语句
查看>>
MATLAB图像小波变换
查看>>
SQL优化准则
查看>>
nodejs+redis
查看>>
Getting Started with the Table Component
查看>>
使用交互环境
查看>>
Mongodb 备份和恢复
查看>>
Docker Compose 项目
查看>>
疯狂java学习笔记1023---线程的同步
查看>>
01C语言的概述
查看>>