MTK Android12 修改鼠标右键为返回键

MTK Android12 修改鼠标右键为返回键

需求

复制代码
项目中未添加TP功能,需要用鼠标进行操作,将鼠标右键赋予返回功能。

解决

复制代码
路径:frameworks/native/services/inputflinger/reader/mapper/accumulator/CursorButtonAccumulator.cpp
xml 复制代码
diff --git a/frameworks/native/services/inputflinger/reader/mapper/accumulator/CursorButtonAccumulator.cpp b/frameworks/native/services/inputflinger/reader/mapper/accumulator/CursorButtonAccumulator.cpp
index 2d7d73b..d6fdce5 100644 (file)
--- a/frameworks/native/services/inputflinger/reader/mapper/accumulator/CursorButtonAccumulator.cpp
+++ b/frameworks/native/services/inputflinger/reader/mapper/accumulator/CursorButtonAccumulator.cpp
@@ -84,7 +84,8 @@ uint32_t CursorButtonAccumulator::getButtonState() const {
         result |= AMOTION_EVENT_BUTTON_PRIMARY;
     }
     if (mBtnRight) {
-        result |= AMOTION_EVENT_BUTTON_SECONDARY;
+        //result |= AMOTION_EVENT_BUTTON_SECONDARY;
+               result |= AMOTION_EVENT_BUTTON_BACK;
     }
     if (mBtnMiddle) {
         result |= AMOTION_EVENT_BUTTON_TERTIARY;
相关推荐
kcuwu.18 小时前
Python判断及循环
android·java·python
轩情吖18 小时前
MySQL之索引
android·数据库·mysql·b+树·索引·page·
2501_9159184118 小时前
iOS mobileprovision 描述文件管理,新建、下载和内容查看
android·ios·小程序·https·uni-app·iphone·webview
00后程序员张18 小时前
iOS 应用程序使用历史记录和耗能记录怎么查?
android·ios·小程序·https·uni-app·iphone·webview
用户693717500138419 小时前
OS级AI Agent:手机操作系统的下一个战场
android·前端·人工智能
私人珍藏库19 小时前
[Android] 亿连车机版V7.0.1
android·app·软件·车机
用户693717500138420 小时前
315曝光AI搜索问题:GEO技术靠内容投喂操控答案,新型营销操作全揭秘
android·前端·人工智能
进击的cc20 小时前
彻底搞懂 Binder:不止是 IPC,更是 Android 的灵魂
android·面试
段娇娇21 小时前
Android jetpack LiveData (三) 粘性数据(数据倒灌)问题分析及解决方案
android·android jetpack
用户20187928316721 小时前
TabLayout被ViewPager2遮盖部分导致Tab难选中
android