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

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

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值