summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/android/localdevicebroadcastreceiver.cpp10
-rw-r--r--src/bluetooth/qbluetoothlocaldevice.cpp7
2 files changed, 16 insertions, 1 deletions
diff --git a/src/bluetooth/android/localdevicebroadcastreceiver.cpp b/src/bluetooth/android/localdevicebroadcastreceiver.cpp
index ae2a926f..c6cb3680 100644
--- a/src/bluetooth/android/localdevicebroadcastreceiver.cpp
+++ b/src/bluetooth/android/localdevicebroadcastreceiver.cpp
@@ -225,8 +225,18 @@ bool LocalDeviceBroadcastReceiver::pairingConfirmation(bool accept)
if (!pairingDevice.isValid())
return false;
+ // setPairingConfirmation() is likely to throw SecurityException for BLUETOOTH_PRIVILEGED
+ // as this permission is not obtainable for 3rdparties
+ // Note: Normally it would not have been added to Qt API but it used to be BLUETOOTH_ADMIN
+ QAndroidJniEnvironment env;
bool success = pairingDevice.callMethod<jboolean>("setPairingConfirmation",
"(Z)Z", accept);
+ if (success) {
+ if (env->ExceptionCheck()) {
+ env->ExceptionDescribe();
+ env->ExceptionClear();
+ }
+ }
pairingDevice = QAndroidJniObject();
return success;
}
diff --git a/src/bluetooth/qbluetoothlocaldevice.cpp b/src/bluetooth/qbluetoothlocaldevice.cpp
index 78095beb..173650a0 100644
--- a/src/bluetooth/qbluetoothlocaldevice.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice.cpp
@@ -272,10 +272,15 @@ bool QBluetoothLocalDevice::isValid() const
/*!
\fn QBluetoothLocalDevice::pairingConfirmation(bool confirmation)
- To be called after getting a pairingDisplayConfirmation(). The \a confirmation parameter either
+ To be called after getting a pairingDisplayConfirmation(). The \a confirmation parameter either
accepts the pairing or rejects it.
Accepting a pairing always refers to the last pairing request issued via \l requestPairing().
+
+ \note This function requires BLUETOOTH_PRIVILEGED permission on Android which is generally not
+ obtainable for 3rdparty. Android's default handler for pairing requests will do this on behalf
+ of the user and the application can ignore this call. Nevertheless the proper Android calls are made
+ in case the application does have the required permissions.
*/
/*!