android kl 檔案的作用【轉】

來源:互聯網
上載者:User

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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.