diff options
author | Eric Laurent <elaurent@google.com> | 2011-08-04 10:47:36 -0700 |
---|---|---|
committer | Eric Laurent <elaurent@google.com> | 2011-08-09 11:27:04 -0700 |
commit | 8f35a34b4d9ad7d752e83ef44a741106ac70a008 (patch) | |
tree | 73ef7ab93fe000474df6679a8af2de81b390fe8d /audio/audio_hw.c | |
parent | f2f0dcc7058f6f074dc23de5cf5375de0c2ca596 (diff) | |
download | device_samsung_tuna-8f35a34b4d9ad7d752e83ef44a741106ac70a008.zip device_samsung_tuna-8f35a34b4d9ad7d752e83ef44a741106ac70a008.tar.gz device_samsung_tuna-8f35a34b4d9ad7d752e83ef44a741106ac70a008.tar.bz2 |
audio HAL: implement microphone mute.
This fixes issue 5099308: AudioManager.isMicrophoneMute() always returns true on Prime.
Change-Id: I7edf7aade2f46725e1fa9685744f21d63a4529a6
Diffstat (limited to 'audio/audio_hw.c')
-rw-r--r-- | audio/audio_hw.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 0569763..97505af 100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -321,6 +321,7 @@ struct tuna_audio_device { int sub_mic_on; float voice_volume; struct tuna_stream_in *active_input; + bool mic_mute; /* RIL */ struct ril_handle ril; }; @@ -1042,6 +1043,9 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer, ret = pcm_read(in->pcm, buffer, bytes); } + if (ret == 0 && adev->mic_mute) + memset(buffer, 0, bytes); + exit: if (ret < 0) usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) / @@ -1183,12 +1187,20 @@ static int adev_set_mode(struct audio_hw_device *dev, int mode) static int adev_set_mic_mute(struct audio_hw_device *dev, bool state) { - return -ENOSYS; + struct tuna_audio_device *adev = (struct tuna_audio_device *)dev; + + adev->mic_mute = state; + + return 0; } static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state) { - return -ENOSYS; + struct tuna_audio_device *adev = (struct tuna_audio_device *)dev; + + *state = adev->mic_mute; + + return 0; } static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev, |