diff options
author | Alex Blasche <alexander.blasche@qt.io> | 2018-09-25 10:37:55 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@qt.io> | 2018-09-26 06:21:25 +0000 |
commit | 7b40de8fbbaed22ca6217b5acc8dad1db6ae0600 (patch) | |
tree | c7ee5a79ecbaa3068418a2d8a6933d7390c5f0c1 /src/bluetooth/qbluetoothlocaldevice.cpp | |
parent | 77f5510fd636895d49c87ccbb504154925b40703 (diff) |
Catch SecurityException during pairing on Android
QBluetoothLocalDevice::pairingConfirmation(bool) requires
BLUETOOTH_PRIVILEGED permission which cannot be obtained by 3rdparty
apps. I believe this used to be different as suggested by
https://android.googlesource.com/platform/frameworks/base/+/b1dc1757071ba46ee653d68f331486e86778b8e4
This patch ensures that the thrown SecurityException is caught and displays
an appropriate warning.
Change-Id: Ib5a0e0fc0c9f3b4f33690493ed74aa4b7cb8864b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothlocaldevice.cpp')
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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. */ /*! |