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

@@ -42,9 +42,10 @@ public final class HearingAidUtils {
*/
public static void launchHearingAidPairingDialog(FragmentManager fragmentManager,
@NonNull CachedBluetoothDevice device, int launchPage) {
// No need to show the pair another ear dialog if the device supports and enables CSIP.
// No need to show the pair another ear dialog if the device supports CSIP.
// CSIP will pair other devices in the same set automatically.
if (isCsipSupportedAndEnabled(device)) {
if (device.getProfiles().stream().anyMatch(
profile -> profile instanceof CsipSetCoordinatorProfile)) {
return;
}
if (device.isConnectedAshaHearingAidDevice()
@@ -63,10 +64,4 @@ public final class HearingAidUtils {
HearingAidPairingDialogFragment.newInstance(device.getAddress(), launchPage)
.show(fragmentManager, HearingAidPairingDialogFragment.TAG);
}
private static boolean isCsipSupportedAndEnabled(@NonNull CachedBluetoothDevice device) {
return device.getProfiles().stream().anyMatch(
profile -> (profile instanceof CsipSetCoordinatorProfile)
&& (profile.isEnabled(device.getDevice())));
}
}