Bluetooth: preserve one advertisement slot for GMS core
This brings back the check on the multiple advertisement support before
granting any Bluetooth LE advertiser. In other words, one slot is preserved
for GMS core.
Bug: 74819586
Test: Run an BLE application and verify the number of advertisements
Change-Id: I05014e597bd5868f18a81842dc341e47991f2c79
diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java
index ee667c2..b9e80e4 100644
--- a/core/java/android/bluetooth/BluetoothAdapter.java
+++ b/core/java/android/bluetooth/BluetoothAdapter.java
@@ -680,6 +680,10 @@
if (!getLeAccess()) {
return null;
}
+ if (!isMultipleAdvertisementSupported()) {
+ Log.e(TAG, "Bluetooth LE advertising not supported");
+ return null;
+ }
synchronized (mLock) {
if (sBluetoothLeAdvertiser == null) {
sBluetoothLeAdvertiser = new BluetoothLeAdvertiser(mManagerService);