When hearing aid device has been set active, we shouldn't invoke
1. a2dpProfile.setActiveDevice()
2. hfpProfile.setActiveDevice()
Change-Id: Ie13dea041dd98d0cb9d913e1f28574b300095db9
Fixes:
113625278
Test: RunSettingsRoboTests
if (hapProfile != null && hfpProfile != null && device == null) {
hfpProfile.setActiveDevice(null);
hapProfile.setActiveDevice(null);
- return;
- }
- if (hapProfile != null && hapProfile.getHiSyncId(device) != HI_SYNC_ID_INVALID) {
+ } else if (hapProfile != null && hapProfile.getHiSyncId(device) != HI_SYNC_ID_INVALID) {
hapProfile.setActiveDevice(device);
- }
- if (hfpProfile != null) {
+ } else if (hfpProfile != null) {
hfpProfile.setActiveDevice(device);
}
}
if (hapProfile != null && a2dpProfile != null && device == null) {
hapProfile.setActiveDevice(null);
a2dpProfile.setActiveDevice(null);
- return;
- }
- if (hapProfile != null && hapProfile.getHiSyncId(device) != HI_SYNC_ID_INVALID) {
+ } else if (hapProfile != null && hapProfile.getHiSyncId(device) != HI_SYNC_ID_INVALID) {
hapProfile.setActiveDevice(device);
- }
- if (a2dpProfile != null) {
+ } else if (a2dpProfile != null) {
a2dpProfile.setActiveDevice(device);
}
}
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
mController.setActiveBluetoothDevice(mLeftBluetoothHapDevice);
verify(mHearingAidProfile).setActiveDevice(mLeftBluetoothHapDevice);
+ verify(mHeadsetProfile, never()).setActiveDevice(mLeftBluetoothHapDevice);
}
/**
mController.setActiveBluetoothDevice(mBluetoothDevice);
verify(mHeadsetProfile).setActiveDevice(mBluetoothDevice);
+ verify(mHearingAidProfile, never()).setActiveDevice(mBluetoothDevice);
}
/**
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
mController.setActiveBluetoothDevice(mLeftBluetoothHapDevice);
verify(mHearingAidProfile).setActiveDevice(mLeftBluetoothHapDevice);
+ verify(mA2dpProfile, never()).setActiveDevice(mLeftBluetoothHapDevice);
}
/**
mController.setActiveBluetoothDevice(mBluetoothDevice);
verify(mA2dpProfile).setActiveDevice(mBluetoothDevice);
+ verify(mHearingAidProfile, never()).setActiveDevice(mBluetoothDevice);
}
/**