Merge "Fix testcase failed" into udc-qpr-dev

This commit is contained in:
SongFerng Wang
2023-08-01 10:55:39 +00:00
committed by Android (Google) Code Review
3 changed files with 8 additions and 6 deletions

View File

@@ -89,7 +89,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
mManager = manager;
mProfileManager = mManager.getProfileManager();
mCachedDevice = device;
mAllOfCachedDevices = Utils.getAllOfCachedBluetoothDevices(mContext, mCachedDevice);
mAllOfCachedDevices = Utils.getAllOfCachedBluetoothDevices(mManager, mCachedDevice);
lifecycle.addObserver(this);
}
@@ -460,7 +460,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
for (CachedBluetoothDevice item : mAllOfCachedDevices) {
item.unregisterCallback(this);
}
mAllOfCachedDevices = Utils.getAllOfCachedBluetoothDevices(mContext, mCachedDevice);
mAllOfCachedDevices = Utils.getAllOfCachedBluetoothDevices(mManager, mCachedDevice);
for (CachedBluetoothDevice item : mAllOfCachedDevices) {
item.registerCallback(this);
}

View File

@@ -88,6 +88,7 @@ public class LeAudioBluetoothDetailsHeaderController extends BasePreferenceContr
@VisibleForTesting
LayoutPreference mLayoutPreference;
LocalBluetoothManager mManager;
private CachedBluetoothDevice mCachedDevice;
private List<CachedBluetoothDevice> mAllOfCachedDevices;
@VisibleForTesting
@@ -152,8 +153,9 @@ public class LeAudioBluetoothDetailsHeaderController extends BasePreferenceContr
public void init(CachedBluetoothDevice cachedBluetoothDevice,
LocalBluetoothManager bluetoothManager) {
mCachedDevice = cachedBluetoothDevice;
mManager = bluetoothManager;
mProfileManager = bluetoothManager.getProfileManager();
mAllOfCachedDevices = Utils.getAllOfCachedBluetoothDevices(mContext, mCachedDevice);
mAllOfCachedDevices = Utils.getAllOfCachedBluetoothDevices(mManager, mCachedDevice);
}
@VisibleForTesting
@@ -300,7 +302,7 @@ public class LeAudioBluetoothDetailsHeaderController extends BasePreferenceContr
for (CachedBluetoothDevice item : mAllOfCachedDevices) {
item.unregisterCallback(this);
}
mAllOfCachedDevices = Utils.getAllOfCachedBluetoothDevices(mContext, mCachedDevice);
mAllOfCachedDevices = Utils.getAllOfCachedBluetoothDevices(mManager, mCachedDevice);
for (CachedBluetoothDevice item : mAllOfCachedDevices) {
item.registerCallback(this);
}

View File

@@ -235,7 +235,8 @@ public final class Utils {
* @param cachedBluetoothDevice The main cachedBluetoothDevice.
* @return all cachedBluetoothDevices with the same groupId.
*/
public static List<CachedBluetoothDevice> getAllOfCachedBluetoothDevices(Context context,
public static List<CachedBluetoothDevice> getAllOfCachedBluetoothDevices(
LocalBluetoothManager localBtMgr,
CachedBluetoothDevice cachedBluetoothDevice) {
List<CachedBluetoothDevice> cachedBluetoothDevices = new ArrayList<>();
if (cachedBluetoothDevice == null) {
@@ -248,7 +249,6 @@ public final class Utils {
return cachedBluetoothDevices;
}
final LocalBluetoothManager localBtMgr = Utils.getLocalBtManager(context);
if (localBtMgr == null) {
Log.e(TAG, "getAllOfCachedBluetoothDevices: no LocalBluetoothManager");
return cachedBluetoothDevices;