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;
相关推荐
DeBuggggggg22 分钟前
centos 7.6安装mysql8
android
浩浩测试一下1 小时前
渗透信息收集- Web应用漏洞与指纹信息收集以及情报收集
android·前端·安全·web安全·网络安全·安全架构
移动开发者1号3 小时前
深入理解原子类与CAS无锁编程:原理、实战与优化
android·kotlin
陈卓4103 小时前
MySQL-主从复制&分库分表
android·mysql·adb
移动开发者1号3 小时前
深入理解 ThreadLocal:原理、实战与优化指南
android·kotlin
zhangphil3 小时前
Android PNG/JPG图ARGB_8888/RGB_565‌解码形成Bitmap在物理内存占用大小的简单计算
android
厦门德仔3 小时前
【WPF】WPF(样式)
android·java·wpf
aqi004 小时前
FFmpeg开发笔记(七十二)Linux给FFmpeg集成MPEG-5视频编解码器EVC
android·ffmpeg·音视频·流媒体
Devil枫6 小时前
Kotlin高级特性深度解析
android·开发语言·kotlin
ChinaDragonDreamer6 小时前
Kotlin:2.1.20 的新特性
android·开发语言·kotlin