To refresh/register/unregister all of the devices with same groupId
Since the LE audio have two or more devices in the same group and the UI show their status at one preference, the UI need to register callback for each of the devices, and also refresh the deviceList. Bug: 278155752 Test: local test to pairing the device and check the battery part Change-Id: I2fcde92a1f68b8437465b234820f7bad13dfc444
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import android.bluetooth.BluetoothCsipSetCoordinator;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothProfile;
|
||||
import android.content.Context;
|
||||
@@ -89,7 +88,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
||||
mManager = manager;
|
||||
mProfileManager = mManager.getProfileManager();
|
||||
mCachedDevice = device;
|
||||
mAllOfCachedDevices = getAllOfCachedBluetoothDevices();
|
||||
mAllOfCachedDevices = Utils.getAllOfCachedBluetoothDevices(mContext, mCachedDevice);
|
||||
lifecycle.addObserver(this);
|
||||
}
|
||||
|
||||
@@ -319,20 +318,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<CachedBluetoothDevice> getAllOfCachedBluetoothDevices() {
|
||||
List<CachedBluetoothDevice> cachedBluetoothDevices = new ArrayList<>();
|
||||
if (mCachedDevice == null) {
|
||||
return cachedBluetoothDevices;
|
||||
}
|
||||
cachedBluetoothDevices.add(mCachedDevice);
|
||||
if (mCachedDevice.getGroupId() != BluetoothCsipSetCoordinator.GROUP_ID_INVALID) {
|
||||
for (CachedBluetoothDevice member : mCachedDevice.getMemberDevice()) {
|
||||
cachedBluetoothDevices.add(member);
|
||||
}
|
||||
}
|
||||
return cachedBluetoothDevices;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the Le Audio profile, VCP, and CSIP for each of the Le Audio devices.
|
||||
*
|
||||
@@ -480,7 +465,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
||||
for (CachedBluetoothDevice item : mAllOfCachedDevices) {
|
||||
item.unregisterCallback(this);
|
||||
}
|
||||
mAllOfCachedDevices = getAllOfCachedBluetoothDevices();
|
||||
mAllOfCachedDevices = Utils.getAllOfCachedBluetoothDevices(mContext, mCachedDevice);
|
||||
for (CachedBluetoothDevice item : mAllOfCachedDevices) {
|
||||
item.registerCallback(this);
|
||||
}
|
||||
|
Reference in New Issue
Block a user