bluetoothsocket.connect()Android 12在某些设备上的许可问题

发布于 2025-01-30 04:35:53 字数 1062 浏览 4 评论 0原文

我们使用蓝牙低能L2CAP通道(在Android API级别29中引入)将数据传输到我们的BLE设备。最近,我们有报道说它在此设备上不起作用:

  • OPPO查找X2 Pro,API级别31(Android 12)
  • Sony Xperia 1 III,API级别31(Android 12)

,事实证明,当致电BluetoothSocket.connect时,事实证明()bluetoothsocket createInseCurel2CapChannel()这些某些设备

java.lang.SecurityException: UID 10391 / PID 18566 lacks permission android.permission.BLUETOOTH

在清单中抛出声明android.permission.bluetooth.bluetooth解决了问题。

文档清楚地说 subsign.permission.bluetrise.bluetoots.bluetooth_connect 应该需要。这种预期的行为也可以源自以下事实:在所有其他BLE方案android.permission.bluetooth.bluetooth api级别不需要 = 31。= 31。

这是供应商中的错误 - 蓝牙堆栈的特定实现?更多的设备/供应商会影响此错误吗?

We use Bluetooth Low Energy L2CAP Channels (introduced in Android API Level 29) to transfer data to our BLE devices. Recently we've got reports that it's not working on this devices:

  • Oppo Find X2 Pro, API Level 31 (Android 12)
  • Sony Xperia 1 III, API Level 31 (Android 12)

It turned out that when calling BluetoothSocket.connect() on the BluetoothSocket returned by createInsecureL2capChannel() these certain devices throw

java.lang.SecurityException: UID 10391 / PID 18566 lacks permission android.permission.BLUETOOTH

Declaring android.permission.BLUETOOTH in the manifest solves the problem.

But the documentation clearly says that only Manifest.permission.BLUETOOTH_CONNECT
should be needed. And this expected behaviour could also be derived from the fact that in all other BLE scenarios android.permission.BLUETOOTH is never needed for API Level >= 31.

Is this a bug in the vendor-specific implementation of the Bluetooth stack? Are more devices/vendors are affected of this bug?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文