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;
相关推荐
-指短琴长-1 小时前
MySQL快速入门——基本查询(下)
android·mysql·adb
stevenzqzq3 小时前
android lambda回调
android
林北北的霸霸5 小时前
django初识与安装
android·mysql·adb
Java 码农6 小时前
MySQL EXPLAIN 详解与优化指南
android·mysql·adb
stevenzqzq11 小时前
Android Hilt 入门教程_传统写法和Hilt写法的比较
android
wuwu_q11 小时前
用通俗易懂方式,详细讲讲 Kotlin Flow 中的 map 操作符
android·开发语言·kotlin
_李小白12 小时前
【Android FrameWork】第五天:init加载RC文件
android
2501_9160074712 小时前
手机使用过的痕迹能查到吗?完整查询指南与步骤
android·ios·智能手机·小程序·uni-app·iphone·webview
黄毛火烧雪下13 小时前
React Native (RN)项目在web、Android和IOS上运行
android·前端·react native
下位子13 小时前
『OpenGL学习滤镜相机』- Day7: FBO(帧缓冲对象)
android·opengl