summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@qt.io>2019-10-18 09:59:38 +0200
committerAlex Blasche <alexander.blasche@qt.io>2019-10-21 14:17:56 +0000
commit04a94a42ae0e4ec645e909a6b005723bbd4d443d (patch)
tree0616bb9171b78d5182cd179e26dc6560b3d4a99b
parent5d3f494e70db4aaba7356d27ad5e1e861b3a4341 (diff)
Fix classic device discovery on Android
It seems recent Android releases (at least confirmed for Android 9) require location permission for classic device discovery. Previously, it was only required for BTLE discovery. This patch ensures the permission check is done for every type of device discovery on Android. Task-number: QTBUG-69615 Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> (cherry picked from commit a22807beee00050ebf04f069cdf0ea4ab40ebbf9) Change-Id: I4cc48aa659e38c89d956090b9fd995f346f01e7d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
-rw-r--r--src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
index 443be14d..ce3b8f10 100644
--- a/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
+++ b/src/bluetooth/qbluetoothdevicediscoveryagent_android.cpp
@@ -150,10 +150,8 @@ void QBluetoothDeviceDiscoveryAgentPrivate::start(QBluetoothDeviceDiscoveryAgent
}
// check Android v23+ permissions
- // -> BTLE search requires android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION
- if (requestedMethods & QBluetoothDeviceDiscoveryAgent::LowEnergyMethod
- && QtAndroid::androidSdkVersion() >= 23)
- {
+ // -> any device search requires android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION
+ if (QtAndroid::androidSdkVersion() >= 23) {
const QString coarsePermission(QLatin1String("android.permission.ACCESS_COARSE_LOCATION"));
const QString finePermission(QLatin1String("android.permission.ACCESS_FINE_LOCATION"));