I have an android device acting as a hands free client device using hfp.
I am able to receive a call and the speakers and mic are working as expected.
My problem is that I can't seem to control the volume.
I tried using the following lines of code to find the correct stream, but none of them seem to work.
I tracked the volume command being sent from the phone to the client in the class HeadsetClientStateMachine
, line #1822 in the following link: HeadsetClientStateMachine from lolipop
case EVENT_TYPE_VOLUME_CHANGED:
if (event.valueInt == HeadsetClientHalConstants.VOLUME_TYPE_SPK) {
mAudioManager.setStreamVolume(AudioManager.STREAM_BLUETOOTH_SCO, event.valueInt2, AudioManager.FLAG_SHOW_UI);
mVgsFromStack = true;
Log.d(TAG, "EventVolumeChange STREAM_BLUETOOTH_SCO value: " + event.valueInt2);
}
When I change the volume on the phone, I do see the log showing the updated value of the sound, which means that the setStreamVolume()
method is being called, but the volume doesn't change.
Does anyone know what could be causing this issue?
EDIT:
I am still looking for an answer and am now looking toward the audio HAL implementation. I suspect that the link between the HAL and the audio driver is somehow incorrect... I don't know much about low level implementation and am not sure what I should be looking for.