Fix some connection issues for dual mode hearing devices

1. Fix NPE crash when ASHA profile connected
For dual mode device, the other device in the same pair will be grouped in memberDevice rather than grouped in subDevice. Before switchSubDeviceContent() is called, we should make sure that subDevice is really exist, otherwise, switchMemberDeviceContent() should be called instead.

2. Fix UI issue when main device is disconnected
When the devices in the same group is connected/disconnected, CsipDeviceManager will update the relationship between main/member devices. However, when we turn off the LE audio toggle for the dual moded devices, the CSIP will be disabled and hence the CsipDeviceManager will not be called to update the relationship. To correctly update the relationship between devices in the same pair when LE audio toggle is off, we should call switchMemberDeviceContent() in HearingAidDeviceManager when ASHA profile is connected/disconnected.

Bug: 345485443
Bug: 345379628
Flag: EXEMPT bugfix
Test: atest HearingAidDeviceManagerTest
Test: manually check the ui and no crashes occur
Change-Id: I266e7228f6a7c4f67fef1da5b20a1962927a8e48
2 files changed