[UNOFFICIAL BUILD] Xiaomi Mi Mix 3 (perseus)

Today I got the 4th button (at left of screen) on duty :smile_cat:

Quite simple :

  • reboot to TWRP
  • mount System partition r/w (may have to play with TWRP settings if mounted r/o)
  • get key mapping file with adb pull /system/usr/keylayout/gpio-keys.kl
  • with a text editor (I used Notepad++), change Android key code for : key 689 VOICE_ASSIST (I’ve put key 689 APP_SWITCH for testing)
  • put back key mapping file with adb push gpio-keys.kl /system/usr/keylayout/
  • ensure (adb shell) that file is “-rw-r--r-- 1 root root
  • unmount System partition
  • reboot system
  • enjoy :partying_face:

Android key code for APP_SWITCH : KeyEvent  |  Android Developers
AFAIK, every KEYCODE_*** in the list can be mapped to (remove the KEYCODE_ header), of course some won’t do anything on a phone :wink:
You may try, for example :

  • Music Player (MUSIC)
  • Call (CALL)
  • Contacts (CONTACTS)
  • Screenshot (SYSRQ)
  • Mute/Unmute Media Volume (VOLUME_MUTE)
  • Play/Pause Media (MEDIA_PLAY_PAUSE)
  • Next Media (MEDIA_NEXT)
  • Recent Apps (APP_SWITCH)
  • Open/Close Quick Settings (QPANEL_ON_OFF)
  • Internet Browser (EXPLORER)
  • Calendar (CALENDAR)
  • Calculator (CALCULATOR)

Thanks to original author and Mi MIX 3 community Telegram group !