首先就是鍵的名稱
安卓底部有三個鍵,返回鍵,home鍵,菜單鍵(?)
返回鍵,home鍵的說明沒有爭議。
菜單鍵就有很多說法了:
recent apps list,Task Switcher,Recent Tasks button,Overview,多任務鍵。(戻る,ホーム,マルチタスク)
API 11之後KeyCode就變成了KEYCODE_APP_SWITCH,
確實在adb裏輸入adb shell input keyevent KEYCODE_APP_SWITCH,反應跟按下菜單鍵一樣。
參考Android菜單鍵的前世今生https://www.jianshu.com/p/c54897f2924cThe overview button is the square button in the black bar along the bottom of your device screen
button navigation: Three buttons for Home, Back, and App Overview.
he Recents screen (also referred to as the Overview screen, recent task list, or recent apps)
返回鍵 onKeyDown裏就可以捕捉到keyCode是 KEYCODE_BACK
home鍵可以通過註冊一個BroadcastReceiver來捕捉。參考https://blog.csdn.net/weixin_33873846/article/details/89695354
在低版本里,也可以不捕捉到菜單鍵。但是在高版本(8.0以上)就不好使了。
按下菜單鍵,雖然onUserInteraction,onUserLeaveHint,onPause,onStop也會被觸發,但是無法區分是畫面跳轉觸發,還是按下菜單鍵觸發。
Activity的startLockTask(),可以讓home,recent(最近)暫時失效。不過畫面上會有提示。
https://blog.csdn.net/zhenbohuang/article/details/72722247
有設備權限的話,可以無效化這三個系統鍵
lab.sonicmoov.com/development/app-dev/android-kiosk/
參考
[深入SystemUI]-瞭解recents的啓動流程(一)
https://blog.csdn.net/weixin_42832981/article/details/89499559
[Android] [SystemUI] Recent -- 最近任務的啓動流程
https://blog.csdn.net/libelosophy/article/details/30222275
【Android】詳解Android的menu菜單
https://www.cnblogs.com/HDK2016/p/8038908.html
Android 9.0 的 recent 鍵/事件的攔截
https://blog.csdn.net/Easyhood/article/details/95637143
Android Recent鍵的點擊事件
https://blog.csdn.net/qq_27256793/article/details/101421234
Android如何屏蔽home鍵和recent鍵
https://blog.csdn.net/zhenbohuang/article/details/72722247
Android中切換到主線程更新方法
https://blog.csdn.net/u010520146/article/details/82108583
最近使用的應用”屏幕
https://developer.android.com/guide/components/activities/recents#sample
獨自のユーザー補助サービスを作成する
https://developer.android.com/guide/topics/ui/accessibility/service?hl=ja
最近の畫面
https://developer.android.com/guide/components/activities/recents?hl=ja#kotlin