How to configure the Mouse button action in Android 11

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to configure the Mouse button action in Android 11

Jump to solution
215 Views
subash_p
Contributor III

Hi,

I'm using an imx8mp custom board running Android 11. I need to change the MOUSE_SECONDARY button as BACK. I modified the .kl file to change the action ofMOUSE_SECONDARY, but it's not working, is there any other way to change the MOUSE_SECONDARY action?


Thanks & Regards,
Subash P.

0 Kudos
Reply
1 Solution
162 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi,

This could be done with two different ways: 1. framework layer, 2 kernel event system.

For such remapping on aosp framework, you may need to modify synthesizeButtonKeys function in https://android.googlesource.com/platform/frameworks/base/+/a45746e/services/input/InputReader.cpp, filter the mouse MOUSE_SECONDARY event , mapping it to KEYCODE_BACK.

For kernel event system, you need write a service to map BTN_RIGHT to KEY_BACK, then the aosp can always get KEY_BACK event while you click mouse BTN_RIGHT.

Best Regards,
Zhiming

View solution in original post

1 Reply
163 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi,

This could be done with two different ways: 1. framework layer, 2 kernel event system.

For such remapping on aosp framework, you may need to modify synthesizeButtonKeys function in https://android.googlesource.com/platform/frameworks/base/+/a45746e/services/input/InputReader.cpp, filter the mouse MOUSE_SECONDARY event , mapping it to KEYCODE_BACK.

For kernel event system, you need write a service to map BTN_RIGHT to KEY_BACK, then the aosp can always get KEY_BACK event while you click mouse BTN_RIGHT.

Best Regards,
Zhiming