summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothserviceinfo_android.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/tqtc/lts-5.15.10' into ↵Tarja Sundqvist2023-04-241-1/+9
|\ | | | | | | | | | | tqtc/lts-5.15-opensource Change-Id: I19a002f2b52eb02d4bfdf32c336811a71d42e9f2
| * Improve Android-12 bluetooth permission error reportingJuha Vuolle2022-04-141-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original commit to add support for new Android-12 (API Level 31) Bluetooth permissions covered the possible codepaths the QtBluetooth module user might use. This commit seeks to improve the error reporting insofar as they are due to missing permissions. Since there are many possible codepaths to take, the following elaborates function-by-function the details for easier understanding. QBluetoothDeviceDiscoveryAgent::start() This is the main entry point for using device discovery and checks the needed permissions. QBluetoothServiceDiscoveryAgent::start() This is the main entry point for using service discovery. In most use cases it uses device discovery first which ensures adequate permissions / failure if not granted. There is one codepath bypassing this when setRemoteAddress() has been called, for which reason there is a permission check. QBluetoothSocket::localName() localAddress() connectToServiceHelper() These functions require permissions and can be called in any order so all of them check for permissions. Notably this commit moves the permission check from the constructor to these functions. QBluetoothServiceInfo::registerService() This function creates a local device and initiates active listening. The local device creation in this function will fail if it is not granted permissions, but this commit adds an earlier permission check for slightly improved error reporting. QBluetoothServer::listen() This is the main entry point for using the server and it checks for permission. The local device iteration in the function would also fail without permissions, but the permission check is added for slightly improved error reporting. Notably the initiateActiveListening() does not have permission check as there is no code path to it without already having the permission. QBluetoothLocalDevice::allDevices() constructor() setHostMode The local device needs permissions already at construction time. This commit documents this on the local device documentation. In addition the local device has a widely used allDevices() static function for iterating devices which needs its own permission checks. Also the setHostMode() function requires Advertise permission as it ultimately uses ACTION_REQUEST_DISCOVERABLE Intent. QLowEnergyController::connectToDevice() startAdvertising() addService() This commit moves the permission check from the construction time to these individual entry functions, as the creation itself does not seem to require permissions (tested this with a somewhat contrived setup which dodges earlier permission checks *). The aim here is to slightly improve the error reporting if an error is suspected to be due to missing permissions. User may decline the first permission requests and call subsequent functions which may or may not trigger a new permission query. For this reason this commit also adds another permission to startAdvertising(). *) In most if not all practical scenarios a local device and a device discovery has been made which both perform the permission checks. In addition the header include order was reorganized to preferred order where this commit touches them This commit amends a0542cff15d58db83a835f1a378a55a0ec117c9c Task-number: QTBUG-99590 Change-Id: Ic34a0184a79f6ea7c4a6643b9603e8ddaa18e28e Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit cc121cdef160a4ef528d1483ac365ac8319a1e42) Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* | Revert "Update commercial license headers"v5.15.3-lts-lgplTarja Sundqvist2021-03-241-21/+21
|/ | | | | | | | | | | This reverts commit 0db3b38521e11147cb802798a2cb7811a96029a9. Revert of commercial license headers is required for Qt 5.15.3 opensource release. Task-number: QTBUG-91108 Change-Id: Ie82dac4e6a4e2e0e1207d17a10c09701871d6875 Reviewed-by: Jukka Jokiniva <jukka.jokiniva@qt.io>
* Update commercial license headersTarja Sundqvist2021-02-021-21/+21
| | | | | | | | | | | | | | | Updated header.COMM to the files in tqtc-qtconnectivity. Examples, tests or documentation files are not updated. The commercial license header may contain some additional lines so that its line count equals with the earlier license header. Reason for this is that some autotests use hard coded line numbers and a change in the line count causes failures in test. Task-number: QTQAINFRA-4159 Change-Id: Icf450df25282ffadf5bcd0950753d17ba6ab57e3 Reviewed-by: Antti Kokko <antti.kokko@qt.io>
* Replace foreach with for loop and set QT_NO_FOREACHOliver Wolff2018-08-151-1/+1
| | | | | | | | To avoid unnecessary copies, const is used wherever possible. Change-Id: Ic743716512751cfd24fad5bd37c244b115dd26fe Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Updated license headersAntti Kokko2016-01-201-14/+20
| | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I856c13e2a6d4d12c46e1286b0ca1c092ee4608f8 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-161-7/+7
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I3822a6484e8f7a420330de1cb1aeb0c3d1cf41b7 Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
* Fix a small rfcomm related typo in warning on AndroidAlex Blasche2014-09-121-1/+1
| | | | | | Change-Id: Id57a4da506ca34f01d615eef8a38b812bf3df13b Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Update license headers and add new licensesJani Heikkinen2014-08-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 & LICENSE.GPLv2 - Removed LICENSE.GPL Change-Id: I7a8b8b787fcae9a178794364efdefe1021d10b1b Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
* Port QtBluetooth to AndroidAlex Blasche2014-02-131-0/+140
This is a feature merge to dev targeting Qt 5.3. Known issues: -QTBUG-36754: QBluetoothServer::close() crashes -QTBUG-36763: QBluetothTransferManager port to Android not possible -QTBUG-36764: Improve QBluetoothLocalDevice::connectedDevices() -QTBUG-36810: Remove direct use of Android action strings The above issues and some other minor TODO's will be addressed until final release time. Task-number: QTBUG-33792 [ChangeLog][QtBluetooth][Android] QtBluetooth has been ported to Android. Change-Id: I31ba83e3b7d6aa68e7258b7e43235de7d1a6e68a Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>