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;
相关推荐
laocooon5238578861 分钟前
C#二次开发中简单块的定义与应用
android·数据库·c#
似霰25 分钟前
传统 Hal 开发笔记5 —— 添加硬件访问服务
android·framework·hal
恋猫de小郭28 分钟前
Android 宣布 Runtime 编译速度史诗级提升:在编译时间上优化了 18%
android·前端·flutter
csj5043 分钟前
安卓基础之《(4)—Activity组件》
android
游戏开发爱好者81 小时前
H5 混合应用加密 Web 资源暴露到 IPA 层防护的完整技术方案
android·前端·ios·小程序·uni-app·iphone·webview
2501_915106321 小时前
最新版本iOS系统设备管理功能全面指南
android·macos·ios·小程序·uni-app·cocoa·iphone
走在路上的菜鸟2 小时前
Android学Dart学习笔记第十四节 库和导库
android·笔记·学习·flutter
姜西西_2 小时前
自动化测试框架pytest之fixture
android·java·pytest
尐葮阿譽2 小时前
Ubuntu 25.10 安装 Waydroid 安卓模拟器
android·ubuntu·安卓模拟器·waydroid
_李小白2 小时前
【Android FrameWork】实战:跟踪Android APP Surface创建流程
android