Show the multiple Mac address for the coordinated set

Show the mac address for all the devices if the device detail combine
with the multiple connections based on CSIP.

Screenshot: https://screenshot.googleplex.com/qQjc2pxNTr3tMUV

Bug: 178981521
Test: pair with the coordinated set, and check the UI
Change-Id: I01e0ec91e5c856481318d6435d174b5a2018d820
Merged-In: I01e0ec91e5c856481318d6435d174b5a2018d820
This commit is contained in:
Alice Kuo
2021-09-14 14:42:48 +08:00
parent f57f720c38
commit 9f11a4cddf
2 changed files with 13 additions and 1 deletions

View File

@@ -1912,6 +1912,8 @@
<string name="device_details_title">Device details</string> <string name="device_details_title">Device details</string>
<!-- Title of the item to show device MAC address --> <!-- Title of the item to show device MAC address -->
<string name="bluetooth_device_mac_address">Device\'s Bluetooth address: <xliff:g id="address">%1$s</xliff:g></string> <string name="bluetooth_device_mac_address">Device\'s Bluetooth address: <xliff:g id="address">%1$s</xliff:g></string>
<!-- Title of the items to show multuple devices MAC address [CHAR LIMIT=NONE]-->
<string name="bluetooth_multuple_devices_mac_address">Device\'s Bluetooth address:\n<xliff:g id="address">%1$s</xliff:g></string>
<!-- Bluetooth device details. The title of a confirmation dialog for unpairing a paired device. [CHAR LIMIT=60] --> <!-- Bluetooth device details. The title of a confirmation dialog for unpairing a paired device. [CHAR LIMIT=60] -->
<string name="bluetooth_unpair_dialog_title">Forget device?</string> <string name="bluetooth_unpair_dialog_title">Forget device?</string>
<!-- Content Description for companion device app associations removal button [CHAR LIMIT=28]--> <!-- Content Description for companion device app associations removal button [CHAR LIMIT=28]-->

View File

@@ -16,6 +16,7 @@
package com.android.settings.bluetooth; package com.android.settings.bluetooth;
import android.bluetooth.BluetoothCsipSetCoordinator;
import android.content.Context; import android.content.Context;
import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceFragmentCompat;
@@ -50,9 +51,18 @@ public class BluetoothDetailsMacAddressController extends BluetoothDetailsContro
@Override @Override
protected void refresh() { protected void refresh() {
if (mCachedDevice.getGroupId() != BluetoothCsipSetCoordinator.GROUP_ID_INVALID) {
StringBuilder mTitle = new StringBuilder(mContext.getString(
R.string.bluetooth_multuple_devices_mac_address, mCachedDevice.getAddress()));
for (CachedBluetoothDevice member: mCachedDevice.getMemberDevice()) {
mTitle.append("\n").append(member.getAddress());
}
mFooterPreference.setTitle(mTitle);
} else {
mFooterPreference.setTitle(mContext.getString( mFooterPreference.setTitle(mContext.getString(
R.string.bluetooth_device_mac_address, mCachedDevice.getAddress())); R.string.bluetooth_device_mac_address, mCachedDevice.getAddress()));
} }
}
@Override @Override
public String getPreferenceKey() { public String getPreferenceKey() {