Skip to content

适配 Android 12 及以上蓝牙权限模型变更#488

Merged
SuperMonster003 merged 1 commit intoSuperMonster003:masterfrom
Willie169:master
Mar 3, 2026
Merged

适配 Android 12 及以上蓝牙权限模型变更#488
SuperMonster003 merged 1 commit intoSuperMonster003:masterfrom
Willie169:master

Conversation

@Willie169
Copy link
Contributor

问题

根据 https://developer.android.com/develop/connectivity/bluetooth/bt-permissions:

If your app targets Android 12 (API level 31) or higher, declare the following permissions in your app's manifest file:

  • If your app looks for Bluetooth devices, such as BLE peripherals, declare the BLUETOOTH_SCAN permission.
  • If your app makes the current device discoverable to other Bluetooth devices, declare the BLUETOOTH_ADVERTISE permission.
  • If your app communicates with already-paired Bluetooth devices, declare the BLUETOOTH_CONNECT permission.

原本的 AutoJs6 在 manifest 中未声明 BLUETOOTH_CONNECT、BLUETOOTH_SCAN 与 BLUETOOTH_ADVERTISE 权限,故无法在 Android 12 及以上的装置使用需要该等权限的功能。

解决方案

在 manifest 中声明 BLUETOOTH_CONNECT、BLUETOOTH_SCAN 与 BLUETOOTH_ADVERTISE 权限以适配 Android 12 及以上蓝牙权限模型变更。

验证

在 Android 14 真机上测试,通过 runtime.requestPermissions 请求权限后可正常使用需要该等权限的功能。

@Willie169
Copy link
Contributor Author

需要APK者可以在這裡下載 https://github.com/Willie169/AutoJs6/releases/tag/v6.6.5

@SuperMonster003
Copy link
Owner

感谢提交 PR.

有两个需要修改的地方, 已保证合并代码后不会产生副作用.

1. .changelog/xxx.json 文件 (共计 10 个)

版本更新记录通常不必在 PR 中体现, 我会根据 PR 中涉及到的更新/修复/优化等根据当前项目的表述风格及格式进行补充或更新.

如果确实需要将更新记录附加到 PR 中, 需要将版本号还原为 6.6.4 (与 version.properties 中保持一致), 并建议运行 AutoJs6/.python/generate_markdown.py 脚本, 自动更新对应的 Markdown 内容.

最终还是建议保留原始 json 内容不变, 由 AutoJs6 开发者补充或更新这部分内容.

2. version.properties 文件

修改 version.properties 文件需额外谨慎.

  • PADDLE_OCR_CMAKE_VERSION 建议保持最小可用原则, 当基本功能没有出现问题时, 不建议做版本升级.
  • VERSION_BUILD 的变更会导致开启了自动检查更新的用户收到更新提示, 但无法完成更新, 因为 Release 版本未发布.
  • VERSION_NAME 不建议修改, 因为通常 AutoJs6 不会发布仅包含一个修复或改进条目的发行版本 (除非包含重大问题或功能更新), 同时下一个版本除了 6.6.5 之外, 还有可能是 6.7.0, 甚至可能依然保持 6.6.4 (含 patch 等).

因此建议保留 version.properties 原始内容不变.


上述两处修改完成后, 我将会直接合并当前 PR 到项目主分支.
再次感谢提交 PR. :)

@Willie169
Copy link
Contributor Author

已 restore 該等檔案的變更並 ammend 到 commit 上。感謝您開發與維護這個偉大的專案。

@SuperMonster003 SuperMonster003 merged commit 1ccdca5 into SuperMonster003:master Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants