Skip to content
Browse files

e510: Fix volume in speakerphone mode.

LG uses SPEAKER_IN_CALL for speakerphone.

Change-Id: I82763bb7204bc18a52dc4096661a785a1d802a4b
  • Loading branch information...
1 parent bbb0e1b commit e6fbadffedea2b2056b52e8f91e65fd6c73da572 @mik9 mik9 committed with rmcc Jan 15, 2012
Showing with 14 additions and 0 deletions.
  1. +8 −0 libaudio/AudioHardware.cpp
  2. +6 −0 libaudio/AudioPolicyManager.cpp
View
8 libaudio/AudioHardware.cpp
@@ -40,6 +40,7 @@
#define COMBO_DEVICE_SUPPORTED 0 // Headset speaker combo device not supported on this target
#define DUALMIC_KEY "dualmic_enabled"
#define TTY_MODE_KEY "tty_mode"
+#define DEVICE_OUT_SPEAKER_IN_CALL 0x4000
namespace android {
static int audpre_index, tx_iir_index;
@@ -86,6 +87,7 @@ static int snd_device = -1;
static uint32_t SND_DEVICE_CURRENT=-1;
static uint32_t SND_DEVICE_HANDSET=-1;
static uint32_t SND_DEVICE_SPEAKER=-1;
+static uint32_t SND_DEVICE_SPEAKER_IN_CALL=-1;
static uint32_t SND_DEVICE_BT=-1;
static uint32_t SND_DEVICE_BT_EC_OFF=-1;
static uint32_t SND_DEVICE_HEADSET=-1;
@@ -127,6 +129,7 @@ AudioHardware::AudioHardware() :
CHECK_FOR(CURRENT);
CHECK_FOR(HANDSET);
CHECK_FOR(SPEAKER);
+ CHECK_FOR(SPEAKER_IN_CALL);
CHECK_FOR(BT);
CHECK_FOR(BT_EC_OFF);
CHECK_FOR(HEADSET);
@@ -1136,6 +1139,7 @@ status_t AudioHardware::setMasterVolume(float v)
LOGI("Set master volume to %d.\n", vol);
set_volume_rpc(SND_DEVICE_HANDSET, SND_METHOD_VOICE, vol, m7xsnddriverfd);
set_volume_rpc(SND_DEVICE_SPEAKER, SND_METHOD_VOICE, vol, m7xsnddriverfd);
+ set_volume_rpc(SND_DEVICE_SPEAKER_IN_CALL, SND_METHOD_VOICE, vol, m7xsnddriverfd);
set_volume_rpc(SND_DEVICE_BT, SND_METHOD_VOICE, vol, m7xsnddriverfd);
set_volume_rpc(SND_DEVICE_HEADSET, SND_METHOD_VOICE, vol, m7xsnddriverfd);
set_volume_rpc(SND_DEVICE_HEADSET_STEREO, SND_METHOD_VOICE, vol, m7xsnddriverfd);
@@ -1357,6 +1361,10 @@ status_t AudioHardware::doRouting(AudioStreamInMSM72xx *input)
new_snd_device = SND_DEVICE_SPEAKER;
}
new_post_proc_feature_mask = (ADRC_ENABLE | EQ_ENABLE | RX_IIR_ENABLE | MBADRC_ENABLE);
+ } else if (outputDevices & DEVICE_OUT_SPEAKER_IN_CALL) {
+ LOGI("Routing audio to Speakerphone\n");
+ new_snd_device = SND_DEVICE_SPEAKER_IN_CALL;
+ new_post_proc_feature_mask = (ADRC_ENABLE | EQ_ENABLE | RX_IIR_ENABLE | MBADRC_ENABLE);
} else {
LOGI("Routing audio to Handset\n");
new_snd_device = SND_DEVICE_HANDSET;
View
6 libaudio/AudioPolicyManager.cpp
@@ -16,6 +16,7 @@
#define LOG_TAG "AudioPolicyManager"
//#define LOG_NDEBUG 0
+#define DEVICE_OUT_SPEAKER_IN_CALL 0x4000
#include <utils/Log.h>
#include "AudioPolicyManager.h"
#include <media/mediarecorder.h>
@@ -115,6 +116,11 @@ uint32_t AudioPolicyManager::getDeviceForStrategy(routing_strategy strategy, boo
if (device) break;
}
#endif
+ if (mPhoneState == AudioSystem::MODE_IN_CALL) {
+ device = DEVICE_OUT_SPEAKER_IN_CALL;
+ if (device) break;
+ }
+
device = mAvailableOutputDevices & AudioSystem::DEVICE_OUT_SPEAKER;
if (device == 0) {
LOGE("getDeviceForStrategy() speaker device not found");

0 comments on commit e6fbadf

Please sign in to comment.
Something went wrong with that request. Please try again.