Hide pair other ear button after device connected via CSIP

The pair other ear button should disappear after both ears of binaural
hearing aids are connected.

Remove checking if CSIP is enabled since CSIP is always enabled in
pairing stage.

Bug: 296646732
Test: check the UI manually
Change-Id: I804819eef41b5d3754ad0a79d9fc1afc66cef5cc
This commit is contained in:
Angela Wang
2023-08-29 07:20:49 +00:00
parent dfc20ff941
commit 7a15ecafde
4 changed files with 152 additions and 55 deletions

View File

@@ -156,14 +156,13 @@ public class HearingAidUtilsTest {
}
@Test
public void launchHearingAidPairingDialog_deviceSupportsCsip_csipEnabled_noDialog() {
public void launchHearingAidPairingDialog_deviceSupportsCsip_noDialog() {
when(mCachedBluetoothDevice.isConnectedAshaHearingAidDevice()).thenReturn(true);
when(mCachedBluetoothDevice.getDeviceMode()).thenReturn(
HearingAidInfo.DeviceMode.MODE_BINAURAL);
when(mCachedBluetoothDevice.getDeviceSide()).thenReturn(
HearingAidInfo.DeviceSide.SIDE_LEFT);
makeDeviceSupportCsip();
makeDeviceEnableCsip(true);
HearingAidUtils.launchHearingAidPairingDialog(mFragmentManager, mCachedBluetoothDevice,
TEST_LAUNCH_PAGE);
@@ -173,24 +172,6 @@ public class HearingAidUtilsTest {
assertThat(dialog).isNull();
}
@Test
public void launchHearingAidPairingDialog_deviceSupportsCsip_csipDisabled_dialogShown() {
when(mCachedBluetoothDevice.isConnectedAshaHearingAidDevice()).thenReturn(true);
when(mCachedBluetoothDevice.getDeviceMode()).thenReturn(
HearingAidInfo.DeviceMode.MODE_BINAURAL);
when(mCachedBluetoothDevice.getDeviceSide()).thenReturn(
HearingAidInfo.DeviceSide.SIDE_LEFT);
makeDeviceSupportCsip();
makeDeviceEnableCsip(false);
HearingAidUtils.launchHearingAidPairingDialog(mFragmentManager, mCachedBluetoothDevice,
TEST_LAUNCH_PAGE);
shadowMainLooper().idle();
final AlertDialog dialog = ShadowAlertDialogCompat.getLatestAlertDialog();
assertThat(dialog.isShowing()).isTrue();
}
@Test
public void launchHearingAidPairingDialog_dialogShown() {
when(mCachedBluetoothDevice.isConnectedAshaHearingAidDevice()).thenReturn(true);
@@ -213,11 +194,6 @@ public class HearingAidUtilsTest {
when(mCachedBluetoothDevice.getProfiles()).thenReturn(uuids);
}
private void makeDeviceEnableCsip(boolean enabled) {
when(mCsipSetCoordinatorProfile.isEnabled(mCachedBluetoothDevice.getDevice()))
.thenReturn(enabled);
}
private void setupEnvironment() {
ShadowBluetoothUtils.sLocalBluetoothManager = mLocalBluetoothManager;
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();