diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2011-11-07 00:11:43 +0000 |
---|---|---|
committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2011-11-07 00:11:43 +0000 |
commit | f2a9c771a52a5f5a37eebf15b1259bc1ac6ee11b (patch) | |
tree | 76e7c38f8ef64f5de385b877196d22f55dc75441 /services | |
parent | 497e8031a48d0ed71835903b836a394ad017c2fc (diff) | |
download | frameworks_base-f2a9c771a52a5f5a37eebf15b1259bc1ac6ee11b.zip frameworks_base-f2a9c771a52a5f5a37eebf15b1259bc1ac6ee11b.tar.gz frameworks_base-f2a9c771a52a5f5a37eebf15b1259bc1ac6ee11b.tar.bz2 |
audioflinger: Add support for the LGE star's FM radio
Unlike qcom, FM isn't enabled by setting a magic output device,
but by setting a specific FM audio mode. So set that mode instead
of using the qcom logic of output routing.
Change-Id: Ie5851b33aa9260dee6183be894a600db7a98350c
Diffstat (limited to 'services')
-rw-r--r-- | services/audioflinger/AudioFlinger.cpp | 9 | ||||
-rw-r--r-- | services/audioflinger/AudioPolicyService.cpp | 17 |
2 files changed, 25 insertions, 1 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp index b3f0e13..cf424be 100644 --- a/services/audioflinger/AudioFlinger.cpp +++ b/services/audioflinger/AudioFlinger.cpp @@ -477,6 +477,13 @@ status_t AudioFlinger::setMode(int mode) return BAD_VALUE; } +#ifdef HAS_LGE_STAR_FM_RADIO + if (mode == AudioSystem::MODE_FM) { + mFmOn = true; + } else if (mFmOn) { + mFmOn = false; + } +#endif { // scope for the lock AutoMutex lock(mHardwareLock); mHardwareStatus = AUDIO_HW_SET_MODE; @@ -680,7 +687,7 @@ status_t AudioFlinger::setParameters(int ioHandle, const String8& keyValuePairs) } } #endif -#ifdef HAVE_FM_RADIO +#if defined(HAVE_FM_RADIO) && !defined(HAS_LGE_STAR_FM_RADIO) AudioParameter param = AudioParameter(keyValuePairs); String8 key = String8(AudioParameter::keyRouting); int device; diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp index c5fac14..ae08058 100644 --- a/services/audioflinger/AudioPolicyService.cpp +++ b/services/audioflinger/AudioPolicyService.cpp @@ -124,6 +124,16 @@ status_t AudioPolicyService::setDeviceConnectionState(AudioSystem::audio_devices return BAD_VALUE; } +#ifdef HAS_LGE_STAR_FM_RADIO + if (device & AudioSystem::DEVICE_OUT_FM) { + if (state == AudioSystem::DEVICE_STATE_AVAILABLE) { + setPhoneState(AudioSystem::MODE_FM); + } else { + setPhoneState(AudioSystem::MODE_NORMAL); + } + } +#endif + LOGV("setDeviceConnectionState() tid %d", gettid()); Mutex::Autolock _l(mLock); return mpPolicyManager->setDeviceConnectionState(device, state, device_address); @@ -325,6 +335,13 @@ status_t AudioPolicyService::setStreamVolumeIndex(AudioSystem::stream_type strea if (!checkPermission()) { return PERMISSION_DENIED; } +#ifdef HAS_LGE_STAR_FM_RADIO + /* The star's audio HAL has STREAM_FM as 8. The java layer + * sends CM's "standard" STREAM_FM as 10, convert it here */ + if (stream == AudioSystem::FM) { + stream=(AudioSystem::stream_type)8; + } +#endif if (stream < 0 || stream >= AudioSystem::NUM_STREAM_TYPES) { return BAD_VALUE; } |