Merge "[LE Audio] Add BT LE headset check for voice call to update the icon"
This commit is contained in:
@@ -429,6 +429,11 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa
|
||||
AudioManager.DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER |
|
||||
AudioManager.DEVICE_OUT_BLE_HEADSET)) != 0;
|
||||
changed |= updateStreamRoutedToBluetoothW(stream, routedToBluetooth);
|
||||
} else if (stream == AudioManager.STREAM_VOICE_CALL) {
|
||||
final boolean routedToBluetooth =
|
||||
(mAudio.getDevicesForStream(AudioManager.STREAM_VOICE_CALL)
|
||||
& AudioManager.DEVICE_OUT_BLE_HEADSET) != 0;
|
||||
changed |= updateStreamRoutedToBluetoothW(stream, routedToBluetooth);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
@@ -1677,6 +1677,7 @@ public class VolumeDialogImpl implements VolumeDialog,
|
||||
if (ss.level == row.requestedLevel) {
|
||||
row.requestedLevel = -1;
|
||||
}
|
||||
final boolean isVoiceCallStream = row.stream == AudioManager.STREAM_VOICE_CALL;
|
||||
final boolean isA11yStream = row.stream == STREAM_ACCESSIBILITY;
|
||||
final boolean isRingStream = row.stream == AudioManager.STREAM_RING;
|
||||
final boolean isSystemStream = row.stream == AudioManager.STREAM_SYSTEM;
|
||||
@@ -1721,8 +1722,12 @@ public class VolumeDialogImpl implements VolumeDialog,
|
||||
} else if (isRingSilent || zenMuted) {
|
||||
iconRes = row.iconMuteRes;
|
||||
} else if (ss.routedToBluetooth) {
|
||||
iconRes = isStreamMuted(ss) ? R.drawable.ic_volume_media_bt_mute
|
||||
: R.drawable.ic_volume_media_bt;
|
||||
if (isVoiceCallStream) {
|
||||
iconRes = R.drawable.ic_volume_bt_sco;
|
||||
} else {
|
||||
iconRes = isStreamMuted(ss) ? R.drawable.ic_volume_media_bt_mute
|
||||
: R.drawable.ic_volume_media_bt;
|
||||
}
|
||||
} else if (isStreamMuted(ss)) {
|
||||
iconRes = ss.muted ? R.drawable.ic_volume_media_off : row.iconMuteRes;
|
||||
} else {
|
||||
|
||||
@@ -166,6 +166,34 @@ public class VolumeDialogControllerImplTest extends SysuiTestCase {
|
||||
LOCK_TASK_MODE_NONE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVolumeChangeW_deviceOutFromBLEHeadset_doStateChanged() {
|
||||
mVolumeController.setDeviceInteractive(false);
|
||||
when(mWakefullnessLifcycle.getWakefulness()).thenReturn(
|
||||
WakefulnessLifecycle.WAKEFULNESS_AWAKE);
|
||||
when(mAudioManager.getDevicesForStream(AudioManager.STREAM_VOICE_CALL)).thenReturn(
|
||||
AudioManager.DEVICE_OUT_BLE_HEADSET);
|
||||
|
||||
mVolumeController.onVolumeChangedW(
|
||||
AudioManager.STREAM_VOICE_CALL, AudioManager.FLAG_SHOW_UI);
|
||||
|
||||
verify(mCallback, times(1)).onStateChanged(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVolumeChangeW_deviceOutFromA2DP_doStateChanged() {
|
||||
mVolumeController.setDeviceInteractive(false);
|
||||
when(mWakefullnessLifcycle.getWakefulness()).thenReturn(
|
||||
WakefulnessLifecycle.WAKEFULNESS_AWAKE);
|
||||
when(mAudioManager.getDevicesForStream(AudioManager.STREAM_VOICE_CALL)).thenReturn(
|
||||
AudioManager.DEVICE_OUT_BLUETOOTH_A2DP);
|
||||
|
||||
mVolumeController.onVolumeChangedW(
|
||||
AudioManager.STREAM_VOICE_CALL, AudioManager.FLAG_SHOW_UI);
|
||||
|
||||
verify(mCallback, never()).onStateChanged(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnRemoteVolumeChanged_newStream_noNullPointer() {
|
||||
MediaSession.Token token = new MediaSession.Token(Process.myUid(), null);
|
||||
|
||||
Reference in New Issue
Block a user