summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrulan Martin <trulanm@gmail.com>2016-01-23 20:02:35 -0500
committerZiyan <jaraidaniel@gmail.com>2016-02-10 20:12:41 +0100
commita3e97a7d54e4e13ab4a2c547a05eb03c2e3d7559 (patch)
tree16b6493f6def7bf91123dc9fed29d223af70e4f5
parentf9e5c79f5de76ef376da6c09a17c91933ac9a49f (diff)
downloaddevice_samsung_tuna-a3e97a7d54e4e13ab4a2c547a05eb03c2e3d7559.zip
device_samsung_tuna-a3e97a7d54e4e13ab4a2c547a05eb03c2e3d7559.tar.gz
device_samsung_tuna-a3e97a7d54e4e13ab4a2c547a05eb03c2e3d7559.tar.bz2
tuna: fix in call mic mute for toro and toroplus
Adapted from a patch by @MWisBest Change-Id: I1b0cb2db0e5473088eb42b623bfd902332b1ec47
-rw-r--r--audio/audio_hw.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index 6c74d84..bb39fef 100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -3600,8 +3600,27 @@ static int adev_set_mic_mute(struct audio_hw_device *dev, bool state)
{
struct tuna_audio_device *adev = (struct tuna_audio_device *)dev;
- if (adev->mode == AUDIO_MODE_IN_CALL)
- ril_set_mic_mute(&adev->ril, state);
+ /* Muting the microphone for calls works differently.
+ * Basically, the mic_mute flag causes in_read to 0 out its read data,
+ * however in_read is not used in the RIL context and has no effect there.
+ * Previous versions of Android would send the mic mute command to the RIL,
+ * however it is now expected to be handled here instead. */
+
+ if (adev->mode == AUDIO_MODE_IN_CALL) {
+ ril_set_mic_mute(&adev->ril, state);
+ /* While we would prefer to keep the traditional behavior of telling
+ * the RIL to mute the mic, this is not doable on toro due to its RIL
+ * ignoring the particular RIL_REQUEST_OEM_HOOK_RAW for it, which is
+ * the only feasible way to do it from a source like the audio HAL.
+ * Instead we must go over the RIL's head and change the mixer volume.
+ * select_output_device also uses this same method to mute the in-call
+ * mic, albeit temporarily, as well. */
+ unsigned int channel;
+ int volume = (state ? 0 : MIXER_ABE_GAIN_0DB);
+ for (channel = 0; channel < 2; channel++)
+ mixer_ctl_set_value(adev->mixer_ctls.voice_ul_volume,
+ channel, volume);
+ }
adev->mic_mute = state;