Loading src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java +8 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,8 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll "persist.bluetooth.leaudio.toggle_visible"; private static final String BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY = "persist.bluetooth.leaudio.bypass_allow_list"; private static final String LE_AUDIO_TOGGLE_VISIBLE_FOR_ASHA_PROPERTY = "bluetooth.leaudio.toggle_visible_for_asha"; private Set<String> mInvisibleProfiles = Collections.emptySet(); private final AtomicReference<Set<String>> mAdditionalInvisibleProfiles = Loading Loading @@ -378,6 +380,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll // Remove hearing aids toggle anyway since showing the toggle will confuse users if (hearingAidSupported) { result.remove(mManager.getProfileManager().getHearingAidProfile()); if (leAudioSupported && !SystemProperties.getBoolean(BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY, false) && !SystemProperties.getBoolean( LE_AUDIO_TOGGLE_VISIBLE_FOR_ASHA_PROPERTY, true)) { result.remove(mManager.getProfileManager().getLeAudioProfile()); } } if (leAudioSupported && !classicAudioSupported && !hearingAidSupported) { mIsLeAudioOnlyDevice = true; Loading tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsProfilesControllerTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.os.SystemProperties; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.platform.test.flag.junit.SetFlagsRule; Loading Loading @@ -646,6 +647,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont List<SwitchPreferenceCompat> switches = getProfileSwitches(false); assertThat(switches.isEmpty()).isTrue(); } @Test public void ashaHearingAidWithLeAudio_showLeAudioToggle() { setupDevice(makeDefaultDeviceConfig()); Loading @@ -658,4 +660,16 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont assertThat(switches.getFirst().getTitle()).isEqualTo( mContext.getString(mLeAudioProfile.getNameResource(mDevice))); } @Test public void ashaHearingAidWithLeAudio_hideLeAudioToggleFromSystemProperties() { setupDevice(makeDefaultDeviceConfig()); addHearingAidProfileToDevice(false); addLeAudioProfileToDevice(true); SystemProperties.set("bluetooth.leaudio.toggle_visible_for_asha", "false"); showScreen(mController); List<SwitchPreferenceCompat> switches = getProfileSwitches(false); assertThat(switches.isEmpty()).isTrue(); } } Loading
src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java +8 −0 Original line number Diff line number Diff line Loading @@ -85,6 +85,8 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll "persist.bluetooth.leaudio.toggle_visible"; private static final String BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY = "persist.bluetooth.leaudio.bypass_allow_list"; private static final String LE_AUDIO_TOGGLE_VISIBLE_FOR_ASHA_PROPERTY = "bluetooth.leaudio.toggle_visible_for_asha"; private Set<String> mInvisibleProfiles = Collections.emptySet(); private final AtomicReference<Set<String>> mAdditionalInvisibleProfiles = Loading Loading @@ -378,6 +380,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll // Remove hearing aids toggle anyway since showing the toggle will confuse users if (hearingAidSupported) { result.remove(mManager.getProfileManager().getHearingAidProfile()); if (leAudioSupported && !SystemProperties.getBoolean(BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY, false) && !SystemProperties.getBoolean( LE_AUDIO_TOGGLE_VISIBLE_FOR_ASHA_PROPERTY, true)) { result.remove(mManager.getProfileManager().getLeAudioProfile()); } } if (leAudioSupported && !classicAudioSupported && !hearingAidSupported) { mIsLeAudioOnlyDevice = true; Loading
tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsProfilesControllerTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.os.SystemProperties; import android.platform.test.flag.junit.CheckFlagsRule; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.platform.test.flag.junit.SetFlagsRule; Loading Loading @@ -646,6 +647,7 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont List<SwitchPreferenceCompat> switches = getProfileSwitches(false); assertThat(switches.isEmpty()).isTrue(); } @Test public void ashaHearingAidWithLeAudio_showLeAudioToggle() { setupDevice(makeDefaultDeviceConfig()); Loading @@ -658,4 +660,16 @@ public class BluetoothDetailsProfilesControllerTest extends BluetoothDetailsCont assertThat(switches.getFirst().getTitle()).isEqualTo( mContext.getString(mLeAudioProfile.getNameResource(mDevice))); } @Test public void ashaHearingAidWithLeAudio_hideLeAudioToggleFromSystemProperties() { setupDevice(makeDefaultDeviceConfig()); addHearingAidProfileToDevice(false); addLeAudioProfileToDevice(true); SystemProperties.set("bluetooth.leaudio.toggle_visible_for_asha", "false"); showScreen(mController); List<SwitchPreferenceCompat> switches = getProfileSwitches(false); assertThat(switches.isEmpty()).isTrue(); } }