OSDN Git Service

Remove unnecessary advertiser count check
authorJakub Pawlowski <jpawlowski@google.com>
Tue, 22 Nov 2016 23:46:51 +0000 (15:46 -0800)
committerJakub Pawlowski <jpawlowski@google.com>
Tue, 22 Nov 2016 23:49:55 +0000 (15:49 -0800)
Bluetooth stack won't allow to register more advertisers that it can
handle, so checking count of registered advertisers make no sense when
calling startAdvertising.

Bug: 30622771
Test: sl4a ConcurrentBleAdvertisingTest
Change-Id: Ifbaf583871cf59ce8e345d7bca8e9a9ea1540734

src/com/android/bluetooth/gatt/AdvertiseManager.java

index a6d271e..edada43 100644 (file)
@@ -201,11 +201,6 @@ class AdvertiseManager {
                 return;
             }
 
-            if (mAdvertiseClients.size() >= maxAdvertiseInstances()) {
-                postCallback(advertiserId,
-                        AdvertiseCallback.ADVERTISE_FAILED_TOO_MANY_ADVERTISERS);
-                return;
-            }
             if (!mAdvertiseNative.startAdverising(client)) {
                 postCallback(advertiserId, AdvertiseCallback.ADVERTISE_FAILED_INTERNAL_ERROR);
                 return;
@@ -230,11 +225,6 @@ class AdvertiseManager {
                 mAdvertiseClients.remove(client);
             }
         }
-
-        // Returns maximum advertise instances supported by controller.
-        int maxAdvertiseInstances() {
-            return mAdapterService.getNumOfAdvertisementInstancesSupported();
-        }
     }
 
     // Class that wraps advertise native related constants, methods etc.