Fix the device summary shown twice issue

As getSubDeviceSummy, we should check the memberDevices's size and
decide if the secondarySummary need to be shown.

Bug: 201491295
Bug: 150670922
Test: pair with the A2DP/HFP headset, and check the summary
Change-Id: I8bb0744067733c6e17292d6c7be1c3f110d731e3
This commit is contained in:
Alice Kuo
2021-10-04 18:05:57 +08:00
parent 73a065a41f
commit cd5a8483be

View File

@@ -139,14 +139,14 @@ public class CachedBluetoothDeviceManager {
*/
public synchronized String getSubDeviceSummary(CachedBluetoothDevice device) {
final Set<CachedBluetoothDevice> memberDevices = device.getMemberDevice();
if (memberDevices != null) {
// TODO: check the CSIP group size instead of the real member device set size, and adjust
// the size restriction.
if (memberDevices.size() == 1) {
for (CachedBluetoothDevice memberDevice : memberDevices) {
if (!memberDevice.isConnected()) {
return null;
if (memberDevice.isConnected()) {
return memberDevice.getConnectionSummary();
}
}
return device.getConnectionSummary();
}
CachedBluetoothDevice subDevice = device.getSubDevice();
if (subDevice != null && subDevice.isConnected()) {