20230201在AIO-3568J开发板在原厂Android11下增加右键返回

2023-05-16

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) {

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

20230201在AIO-3568J开发板在原厂Android11下增加右键返回 的相关文章

随机推荐