You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Android 14+笔记应用中调用OnePlus Pad 2 Stylo 2触控笔振动?

实现OnePlus Stylo 2触控笔振动的方案探索

我正在为OnePlus Pad 2开发一款适配Android 14及以上系统的笔记应用。OnePlus Stylo 2触控笔自带触觉马达(而非平板内置),能模拟钢笔在纸上书写的振动反馈,体验出色。目前仅OnePlus Notes和hiPaint支持该功能,我尝试用Kotlin/Java实现,但Android原生的vibrate接口仅能触发设备振动,无法作用于触控笔。通过Reddit了解到hiPaint完全适配该触控笔,现将logcat | grep hipaint和logcat | grep oplus_bt*获取的日志附上,希望找到触发触控笔振动的实现方法。


日志1:logcat | grep hipaint输出

12-23 07:15:22.644  3558  3727 I WakeLockCheck: getAllTopPkgName: listTopPkg=[com.aige.hipaint], listTopPkgTmp=[OplusAppInfo{windowingMode=1, activityType=1, taskId=3389, appBounds=Rect(0, 0 - 3000, 2120), appInfo=ApplicationInfo{a98559 com.aige.hipaint}, topActivity=ComponentInfo{com.aige.hipaint/com.aige.hipaint.draw.ui.DrawMainUI}, displayId=0, orientation=2, userId=0, launchedFromPackage=com.aige.hipaint, isRootActivity=false, extension=Bundle[{isTaskEmbedded=false, launchScenario=0, flexible_split_support_multi_instance=false, isContainerTask=false, getRootActivity=ComponentInfo{com.aige.hipaint/com.aige.hipaint.inkpaint.login.activity.TabActivity}}]}]
12-23 07:15:51.413  3558  3675 D OplusSplitScreenManagerService: com.aige.hipaint supportsSplitScreen by forceResizable activity return:true
12-23 07:15:51.951  3558  3675 D OplusSplitScreenManagerService: com.aige.hipaint supportsSplitScreen by forceResizable activity return:true
12-23 07:15:51.955  3558  3675 D OplusSplitScreenManagerService: com.aige.hipaint supportsSplitScreen by forceResizable activity return:true
12-23 07:15:52.039  4712  5056 I VideoScene: updateVideoPlayInfo : playing = true uid = 10379 pkg = com.aige.hipaint
12-23 07:15:52.040  4712  5056 I VideoCallScene: updateVideoPlayInfo : playing = true uid = 10379 pkg = com.aige.hipaint
12-23 07:15:52.662 25506 12816 W LOG_FLOWCTRL: ==LOGS OVER PROC QUOTA(300), rows(521) bytes(35438) com.aige.hipaint:draw DROPPED==
12-23 07:15:53.040  4712  5056 I VoiceCallScene: MSG_CHK_VIDEO_STATE : uid = 10379, pkg = com.aige.hipaint, mVoiceCallUid = 10124, mVoiceCallPkg = com.google.android.googlequicksearchbox
12-23 07:15:55.059 25506 25512 I ge.hipaint:draw: ThreadFlipBegin blocked for 17.697ms
12-23 07:15:55.129  4712  5056 I VideoScene: updateVideoPlayInfo : playing = false uid = 10379 pkg = com.aige.hipaint
12-23 07:15:55.130  4712  5056 I VideoCallScene: updateVideoPlayInfo : playing = false uid = 10379 pkg = com.aige.hipaint
12-23 07:15:56.130  4712  5056 I VoiceCallScene: MSG_CHK_VIDEO_STATE : uid = 10379, pkg = com.aige.hipaint, mVoiceCallUid = 10124, mVoiceCallPkg = com.google.android.googlequicksearchbox
12-23 07:16:00.016  3558  3697 D OomAdjusterSocExtImpl: App adj change from previous state to cached state : 25354 com.aige.hipaint

日志2:logcat | grep oplus_bt*输出

