Make bluetooth profile toggles configurable
BUG: 343317785 Test: atest BluetoothDetailsProfilesControllerTest Flag: com.android.settings.flags.enable_bluetooth_device_details_polish Change-Id: I5aea110f7a42ffee20a56dbd9d5621f44311cc66
This commit is contained in:
@@ -120,11 +120,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont
|
||||
.thenAnswer(invocation -> ImmutableList.of(mConnectableProfiles));
|
||||
|
||||
setupDevice(mDeviceConfig);
|
||||
mController = new BluetoothDetailsProfilesController(mContext, mFragment, mLocalManager,
|
||||
mCachedDevice, mLifecycle);
|
||||
mProfiles.setKey(mController.getPreferenceKey());
|
||||
mController.mProfilesContainer = mProfiles;
|
||||
mScreen.addPreference(mProfiles);
|
||||
initController(List.of());
|
||||
BluetoothProperties.le_audio_allow_list(Lists.newArrayList(LE_DEVICE_MODEL));
|
||||
}
|
||||
|
||||
@@ -554,6 +550,36 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont
|
||||
|
||||
@Test
|
||||
public void prefKeyInBlockingList_hideToggle() {
|
||||
initController(List.of("A2DP"));
|
||||
setupDevice(makeDefaultDeviceConfig());
|
||||
|
||||
addA2dpProfileToDevice(true, true, true);
|
||||
when(mFeatureProvider.getInvisibleProfilePreferenceKeys(any(), any()))
|
||||
.thenReturn(ImmutableSet.of());
|
||||
|
||||
showScreen(mController);
|
||||
|
||||
List<SwitchPreferenceCompat> switches = getProfileSwitches(false);
|
||||
assertThat(switches.get(0).isVisible()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void prefKeyNotInBlockingList_showToggle() {
|
||||
initController(List.of());
|
||||
setupDevice(makeDefaultDeviceConfig());
|
||||
|
||||
addA2dpProfileToDevice(true, true, true);
|
||||
when(mFeatureProvider.getInvisibleProfilePreferenceKeys(any(), any()))
|
||||
.thenReturn(ImmutableSet.of());
|
||||
|
||||
showScreen(mController);
|
||||
|
||||
List<SwitchPreferenceCompat> switches = getProfileSwitches(false);
|
||||
assertThat(switches.get(0).isVisible()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void prefKeyInFeatureProviderBlockingList_hideToggle() {
|
||||
setupDevice(makeDefaultDeviceConfig());
|
||||
|
||||
addA2dpProfileToDevice(true, true, true);
|
||||
@@ -567,7 +593,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont
|
||||
}
|
||||
|
||||
@Test
|
||||
public void prefKeyNotInBlockingList_showToggle() {
|
||||
public void prefKeyNotInFeatureProviderBlockingList_showToggle() {
|
||||
setupDevice(makeDefaultDeviceConfig());
|
||||
|
||||
addA2dpProfileToDevice(true, true, true);
|
||||
@@ -627,4 +653,13 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont
|
||||
assertThat(switches.getFirst().getTitle()).isEqualTo(
|
||||
mContext.getString(mLeAudioProfile.getNameResource(mDevice)));
|
||||
}
|
||||
|
||||
private void initController(List<String> invisibleProfiles) {
|
||||
mController = new BluetoothDetailsProfilesController(mContext, mFragment, mLocalManager,
|
||||
mCachedDevice, mLifecycle, invisibleProfiles);
|
||||
mProfiles.setKey(mController.getPreferenceKey());
|
||||
mController.mProfilesContainer = mProfiles;
|
||||
mScreen.removeAll();
|
||||
mScreen.addPreference(mProfiles);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user