2022年1月

查看具体键值

kernel/msm-4.9/include/uapi/linux/input-event-codes.hframeworks/base/data/keyboards/Generic.kl 这个里面都可以看到 home 对应的是 172.

修改 dtsi

vim kernel/msm-4.9/arch/arm64/boot/dts/qcom/sq808-evk/qm215-qrd.dtsi

&soc {
        gpio_keys {

                home {
                        label = "home";
                        gpios = <&tlmm 127 0x1>;
                        linux,input-type = <1>;
                        linux,code = <172>;
                        debounce-interval = <15>;
                        linux,can-disable;
                        gpio-key,wakeup;
                };

        };
}

设置开机唤醒

vim frameworks/base/core/java/android/view/KeyEvent.java

    /** @hide */
    public static final boolean isWakeKey(int keyCode) {
        switch (keyCode) {
            case KeyEvent.KEYCODE_BACK:
            case KeyEvent.KEYCODE_MENU:
            case KeyEvent.KEYCODE_WAKEUP:
            case KeyEvent.KEYCODE_PAIRING:
            case KeyEvent.KEYCODE_STEM_1:
            case KeyEvent.KEYCODE_STEM_2:
            case KeyEvent.KEYCODE_STEM_3:
            case KeyEvent.KEYCODE_HOME:
                return true;
        }
        return false;
    }

参考:

Android添加一个新的按键
https://blog.csdn.net/ccskyer/article/details/10226807?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-1.no_search_link&spm=1001.2101.3001.4242.2

android添加按键(二) 添加按键流程、出现问题
https://blog.csdn.net/lintao8613/article/details/82378798?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-0.no_search_link&spm=1001.2101.3001.4242.1

Android 10 新增物理按键
https://blog.csdn.net/a546036242/article/details/121012512?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link

新增物理按键处理流程-Android
https://blog.csdn.net/qq_34211365/article/details/103169774?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link

android8.1 添加物理按键流程
https://blog.csdn.net/tt11212/article/details/87608373

Android 10.0 framework层KeyEvent按键添加流程
https://blog.csdn.net/baidu_41666295/article/details/120262180?spm=1001.2101.3001.6650.13&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EOPENSEARCH%7Edefault-13.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EOPENSEARCH%7Edefault-13.no_search_link

Linux下的按键驱动
https://blog.csdn.net/mike8825/article/details/51672975?spm=1001.2101.3001.6650.3&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-3.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-3.no_search_link

Android Q 按键添加流程详解
https://blog.csdn.net/wjky2014/article/details/111351038?spm=1001.2101.3001.6650.8&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EOPENSEARCH%7Edefault-8.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EOPENSEARCH%7Edefault-8.no_search_link

Android下添加自定义按键值
https://blog.csdn.net/u012966861/article/details/77969153?spm=1001.2101.3001.6650.3&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-3.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-3.no_search_link

Android键值添加和调试
https://blog.csdn.net/u013894427/article/details/78088260?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2.no_search_link

安卓添加按键流程
https://blog.csdn.net/qq_50764711/article/details/111352245?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-4.no_search_link&spm=1001.2101.3001.4242.3

添加按键
https://blog.csdn.net/qq_20395637/article/details/102777378?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link

增加或修改(键盘)按键
https://blog.csdn.net/weixin_38451161/article/details/80291106?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link

android定制化软件修改或添加按键驱动的核心操作步骤讲解
https://blog.csdn.net/acm2008/article/details/7065546?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link

安卓添加按键驱动
https://blog.csdn.net/jaych/article/details/38065497

android添加按键驱动,android按键驱动开发实例2(增加一个新按键)
https://blog.csdn.net/weixin_33379878/article/details/117618160?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2.no_search_link

android系统移植之按键驱动篇
https://blog.csdn.net/armeasy/article/details/6713642?spm=1001.2101.3001.6650.10&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-10.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-10.no_search_link

Android 增加(键盘)按键
https://www.cnblogs.com/dyufei/p/6612790.html

Android系统input按键处理流程(从驱动到framework)
https://blog.csdn.net/jwq2011/article/details/51234811?spm=1001.2101.3001.6650.9&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-9.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-9.no_search_link

Android下添加新的自定义键值和按键处理流程
https://blog.csdn.net/tkwxty/article/details/43338921?spm=1001.2101.3001.6650.8&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-8.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-8.no_search_link

android gpio-keys 按键驱动分析(一) key layout文件
https://blog.csdn.net/clam_zxf/article/details/73849413?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-5.no_search_link&spm=1001.2101.3001.4242.4

[RK3288][Android6.0] 系统按键驱动流程分析
https://blog.csdn.net/kris_fei/article/details/77894406?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link

android 按键 驱动程序,android按键驱动研究.pdf
https://blog.csdn.net/weixin_42551260/article/details/117577179?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link

Android System 自定义KEY事件及驱动
https://blog.csdn.net/qq_31829527/article/details/105954489

Android按键消息处理
https://blog.csdn.net/peng_cao/article/details/8627369?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-1.no_search_link

android 按键处理流程,Android系统input按键处理流程(从驱动到framework)
https://blog.csdn.net/weixin_30727701/article/details/117601107?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link

2021-1-4 Android 添加新的键值并上报从驱动到上层
https://blog.csdn.net/qq_37858386/article/details/112170827

