Rework LE advertising on Android


The Android backend was using BluetoothLeAdvertiser.startAdvertising()
method to start the advertising.
This method uses the AdvertisingSettings class, which does not allow to
adjust certain advertising parameters that we expose in
QLowEnergyAdvertisingParameters class. Specifically, it provides no way
to set advertising interval.

API Level 26 added BluetoothLeAdvertiser.startAdvertisingSet().
This method uses the AdvertisingSetParameters class, which provides
more flexibility when configuring the advertising.

This patch updates the code to unconditionally use the new API.
We can do it, because API Level 26 is available unconditionally in Qt
at this moment (even 6.10 requires API Level 28).

In the process of doing this change, I also figured out that the new
API allows us to add support for extended advertising. However, we
cannot enable it unconditionally, because then old BTLE-4 devices do
not see such advertising packets. I think we need to expose extended
advertising as an option in QLowEnergyAdvertisingParameters first.

However, the patch already provides some helper code for the future
change.

The patch was tested by sending the advertising packets from an
Android phone using bluetoothtestdevice application, and capturing
them with Wireshark on an Ubuntu host. The tests show that the
specified interval is not strictly respected, but adjusting the
values surely has an effect on the frequency of advertising.

[ChangeLog][QtBluetooth][QLowEnergyController][Android] The Android
backend now respects the advertising minimum and maximum interval
parameters provided via QLowEnergyAdvertisingParameters when starting
the BTLE advertising.

Fixes: QTBUG-144275
Change-Id: I0de38fa7a80be112c30480bf5a01d1f4b55e3747
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
commite58324a214be0e104ea0d6faa13ec9e168e00cd6
parent06d37adcdd227fa730b44966fc7cf703e719ec32
authorIvan Solovev <ivan.solovev@qt.io>
committerIvan Solovev <ivan.solovev@qt.io>
commit timeMon, 2 Mar 2026 12:02:58 +0100