remove LocalBluetoothAdapter usage
- replace LocalBluetoothAdapter with BluetoothAdapter.getDefaultAdapter() to call functions
- remove LocalBluetoothAdapter from each Bluetooth profile constructor
- no more pass LocalBluetoothAdapter to CachedBluetoothDeviceManager::addDevice()
Bug: 111815935
Test: make -j50 RunSettingsLibRoboTests
Change-Id: I2d2178c6e83034b08690d459973868a9ba583429
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpSinkProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpSinkProfile.java
index 6a4aa0a..0c4e02b 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpSinkProfile.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpSinkProfile.java
@@ -38,7 +38,6 @@
private BluetoothA2dpSink mService;
private boolean mIsProfileReady;
- private final LocalBluetoothAdapter mLocalAdapter;
private final CachedBluetoothDeviceManager mDeviceManager;
static final ParcelUuid[] SRC_UUIDS = {
@@ -67,7 +66,7 @@
// we may add a new device here, but generally this should not happen
if (device == null) {
Log.w(TAG, "A2dpSinkProfile found new device: " + nextDevice);
- device = mDeviceManager.addDevice(mLocalAdapter, nextDevice);
+ device = mDeviceManager.addDevice(nextDevice);
}
device.onProfileStateChanged(A2dpSinkProfile.this, BluetoothProfile.STATE_CONNECTED);
device.refresh();
@@ -90,13 +89,11 @@
return BluetoothProfile.A2DP_SINK;
}
- A2dpSinkProfile(Context context, LocalBluetoothAdapter adapter,
- CachedBluetoothDeviceManager deviceManager,
+ A2dpSinkProfile(Context context, CachedBluetoothDeviceManager deviceManager,
LocalBluetoothProfileManager profileManager) {
- mLocalAdapter = adapter;
mDeviceManager = deviceManager;
mProfileManager = profileManager;
- mLocalAdapter.getProfileProxy(context, new A2dpSinkServiceListener(),
+ BluetoothAdapter.getDefaultAdapter().getProfileProxy(context, new A2dpSinkServiceListener(),
BluetoothProfile.A2DP_SINK);
}