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;
相关推荐
louisgeek2 分钟前
Android OkHttp Interceptor
android
大王派来巡山的小旋风6 分钟前
Kotlin基本用法三
android·kotlin
Jerry说前后端41 分钟前
Android 移动端 UI 设计:前端常用设计原则总结
android·前端·ui
bytebeats42 分钟前
Jetpack Compose 1.9: 核心新特性简介
android·android jetpack
Icey_World1 小时前
Mysql笔记-错误条件\处理程序
android
大王派来巡山的小旋风2 小时前
Kotlin基本用法之集合(一)
android·程序员·kotlin
用户2018792831672 小时前
智能广播系统(RemoteCallbackList)的诞生
android
用户2018792831673 小时前
Binder 同应用内(本地)通信是否存在 1MB 大小限制?
android
一条上岸小咸鱼3 小时前
Kotlin 基本数据类型(四):String
android·前端·kotlin
Onion_994 小时前
学习下Github上的Android CICD吧
android·github