aw9523芯片按键失效问问题分析
https://ciellee.blog.csdn.net/article/details/101553530

Android中对标准内核的按键映射以及按键驱动
https://blog.csdn.net/xiaobaiing/article/details/45565123?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-0.no_search_link&spm=1001.2101.3001.4242.1

kernel按键上报键值的映射
https://blog.csdn.net/u013986340/article/details/101022488

Android系统按键上报流程及其转化
https://blog.csdn.net/weixin_44008788/article/details/118755916

AndroidR Input子系统(5)解析“.kl“文件
https://blog.csdn.net/qq_34211365/article/details/109687690

Android记录输入事件研究
https://blog.csdn.net/infsafe/article/details/6120280?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link

Android 按键流程分析笔记
https://blog.csdn.net/luozirong/article/details/52799745?spm=1001.2101.3001.6650.17&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-17.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-17.no_search_link

Android按键事件处理流程 KeyEvent
https://blog.csdn.net/pengjin1985/article/details/39233011?spm=1001.2101.3001.6650.16&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-16.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-16.no_search_link

Android返回键处理、任务和home键处理
https://blog.csdn.net/HUandroid/article/details/72733494?spm=1001.2101.3001.6650.15&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-15.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-15.no_search_link

Android平台Home键处理机制
https://blog.csdn.net/galensphang/article/details/9821355?spm=1001.2101.3001.6650.13&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-13.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-13.no_search_link

Android8.0 按键事件处理流程
https://blog.csdn.net/w1070216393/article/details/84261996?spm=1001.2101.3001.6650.14&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-14.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-14.no_search_link

android长按home键流程
https://blog.csdn.net/harhy/article/details/8724779?spm=1001.2101.3001.6650.10&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-10.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-10.no_search_link

Android源码解析(二十七)-->HOME事件流程
https://blog.csdn.net/qq_23547831/article/details/51475929?spm=1001.2101.3001.6650.2&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-2.no_search_link

Android源码解析(二十八)-->电源开关机按键事件流程
https://blog.csdn.net/qq_23547831/article/details/51487978?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-0.no_search_link&spm=1001.2101.3001.4242.1

Android源码基础解析之电源开关机按键事件流程
https://blog.csdn.net/qq_35559358/article/details/78647031?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-5.no_search_link&spm=1001.2101.3001.4242.4

android 捕获home键
https://blog.csdn.net/zhzhyang0313/article/details/6995553?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.no_search_link

Android捕获home按键 以及实体键捕获
https://blog.csdn.net/qwertyuiop159158/article/details/52900065?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-1.no_search_link&spm=1001.2101.3001.4242.2

Android 底层按键获取
https://blog.csdn.net/linan_nwu/article/details/8222011?spm=1001.2101.3001.6650.1&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-1.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-1.no_search_link

Android 读取按键及Touch Panel
https://blog.csdn.net/hgl868/article/details/6860116

高通驱动实现 GPIO 中断上报键值
https://ciellee.blog.csdn.net/article/details/101312350?spm=1001.2101.3001.6650.3&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-3.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-3.no_search_link

AndroidQ 打通应用层到HAL层---(HAL模块实现)
https://blog.csdn.net/qq_34211365/article/details/105492973

Android源码解析(三十)-->触摸事件分发流程
https://blog.csdn.net/qq_23547831/article/details/51530671?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_title~default-12.no_search_link&spm=1001.2101.3001.4242.7

android实现home键功能
https://blog.csdn.net/twtje0304_01/article/details/77914161#:~:text=Android%20%E7%9A%84%20Home%20%E6%8C%89%20%E9%94%AE%E5%8A%9F%E8%83%BD%20%E6%98%AF%E5%B0%86%E6%A1%8C%E9%9D%A2Activity%E6%8B%89%E5%88%B0Activity%E6%A0%88%E9%A1%B6%EF%BC%8C%20%E6%98%BE%E7%A4%BA%20%E7%B3%BB%E7%BB%9F%E6%A1%8C%E9%9D%A2%EF%BC%8C%E4%BB%A5%E6%AD%A4%E6%9D%A5,%28%29%3B%20intent.addCategory%20%28Intent.CATEGORY_%20HOME%29%3B%20intent.setAction%20%28Intent.ACTION_MAIN%29%3B%20startActivity%20%28in

Android HOME键那些事
https://blog.csdn.net/imyfriend/article/details/8293399
Android 按下Home键
https://blog.csdn.net/greatdaocaoren/article/details/75009580
Android 监听Home键
https://www.jianshu.com/p/d215bc8e1b3d
【Android】Android处理Home键方法小结
https://www.cnblogs.com/rayray/p/3408179.html

直接使用 sql 语句

        SQLiteDatabase db = analysisDBOpenHelper.getReadableDatabase();
        String find = "select count(*) from " + "info";
        Cursor cursor = db.rawQuery(find, null);
        cursor.moveToFirst();
        return cursor.getLong(0);

使用接口

return sqLiteDatabase.query(TABLENAME, null, null, null, null, null, null).getCount();

参考:

sqlite的rawQuery和query的一个问题总结
https://blog.csdn.net/HarryWeasley/article/details/40212127
sqlite数据库的问题
https://bbs.csdn.net/topics/390907936?page=1#post-398362317