diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-04-24 10:13:37 +0300 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-04-24 10:13:37 +0300 |
commit | da6113cb52beb5731d8c95ecbfc375936f59def2 (patch) | |
tree | 81a617b98e6e04d660fb2e75aae942a49ed7c2a1 /src/bluetooth/qbluetoothserviceinfo_android.cpp | |
parent | 3dcb548bd6fe4aa488ca0bac95e65a7a366c3eca (diff) | |
parent | ca96a42035255b4355e4d8ddba7f5da7b9006577 (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.10' into tqtc/lts-5.15-opensource
Change-Id: I19a002f2b52eb02d4bfdf32c336811a71d42e9f2
Diffstat (limited to 'src/bluetooth/qbluetoothserviceinfo_android.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothserviceinfo_android.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothserviceinfo_android.cpp b/src/bluetooth/qbluetoothserviceinfo_android.cpp index b0193f73..348a40c5 100644 --- a/src/bluetooth/qbluetoothserviceinfo_android.cpp +++ b/src/bluetooth/qbluetoothserviceinfo_android.cpp @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#include <QtCore/QLoggingCategory> +#include "android/androidutils_p.h" #include "qbluetoothhostinfo.h" #include "qbluetoothlocaldevice.h" #include "qbluetoothserviceinfo.h" @@ -46,6 +46,8 @@ #include "qbluetoothserver_p.h" #include "qbluetoothserver.h" +#include <QtCore/QLoggingCategory> + QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(QT_BT_ANDROID) @@ -89,6 +91,12 @@ bool QBluetoothServiceInfoPrivate::unregisterService() bool QBluetoothServiceInfoPrivate::registerService(const QBluetoothAddress& localAdapter) { + if (!ensureAndroidPermission(BluetoothPermission::Connect)) { + qCWarning(QT_BT_ANDROID) << "Serviceinfo registerService() failed due to" + "missing permissions"; + return false; + } + const QList<QBluetoothHostInfo> localDevices = QBluetoothLocalDevice::allDevices(); if (!localDevices.count()) return false; //no Bluetooth device |