I created a Magisk module that allows you to remap the dedicated Mi AI hardware button of the Xiaomi Mi 9 and Mi Mix 3 to any one of 15 user-selectable functions.

The mod is availavle in the Magisk store, and you can directly download it from there.

Magisk Project Link

Project Link

XDA-Developers Thread

Some blog threads that talked about my work:

Thread 1

Thread 2

Thread 3

Thread 4

Thread 5