12-23 07:17:58.235  4817  4817 I oplus_bt_dual_sync: stack_down_sync_action: type=18, len=17
12-23 07:17:58.235  4817  4817 I oplus_bt_qos_monitor: get_oplus_qos_data getting qos data
12-23 07:17:59.587  4817  5154 I oplus_bt_stack_ble_event: report_stack_ble_last_data_transfer, f8:**:**:**:04:2d
12-23 07:17:59.799  4817  5154 I oplus_bt_stack_ble_event: report_stack_ble_last_data_transfer, f8:**:**:**:04:2d
12-23 07:18:03.434  4817  5154 I oplus_bt_stack_ble_event: report_stack_ble_last_data_transfer, f8:**:**:**:04:2d
12-23 07:18:04.226  4817  4817 I oplus_bt_dual_sync: stack_down_sync_action: type=18, len=17
12-23 07:18:04.226  4817  4817 I oplus_bt_qos_monitor: get_oplus_qos_data getting qos data
12-23 07:18:10.234  4817  4817 I oplus_bt_dual_sync: stack_down_sync_action: type=18, len=17
12-23 07:18:10.234  4817  4817 I oplus_bt_qos_monitor: get_oplus_qos_data getting qos data
12-23 07:18:16.229  4817  4817 I oplus_bt_dual_sync: stack_down_sync_action: type=18, len=17
12-23 07:18:16.229  4817  4817 I oplus_bt_qos_monitor: get_oplus_qos_data getting qos data
12-23 07:18:17.199  4817  5154 I oplus_bt_stack_ble_event: report_stack_ble_last_data_transfer, f8:**:**:**:04:2d
12-23 07:18:17.209  4817  5154 I oplus_bt_stack_ble_event: report_stack_ble_last_data_transfer, f8:**:**:**:04:2d
12-23 07:18:22.220  4817  4817 I oplus_bt_dual_sync: stack_down_sync_action: type=18, len=17
12-23 07:18:22.221  4817  4817 I oplus_bt_qos_monitor: get_oplus_qos_data getting qos data
12-23 07:18:22.856  4817  5154 I oplus_bt_stack_ble_event: report_stack_ble_last_data_transfer, f8:**:**:**:04:2d
12-23 07:18:23.073  4817  5154 I oplus_bt_stack_ble_event: report_stack_ble_last_data_transfer, f8:**:**:**:04:2d
12-23 07:18:26.485  4817  5154 I oplus_bt_stack_ble_event: report_stack_ble_last_data_transfer, f8:**:**:**:04:2d
12-23 07:18:28.235  4817  4817 I oplus_bt_dual_sync: stack_down_sync_action: type=18, len=17
12-23 07:18:28.235  4817  4817 I oplus_bt_qos_monitor: get_oplus_qos_data getting qos data
12-23 07:18:34.243  4817  4817 I oplus_bt_dual_sync: stack_down_sync_action: type=18, len=17
12-23 07:18:34.243  4817  4817 I oplus_bt_qos_monitor: get_oplus_qos_data getting qos data
12-23 07:18:38.035  4817  5154 I oplus_bt_stack_ble_event: report_stack_ble_last_data_transfer, f8:**:**:**:04:2d
12-23 07:18:38.047  4817  5154 I oplus_bt_stack_ble_event: report_stack_ble_last_data_transfer, f8:**:**:**:04:2d
12-23 07:18:40.243  4817  4817 I oplus_bt_dual_sync: stack_down_sync_action: type=18, len=17
12-23 07:18:40.244  4817  4817 I oplus_bt_qos_monitor: get_oplus_qos_data getting qos data
12-23 07:18:40.630  4817  5154 I oplus_bt_stack_ble_event: report_stack_ble_last_data_transfer, f8:**:**:**:04:2d
12-23 07:18:40.844  4817  5154 I oplus_bt_stack_ble_event: report_stack_ble_last_data_transfer, f8:**:**:**:04:2d
12-23 07:18:42.457  4817  5154 I oplus_bt_stack_ble_event: report_stack_ble_last_data_transfer, f8:**:**:**:04:2d
12-23 07:18:46.246  4817  4817 I oplus_bt_dual_sync: stack_down_sync_action: type=18, len=17
12-23 07:18:46.246  4817  4817 I oplus_bt_qos_monitor: get_oplus_qos_data getting qos data
12-23 07:18:52.247  4817  4817 I oplus_bt_dual_sync: stack_down_sync_action: type=18, len=17
12-23 07:18:52.247  4817  4817 I oplus_bt_qos_monitor: get_oplus_qos_data getting qos data
12-23 07:18:58.248  4817  4817 I oplus_bt_dual_sync: stack_down_sync_action: type=18, len=17
12-23 07:18:58.248  4817  4817 I oplus_bt_qos_monitor: get_oplus_qos_data getting qos data

可行实现方向

  1. 调用OnePlus私有API
    该触控笔的振动属于厂商定制特性,大概率需要访问com.oplus.pen相关包下的私有类(如OplusPenManager),通过反射查找并调用控制触控笔振动的方法。

  2. BLE指令触发振动
    从蓝牙日志可见,触控笔通过BLE与平板连接。hiPaint可能是向触控笔的特定BLE特征写入振动指令实现反馈。可尝试获取触控笔的BLE服务UUID、特征UUID,写入对应控制指令。

  3. 反编译参考应用
    反编译OnePlus Notes或hiPaint的APK,分析其处理触控事件、与系统服务交互或蓝牙通信的代码,提取振动触发逻辑。

  4. 申请厂商开发支持
    部分私有API需要特定权限或签名,可联系OnePlus开发者支持,获取官方文档或权限授权。

内容的提问来源于stack exchange,提问作者KWunsch

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 10:59:57