標籤: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 檔案的作用【轉】