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;
相关推荐
包包打太极37 分钟前
android Jetpack Compose项目的build.gradle.kts,Gradle构建系统中的配置文件,用于定义Android项目的构建逻辑依赖
android
顾林海38 分钟前
Flutter 文本组件深度剖析:从基础到高级应用
android·前端·flutter
追随远方1 小时前
Android Cmake构建的项目,需不需要配置指定ndk及版本
android·音频编解码
你说你说你来说1 小时前
AdapterView的数据更新
android·笔记
你说你说你来说2 小时前
复杂点的常用View
android·笔记
你说你说你来说2 小时前
常用 View 的使用
android·笔记
一期一祈^3 小时前
MySQL表的约束
android·mysql·adb
WWWWW3 小时前
理解VSync-6-应用申请与接收VSync(下)
android·源码阅读
居然是阿宋3 小时前
深入解析 Android 图形系统:Canvas、Skia、OpenGL 与 SurfaceFlinger 的协作
android
___波子 Pro Max.5 小时前
Android envsetup与Python venv使用指南
android·python