Skip to content
Commit f0fa7f9b authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Register IBluetoothManagerCallback per-process.

As part of introducing AttributionSource across the Bluetooth stack
earlier this year, each BluetoothAdapter instance is now associated
with a specific AttributionSource, and several instances of shared
static code were made BluetoothAdapter-specific so they could be
augmented with the relevant AttributionSource.

However, processes that create many BluetoothAdapter instances can
overload the system, since a IBluetoothManagerCallback was registered
for each instance.  This change mitigates this by only registering a
single IBluetoothManagerCallback for the entire process, and it
then reuses the existing sProxyServiceStateCallbacks list for
dispatching events to all active adapters within the process.

Since it's so late in the release, we keep both mService and
sService intact to minimize the size of this CL; future work should
refactor to a more robust design, such as Supplier<IBluetooth>.

Bug: 195286998, 172022978
Test: atest BluetoothInstrumentationTests
Change-Id: I012f3f65e61eaf55e40436486806e56506c928ee
parent 5f51b922
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment