20230201在AIO-3568J开发板在原厂Android11下增加右键返回
2023/2/1 8:37
百度搜索:RK3568 右键返回
Z:\rk3568_Android11.0_ap6257s\frameworks\native\services\inputflinger\reader\mapper\accumulator\CursorButtonAccumulator.cpp
uint32_t CursorButtonAccumulator::getButtonState() const {
uint32_t result = 0;
if (mBtnLeft) {
result |= AMOTION_EVENT_BUTTON_PRIMARY;
}
if (mBtnOk) {
char mKeyMouseState[PROPERTY_VALUE_MAX] = {0};
property_get("sys.KeyMouse.mKeyMouseState", mKeyMouseState, "off");
if (strcmp(mKeyMouseState, "on") == 0) {
result |= AMOTION_EVENT_BUTTON_PRIMARY;
}
}
if (mBtnRight) {
char targetProduct[PROPERTY_VALUE_MAX] = {0};
property_get("ro.target.product", targetProduct, "");
if (strcmp(targetProduct, "box") == 0 || strcmp(targetProduct, "atv") == 0) {
result |= AMOTION_EVENT_BUTTON_BACK;
} else {
result |= AMOTION_EVENT_BUTTON_SECONDARY;
}
}
if (mBtnMiddle) {
result |= AMOTION_EVENT_BUTTON_TERTIARY;
}
if (mBtnBack || mBtnSide) {
result |= AMOTION_EVENT_BUTTON_BACK;
}
if (mBtnForward || mBtnExtra) {
result |= AMOTION_EVENT_BUTTON_FORWARD;
}
return result;
}
} // namespace android
修改为:
uint32_t CursorButtonAccumulator::getButtonState() const {
uint32_t result = 0;
if (mBtnLeft) {
result |= AMOTION_EVENT_BUTTON_PRIMARY;
}
if (mBtnOk) {
char mKeyMouseState[PROPERTY_VALUE_MAX] = {0};
property_get("sys.KeyMouse.mKeyMouseState", mKeyMouseState, "off");
if (strcmp(mKeyMouseState, "on") == 0) {
result |= AMOTION_EVENT_BUTTON_PRIMARY;
}
}
if (mBtnRight) {
// char targetProduct[PROPERTY_VALUE_MAX] = {0};
// property_get("ro.target.product", targetProduct, "");
// if (strcmp(targetProduct, "box") == 0 || strcmp(targetProduct, "atv") == 0) {
// result |= AMOTION_EVENT_BUTTON_BACK;
// } else {
// result |= AMOTION_EVENT_BUTTON_SECONDARY;
// }
result |= AMOTION_EVENT_BUTTON_BACK;
}
if (mBtnMiddle) {
result |= AMOTION_EVENT_BUTTON_TERTIARY;
}
if (mBtnBack || mBtnSide) {
result |= AMOTION_EVENT_BUTTON_BACK;
}
if (mBtnForward || mBtnExtra) {
result |= AMOTION_EVENT_BUTTON_FORWARD;
}
return result;
}
} // namespace android
参考资料:
https://blog.csdn.net/libingxuexi/article/details/121165088
rk3568 android11 鼠标右键点击无法返回
Haidern
于 2021-11-05 16:04:26 发布
frameworks/native/services/inputflinger/reader/mapper/accumulator/CursorButtonAccumulator.cpp
--- a/services/inputflinger/reader/mapper/accumulator/CursorButtonAccumulator.cpp
+++ b/services/inputflinger/reader/mapper/accumulator/CursorButtonAccumulator.cpp
@@ -105,13 +105,14 @@ uint32_t CursorButtonAccumulator::getButtonState() const {
}
}
if (mBtnRight) {
- char targetProduct[PROPERTY_VALUE_MAX] = {0};
+ /*char targetProduct[PROPERTY_VALUE_MAX] = {0};
property_get("ro.target.product", targetProduct, "");
if (strcmp(targetProduct, "box") == 0 || strcmp(targetProduct, "atv") == 0) {
result |= AMOTION_EVENT_BUTTON_BACK;
} else {
result |= AMOTION_EVENT_BUTTON_SECONDARY;
- }
+ }*/
+ result |= AMOTION_EVENT_BUTTON_BACK;
}
if (mBtnMiddle) {
result |= AMOTION_EVENT_BUTTON_TERTIARY;
https://blog.csdn.net/qq_38312843/article/details/125234114
RK3588-android12《鼠标右键改为返回功能》
要不要买菜!
于 2022-06-11 14:07:58 发布
修改:frameworks/native/services/inputflinger/reader/mapper/accumulator/CursorButtonAccumulator.cpp
1
diff --git a/services/inputflinger/reader/mapper/accumulator/CursorButtonAccumulator.cpp b/services/inputflinger/reader/mapper/accumulator/CursorButtonAccumulator.cpp
index 168b0a7..01be174 100644
--- a/services/inputflinger/reader/mapper/accumulator/CursorButtonAccumulator.cpp
+++ b/services/inputflinger/reader/mapper/accumulator/CursorButtonAccumulator.cpp
@@ -110,7 +110,7 @@ uint32_t CursorButtonAccumulator::getButtonState() const {
if (strcmp(targetProduct, "box") == 0 || strcmp(targetProduct, "atv") == 0) {
result |= AMOTION_EVENT_BUTTON_BACK;
} else {
- result |= AMOTION_EVENT_BUTTON_SECONDARY;
+ result |= AMOTION_EVENT_BUTTON_BACK;
}
}
if (mBtnMiddle) {