Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Automatically switch FM audio according to virtual device

Switch FM radio when DEVICE_OUT_FM connection state changes. This
simplifies FM audio routing setup.

Change-Id: I7a0727bf5354b379032d1c29a28a754829431ca1
  • Loading branch information...
commit 90f5447c66b319eca739e9451fe87b321785939f 1 parent eb587e7
@grigorig authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 libaudio/AudioPolicyManager.cpp
View
9 libaudio/AudioPolicyManager.cpp
@@ -400,11 +400,16 @@ status_t AudioPolicyManager::setDeviceConnectionState(AudioSystem::audio_devices
#ifdef QCOM_FM_ENABLED
if (device == AudioSystem::DEVICE_OUT_FM) {
+ AudioOutputDescriptor *out = mOutputs.valueFor(mPrimaryOutput);
if (state == AudioSystem::DEVICE_STATE_AVAILABLE) {
- mOutputs.valueFor(mPrimaryOutput)->changeRefCount(AudioSystem::FM, 1);
+ out->changeRefCount(AudioSystem::FM, 1);
+ if (out->refCount() > 0)
+ mpClientInterface->setParameters(0, String8("fm_on=1"));
}
else {
- mOutputs.valueFor(mPrimaryOutput)->changeRefCount(AudioSystem::FM, -1);
+ out->changeRefCount(AudioSystem::FM, -1);
+ if (out->refCount() <= 0)
+ mpClientInterface->setParameters(0, String8("fm_off=1"));
}
}
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.