Add the way for hiding the "contact sharing" on the pairing dialog

There is the way to hide the "contact sharing" at the "device details"
page, but it did not be implemented on the pairing dialog. Add this way
on pairing dialog.

Bug: 246668278
Test: make RunSettingsRoboTests ROBOTEST_FILTER=BluetoothPairingControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=BluetoothPairingDialogTest

Change-Id: I472acb80e70fe5d2a59cb9eed95fcbccfa417fa5
This commit is contained in:
SongFerngWang
2022-09-23 21:21:25 +08:00
parent 9b24df2c38
commit 51cabc5553
4 changed files with 234 additions and 17 deletions

View File

@@ -274,13 +274,12 @@ public class BluetoothPairingDialogTest {
}
@Test
public void dialogShowsContactSharingCheckboxWhenBluetoothProfileNotReady() {
public void contactSharingCheckbox_conditionIsReady_showsUi() {
// set the dialog variant to confirmation/consent
when(controller.getDialogType()).thenReturn(BluetoothPairingController.CONFIRMATION_DIALOG);
// set a fake device name and pretend the profile has not been set up for it
when(controller.getDeviceName()).thenReturn(FAKE_DEVICE_NAME);
when(controller.isProfileReady()).thenReturn(false);
when(controller.isContactSharingVisible()).thenReturn(true);
// build the fragment
BluetoothPairingDialogFragment frag = makeFragment();
@@ -292,13 +291,12 @@ public class BluetoothPairingDialogTest {
}
@Test
public void dialogHidesContactSharingCheckboxWhenBluetoothProfileIsReady() {
public void contactSharingCheckbox_conditionIsNotReady_doesNotShowUi() {
// set the dialog variant to confirmation/consent
when(controller.getDialogType()).thenReturn(BluetoothPairingController.CONFIRMATION_DIALOG);
// set a fake device name and pretend the profile has been set up for it
when(controller.getDeviceName()).thenReturn(FAKE_DEVICE_NAME);
when(controller.isProfileReady()).thenReturn(true);
when(controller.isContactSharingVisible()).thenReturn(false);
// build the fragment
BluetoothPairingDialogFragment frag = makeFragment();