OSDN Git Service

Cleanup startAdvertising call
authorJakub Pawlowski <jpawlowski@google.com>
Wed, 23 Nov 2016 19:43:37 +0000 (11:43 -0800)
committerJakub Pawlowski <jpawlowski@google.com>
Wed, 23 Nov 2016 23:57:56 +0000 (23:57 +0000)
commit52ec4e757eff12405d0d074d58822b061cd77d84
tree2b59998543dbdf45c944b68758ccef59ced67963
parent8fc01bd0eb8bb3f4c28661bbe7d8edf7c6be41c4
Cleanup startAdvertising call

AdvertiseManager.startAdvertising no longer sends multiple commands.
Its native counterpart, BleAdvertisingManagerImpl.RegisterAdvertiser,
thanks to better tests, guarantees that it either sends a success or
error callback. Therefore, no additional synchronization is required.

The only cases when the native code can get executed without a callback
are when the controller sends no response, or the bta thread is stuck.
Both of those cases should result in a crash and restart of bluetooth.

This patch also fixes an error, where if a timeout happens, the  error
callback gets called twice.

Bug: 30622771
Test: sl4a ConcurrentBleAdvertising
Change-Id: I72a729f4da2bd8d5d62a81a6f93dbadab088a036
src/com/android/bluetooth/gatt/AdvertiseManager.java
src/com/android/bluetooth/gatt/GattService.java