diff --git a/src/corelib/doc/src/external-resources.qdoc b/src/corelib/doc/src/external-resources.qdoc index e6bd65d5b4c..7c3653aa711 100644 --- a/src/corelib/doc/src/external-resources.qdoc +++ b/src/corelib/doc/src/external-resources.qdoc @@ -177,3 +177,7 @@ \title Java arrays */ +/*! + \externalpage https://developer.android.com/develop/connectivity/bluetooth/bt-permissions + \title Android Bluetooth Permissions +*/ diff --git a/src/corelib/kernel/qpermissions.cpp b/src/corelib/kernel/qpermissions.cpp index 4089bee6935..6d295970550 100644 --- a/src/corelib/kernel/qpermissions.cpp +++ b/src/corelib/kernel/qpermissions.cpp @@ -371,16 +371,17 @@ QT_PERMISSION_IMPL_COMMON(QMicrophonePermission) \li \c android.permission.BLUETOOTH_ADVERTISE \li \c android.permission.BLUETOOTH_CONNECT \li \c android.permission.BLUETOOTH_SCAN - \li \c android.permission.ACCESS_FINE_LOCATION \endlist \include permissions.qdocinc end-usage-declarations - \note Currently on Android the \c android.permission.ACCESS_FINE_LOCATION - permission is requested together with Bluetooth permissions. This is - required for Bluetooth to work properly, unless the application provides a - strong assertion in the application manifest that it does not use Bluetooth - to derive a physical location. This permission coupling may change in - future. + \note Since Qt 6.8.1, the ACCESS_FINE_LOCATION permission is no longer + requested if API Level >= 31. This + \l {Android Bluetooth Permissions}{may limit some Bluetooth scan results}. + Users needing these results need + to request the location permission separately (see + \l {QLocationPermission::Precise}{precise location}) and ensure that + \c {BLUETOOTH_SCAN} permission doesn't have the + \c {android:usesPermissionFlags="neverForLocation"} attribute set. \include permissions.qdocinc permission-metadata */ @@ -403,10 +404,6 @@ QT_PERMISSION_IMPL_COMMON(QBluetoothPermission) \note The fine-grained permissions are currently supported only on Android 12 and newer. On older Android versions, as well as on Apple operating systems, any mode results in full Bluetooth access. - - \note For now the \c Access mode on Android also requests the - \l {QLocationPermission::Precise}{precise location} permission. - This permission coupling may change in the future. */ /*! diff --git a/src/corelib/kernel/qpermissions_android.cpp b/src/corelib/kernel/qpermissions_android.cpp index 6c21ded72cd..ded6c7ec8f0 100644 --- a/src/corelib/kernel/qpermissions_android.cpp +++ b/src/corelib/kernel/qpermissions_android.cpp @@ -56,13 +56,11 @@ static QStringList nativeBluetoothPermission(const QBluetoothPermission &permiss // API Level < 31 static QString bluetoothGeneral = u"android.permission.BLUETOOTH"_s; + static QString fineLocation = u"android.permission.ACCESS_FINE_LOCATION"_s; // API Level >= 31 static QString bluetoothScan = u"android.permission.BLUETOOTH_SCAN"_s; static QString bluetoothAdvertise = u"android.permission.BLUETOOTH_ADVERTISE"_s; static QString bluetoothConnect = u"android.permission.BLUETOOTH_CONNECT"_s; - // Fine location is currently required for ALL API levels, but that is not - // strictly necessary for API Level >= 31. See QTBUG-112164. - static QString fineLocation = u"android.permission.ACCESS_FINE_LOCATION"_s; if (QtAndroidPrivate::androidSdkVersion() < 31) { return {bluetoothGeneral, fineLocation}; @@ -72,7 +70,7 @@ static QStringList nativeBluetoothPermission(const QBluetoothPermission &permiss if (modes & QBluetoothPermission::Advertise) permissionList << bluetoothAdvertise; if (modes & QBluetoothPermission::Access) - permissionList << bluetoothScan << bluetoothConnect << fineLocation; + permissionList << bluetoothScan << bluetoothConnect; return permissionList; } }