Jump to content

Practical guide to an Android device keyboard stack


Recommended Posts

Just wanted to provide links to source files that makes our Pro¹ keyboard. That can be used as reference for anyone wanting to understand and customise Pro¹ keyboard experience by building Lineage OS. From low to high level files we have identified the followings key components:

Device Tree Structure Include, contains GPIO pin mapping to scan codes:
https://github.com/LineageOS/android_kernel_fxtec_msm8998/blob/lineage-18.1/arch/arm/boot/dts/qcom/msm8998-qrd-skuk-t5.dtsi
Permalink

Driver, brings together GPIO and aw9523b controller input to define the scan codes sent to user space:
https://github.com/LineageOS/android_kernel_fxtec_msm8998/blob/lineage-18.1/drivers/input/keyboard/qx1000.c

Key Layout, maps scan codes to Android Key Codes, you have both the generic Android key layout which should not be modified and our device specific layout which you can customize:
https://android.googlesource.com/device/google/atv/+/master/Generic.kl
https://github.com/LineageOS/android_device_fxtec_pro1/blob/lineage-18.1/keylayout/gpio-keys.kl
https://github.com/LineageOS/android_device_fxtec_pro1/blob/lineage-18.1/keylayout/Builtin_Keyboard.kl

Key Character Map, maps possibly modified key codes to final key codes:
https://github.com/LineageOS/android_device_fxtec_pro1/blob/lineage-18.1/keychars/Builtin_Keyboard.kcm

From our device makefile you should be able to work out what is actually used during our build process:
https://github.com/LineageOS/android_device_fxtec_pro1/blob/lineage-18.1/device.mk

Pro1 specific driver keymap indices:
http://www.keyboard-layout-editor.com/#/gists/086488022ce3789b560dcd682c89b0da

Meta Search key system shortcut handler:
https://android.googlesource.com/platform/frameworks/base/+/master/services/core/java/com/android/server/policy/PhoneWindowManager.java#2890

Meta Search key system shortcut definitions:
https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/xml/bookmarks.xml
Those are loaded from: https://android.googlesource.com/platform/frameworks/base/+/master/services/core/java/com/android/server/policy/ShortcutManager.java#104
Not sure why Meta+A does not launch the Calculator though.

Display system keyboard shortcuts dialog:
https://android.googlesource.com/platform/frameworks/base/+/android-7.0.0_r1/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java

For your application to register shortcuts see how it is done in Lineage Trebuchet launcher:
https://github.com/LineageOS/android_packages_apps_Trebuchet/blob/c8d5010b1071873957ff9f4b56ed5de1ca9471b4/src/com/android/launcher3/Launcher.java#L2621
To handle them:
https://github.com/LineageOS/android_packages_apps_Trebuchet/blob/c8d5010b1071873957ff9f4b56ed5de1ca9471b4/src/com/android/launcher3/Launcher.java#L2652

Meta shortcuts are defined there it seems: https://android.googlesource.com/platform/frameworks/base/+/master/core/res/res/xml/bookmarks.xml

Omissions

Those are apparently not used for Pro¹:
https://github.com/LineageOS/android_kernel_fxtec_msm8998/blob/lineage-18.1/arch/arm/boot/dts/qcom/msm8998-qrd-skuk-QX1000.dtsi

Edited by Slion
  • Like 1
  • Thanks 9
Link to post
Share on other sites
  • Slion changed the title to Practical guide to an Android device keyboard stack

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Terms