Show identity address in the bluetooth details page

Bug: 197044261
Test: build pass
Change-Id: Ic1ef1d575f35c4b37d6f9195ec10dd31ed5bdd5b
This commit is contained in:
Chienyuan
2022-01-18 16:46:46 +08:00
committed by Chienyuan Huang
parent 0ccb8750b9
commit 84a9b23ba8
7 changed files with 11 additions and 4 deletions

View File

@@ -46,21 +46,22 @@ public class BluetoothDetailsMacAddressController extends BluetoothDetailsContro
protected void init(PreferenceScreen screen) {
mFooterPreference = screen.findPreference(KEY_DEVICE_DETAILS_FOOTER);
mFooterPreference.setTitle(mContext.getString(
R.string.bluetooth_device_mac_address, mCachedDevice.getAddress()));
R.string.bluetooth_device_mac_address, mCachedDevice.getIdentityAddress()));
}
@Override
protected void refresh() {
if (mCachedDevice.getGroupId() != BluetoothCsipSetCoordinator.GROUP_ID_INVALID) {
StringBuilder title = new StringBuilder(mContext.getString(
R.string.bluetooth_multuple_devices_mac_address, mCachedDevice.getAddress()));
R.string.bluetooth_multuple_devices_mac_address,
mCachedDevice.getIdentityAddress()));
for (CachedBluetoothDevice member: mCachedDevice.getMemberDevice()) {
title.append("\n").append(member.getAddress());
title.append("\n").append(member.getIdentityAddress());
}
mFooterPreference.setTitle(title);
} else {
mFooterPreference.setTitle(mContext.getString(
R.string.bluetooth_device_mac_address, mCachedDevice.getAddress()));
R.string.bluetooth_device_mac_address, mCachedDevice.getIdentityAddress()));
}
}

View File

@@ -99,6 +99,7 @@ public class AdvancedBluetoothDetailsHeaderControllerTest {
mController.mBluetoothAdapter = mBluetoothAdapter;
when(mCachedDevice.getDevice()).thenReturn(mBluetoothDevice);
when(mCachedDevice.getAddress()).thenReturn(MAC_ADDRESS);
when(mCachedDevice.getIdentityAddress()).thenReturn(MAC_ADDRESS);
}
@Test

View File

@@ -155,6 +155,7 @@ public abstract class BluetoothDetailsControllerTestBase {
mDevice = mBluetoothAdapter.getRemoteDevice(config.getAddress());
when(mCachedDevice.getDevice()).thenReturn(mDevice);
when(mCachedDevice.getAddress()).thenReturn(config.getAddress());
when(mCachedDevice.getIdentityAddress()).thenReturn(config.getAddress());
}
/**

View File

@@ -89,6 +89,7 @@ public class BluetoothDeviceDetailsFragmentTest {
when(fragmentManager.beginTransaction()).thenReturn(mFragmentTransaction);
when(mCachedDevice.getAddress()).thenReturn(TEST_ADDRESS);
when(mCachedDevice.getIdentityAddress()).thenReturn(TEST_ADDRESS);
Bundle args = new Bundle();
args.putString(BluetoothDeviceDetailsFragment.KEY_DEVICE_ADDRESS, TEST_ADDRESS);
mFragment.setArguments(args);

View File

@@ -305,6 +305,7 @@ public class BluetoothPairingDetailTest {
when(cachedDevice.isConnected()).thenReturn(true);
when(cachedDevice.getDevice()).thenReturn(device2);
when(cachedDevice.getAddress()).thenReturn(TEST_DEVICE_ADDRESS_B);
when(cachedDevice.getIdentityAddress()).thenReturn(TEST_DEVICE_ADDRESS_B);
mFragment.onProfileConnectionStateChanged(cachedDevice, BluetoothProfile.A2DP,
BluetoothAdapter.STATE_CONNECTED);

View File

@@ -73,6 +73,7 @@ public class ForgetDeviceDialogFragmentTest {
FakeFeatureFactory.setupForTest();
String deviceAddress = "55:66:77:88:99:AA";
when(mCachedDevice.getAddress()).thenReturn(deviceAddress);
when(mCachedDevice.getIdentityAddress()).thenReturn(deviceAddress);
when(mCachedDevice.getDevice()).thenReturn(mBluetoothDevice);
when(mCachedDevice.getName()).thenReturn(DEVICE_NAME);
mFragment = spy(ForgetDeviceDialogFragment.newInstance(deviceAddress));

View File

@@ -62,6 +62,7 @@ public class RemoteDeviceNameDialogFragmentTest {
String deviceAddress = "55:66:77:88:99:AA";
when(mCachedDevice.getAddress()).thenReturn(deviceAddress);
when(mCachedDevice.getIdentityAddress()).thenReturn(deviceAddress);
mFragment = spy(RemoteDeviceNameDialogFragment.newInstance(mCachedDevice));
doReturn(mCachedDevice).when(mFragment).getDevice(any());
}