How to configure the Mouse button action in Android 11

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to configure the Mouse button action in Android 11

跳至解决方案
233 次查看
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.

标记 (4)
0 项奖励
回复
1 解答
180 次查看
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

在原帖中查看解决方案

1 回复
181 次查看
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

%3CLINGO-SUB%20id%3D%22lingo-sub-2200540%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E5%A6%82%E4%BD%95%E5%9C%A8%20Android%2011%20%E4%B8%AD%E9%85%8D%E7%BD%AE%E9%BC%A0%E6%A0%87%E6%8C%89%E9%92%AE%E6%93%8D%E4%BD%9C%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2200540%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E4%BD%A0%E5%A5%BD%EF%BC%8C%3CBR%20%2F%3E%3CBR%20%2F%3E%E6%88%91%E4%BD%BF%E7%94%A8%E7%9A%84%E6%98%AF%E8%BF%90%E8%A1%8C%20Android%2011%20%E7%9A%84%20imx8mp%20%E8%87%AA%E5%AE%9A%E4%B9%89%E6%9D%BF%E3%80%82%E6%88%91%E9%9C%80%E8%A6%81%E5%B0%86%20MOUSE_SECONDARY%20%E6%8C%89%E9%92%AE%E6%9B%B4%E6%94%B9%E4%B8%BA%20BACK%E3%80%82%E6%88%91%E4%BF%AE%E6%94%B9%E4%BA%86%20.kl%E6%96%87%E4%BB%B6%E6%9D%A5%E6%9B%B4%E6%94%B9%20MOUSE_SECONDARY%20%E7%9A%84%E6%93%8D%E4%BD%9C%EF%BC%8C%E4%BD%86%E6%B2%A1%E6%9C%89%E5%A5%8F%E6%95%88%EF%BC%8C%E6%9C%89%E6%B2%A1%E6%9C%89%E5%85%B6%E4%BB%96%E6%96%B9%E6%B3%95%E5%8F%AF%E4%BB%A5%E6%9B%B4%E6%94%B9%20MOUSE_SECONDARY%20%E7%9A%84%E6%93%8D%E4%BD%9C%EF%BC%9F%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EThanks%26amp%3B%20Regards%2C%3CBR%20%2F%3ESubash%20P.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2200540%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EAndroid%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ei.MX%208%20%E7%B3%BB%E5%88%97%20%7C%20i.MX%208QuadMax%20(8QM)%20%7C%208QuadPlus%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ei.MX%208M%20%7C%20i.MX%208M%20Mini%20%7C%20i.MX%208M%20Nano%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2201512%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20How%20to%20configure%20the%20Mouse%20button%20action%20in%20Android%2011%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2201512%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E4%BD%A0%E5%A5%BD%EF%BC%8C%3CBR%20%2F%3E%3CBR%20%2F%3E%E8%BF%99%E5%8F%AF%E4%BB%A5%E9%80%9A%E8%BF%87%E4%B8%A4%E7%A7%8D%E4%B8%8D%E5%90%8C%E7%9A%84%E6%96%B9%E5%BC%8F%E6%9D%A5%E5%AE%8C%E6%88%90%EF%BC%9A1.%20%E6%A1%86%E6%9E%B6%E5%B1%82%EF%BC%8C2%20%E5%86%85%E6%A0%B8%E4%BA%8B%E4%BB%B6%E7%B3%BB%E7%BB%9F%E3%80%82%3C%2FP%3E%0A%3CP%3E%E8%A6%81%E5%9C%A8%20aosp%20%E6%A1%86%E6%9E%B6%E4%B8%8A%E8%BF%9B%E8%A1%8C%E6%AD%A4%E7%B1%BB%E9%87%8D%E6%98%A0%E5%B0%84%EF%BC%8C%E5%8F%AF%E8%83%BD%E9%9C%80%E8%A6%81%E4%BF%AE%E6%94%B9%3CA%20href%3D%22https%3A%2F%2Fandroid.googlesource.com%2Fplatform%2Fframeworks%2Fbase%2F%2B%2Fa45746e%2Fservices%2Finput%2FInputReader.cpp%2C%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%20https%3A%2F%2Fandroid.googlesource.com%2Fplatform%2Fframeworks%2Fbase%2F%2B%2Fa45746e%2Fservices%2Finput%2FInputReader.cpp%20%E4%B8%AD%E7%9A%84%3C%2FA%3E%20%3CSTRONG%3EsynthesizeButtonKeys%20%E5%87%BD%E6%95%B0%E3%80%81%3C%2FSTRONG%3E%E8%BF%87%E6%BB%A4%E9%BC%A0%E6%A0%87%3CSPAN%3EMOUSE_SECONDARY%20%3C%2FSPAN%3E%E4%BA%8B%E4%BB%B6%EF%BC%8C%E5%B0%86%E5%85%B6%E6%98%A0%E5%B0%84%E5%88%B0%20KEYCODE_BACK%E3%80%82%3C%2FP%3E%0A%3CP%3E%E5%AF%B9%E4%BA%8E%E5%86%85%E6%A0%B8%E4%BA%8B%E4%BB%B6%E7%B3%BB%E7%BB%9F%EF%BC%8C%E6%82%A8%E9%9C%80%E8%A6%81%E7%BC%96%E5%86%99%E4%B8%80%E4%B8%AA%E6%9C%8D%E5%8A%A1%EF%BC%8C%E5%B0%86%20BTN_RIGHT%20%E6%98%A0%E5%B0%84%E5%88%B0%20KEY_BACK%EF%BC%8C%E8%BF%99%E6%A0%B7%E5%BD%93%E6%82%A8%E7%82%B9%E5%87%BB%E9%BC%A0%E6%A0%87%20BTN_RIGHT%20%E6%97%B6%EF%BC%8Caosp%20%E6%80%BB%E8%83%BD%E8%8E%B7%E5%BE%97%20KEY_BACK%20%E4%BA%8B%E4%BB%B6%E3%80%82%3CBR%20%2F%3E%3CBR%20%2F%3E%E8%87%B4%E6%95%AC%EF%BC%8C%3CBR%20%2F%3EZhiming%3C%2FP%3E%3C%2FLINGO-BODY%3E