summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy
diff options
context:
space:
mode:
Diffstat (limited to 'services/audiopolicy')
-rw-r--r--services/audiopolicy/Android.mk4
-rw-r--r--services/audiopolicy/AudioPolicyInterface.h3
-rw-r--r--services/audiopolicy/managerdefault/AudioPolicyManager.cpp54
-rw-r--r--services/audiopolicy/service/AudioPolicyClientImpl.cpp6
-rw-r--r--services/audiopolicy/service/AudioPolicyClientImplLegacy.cpp5
-rw-r--r--services/audiopolicy/service/AudioPolicyEffects.cpp42
-rw-r--r--services/audiopolicy/service/AudioPolicyEffects.h12
-rw-r--r--services/audiopolicy/service/AudioPolicyInterfaceImplLegacy.cpp9
-rw-r--r--services/audiopolicy/service/AudioPolicyService.cpp121
-rw-r--r--services/audiopolicy/service/AudioPolicyService.h43
10 files changed, 238 insertions, 61 deletions
diff --git a/services/audiopolicy/Android.mk b/services/audiopolicy/Android.mk
index 5b38e1c..69fc0e8 100644
--- a/services/audiopolicy/Android.mk
+++ b/services/audiopolicy/Android.mk
@@ -40,6 +40,10 @@ LOCAL_SHARED_LIBRARIES += \
libaudiopolicymanager
endif
+ifeq ($(BOARD_HAVE_PRE_KITKAT_AUDIO_POLICY_BLOB),true)
+ LOCAL_CFLAGS += -DHAVE_PRE_KITKAT_AUDIO_POLICY_BLOB
+endif
+
LOCAL_STATIC_LIBRARIES := \
libmedia_helper \
libaudiopolicycomponents
diff --git a/services/audiopolicy/AudioPolicyInterface.h b/services/audiopolicy/AudioPolicyInterface.h
index c1e7bc0..a5edc14 100644
--- a/services/audiopolicy/AudioPolicyInterface.h
+++ b/services/audiopolicy/AudioPolicyInterface.h
@@ -331,6 +331,9 @@ public:
virtual audio_unique_id_t newAudioUniqueId() = 0;
virtual void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state) = 0;
+
+ virtual void onOutputSessionEffectsUpdate(audio_stream_type_t stream,
+ audio_unique_id_t sessionId, bool added) = 0;
};
extern "C" AudioPolicyInterface* createAudioPolicyManager(AudioPolicyClientInterface *clientInterface);
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 50b5087..13499ae 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -88,20 +88,6 @@ status_t AudioPolicyManager::setDeviceConnectionStateInt(audio_devices_t device,
}
ALOGV("setDeviceConnectionState() connecting device %x", device);
-#ifdef LEGACY_ALSA_AUDIO
- if (device & AUDIO_DEVICE_OUT_ALL_A2DP) {
- AudioParameter param;
- param.add(String8("a2dp_connected"), String8("true"));
- mpClientInterface->setParameters(0, param.toString());
- }
-
- if (device & AUDIO_DEVICE_OUT_USB_ACCESSORY) {
- AudioParameter param;
- param.add(String8("usb_connected"), String8("true"));
- mpClientInterface->setParameters(0, param.toString());
- }
-#endif
-
// register new device as available
index = mAvailableOutputDevices.add(devDesc);
if (index >= 0) {
@@ -153,20 +139,6 @@ status_t AudioPolicyManager::setDeviceConnectionStateInt(audio_devices_t device,
// remove device from available output devices
mAvailableOutputDevices.remove(devDesc);
-#ifdef LEGACY_ALSA_AUDIO
- if (device & AUDIO_DEVICE_OUT_ALL_A2DP) {
- AudioParameter param;
- param.add(String8("a2dp_connected"), String8("false"));
- mpClientInterface->setParameters(0, param.toString());
- }
-
- if (device & AUDIO_DEVICE_OUT_USB_ACCESSORY) {
- AudioParameter param;
- param.add(String8("usb_connected"), String8("true"));
- mpClientInterface->setParameters(0, param.toString());
- }
-#endif
-
checkOutputsForDevice(devDesc, state, outputs, devDesc->mAddress);
// Propagate device availability to Engine
@@ -333,11 +305,7 @@ void AudioPolicyManager::updateCallRouting(audio_devices_t rxDevice, int delayMs
if(!hasPrimaryOutput()) {
return;
}
-#ifdef LEGACY_ALSA_AUDIO
- audio_devices_t txDevice = getDeviceAndMixForInputSource(AUDIO_SOURCE_VOICE_CALL);
-#else
audio_devices_t txDevice = getDeviceAndMixForInputSource(AUDIO_SOURCE_VOICE_COMMUNICATION);
-#endif
ALOGV("updateCallRouting device rxDevice %08x txDevice %08x", rxDevice, txDevice);
// release existing RX patch if any
@@ -1423,22 +1391,6 @@ status_t AudioPolicyManager::getInputForAttr(const audio_attributes_t *attr,
} else {
*inputType = API_INPUT_LEGACY;
}
-#ifdef LEGACY_ALSA_AUDIO
- // adapt channel selection to input source
- switch (inputSource) {
- case AUDIO_SOURCE_VOICE_UPLINK:
- channelMask |= AUDIO_CHANNEL_IN_VOICE_UPLINK;
- break;
- case AUDIO_SOURCE_VOICE_DOWNLINK:
- channelMask |= AUDIO_CHANNEL_IN_VOICE_DNLINK;
- break;
- case AUDIO_SOURCE_VOICE_CALL:
- channelMask |= AUDIO_CHANNEL_IN_VOICE_UPLINK | AUDIO_CHANNEL_IN_VOICE_DNLINK;
- break;
- default:
- break;
- }
-#endif
if (inputSource == AUDIO_SOURCE_HOTWORD) {
ssize_t index = mSoundTriggerSessions.indexOfKey(session);
if (index >= 0) {
@@ -3947,13 +3899,11 @@ void AudioPolicyManager::checkOutputForAllStrategies()
void AudioPolicyManager::checkA2dpSuspend()
{
-#ifndef LEGACY_ALSA_AUDIO
audio_io_handle_t a2dpOutput = mOutputs.getA2dpOutput();
if (a2dpOutput == 0) {
mA2dpSuspended = false;
return;
}
-#endif
bool isScoConnected =
((mAvailableInputDevices.types() & AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET &
@@ -3978,9 +3928,7 @@ void AudioPolicyManager::checkA2dpSuspend()
((mEngine->getPhoneState() != AUDIO_MODE_IN_CALL) &&
(mEngine->getPhoneState() != AUDIO_MODE_RINGTONE))) {
-#ifndef LEGACY_ALSA_AUDIO
mpClientInterface->restoreOutput(a2dpOutput);
-#endif
mA2dpSuspended = false;
}
} else {
@@ -3990,9 +3938,7 @@ void AudioPolicyManager::checkA2dpSuspend()
((mEngine->getPhoneState() == AUDIO_MODE_IN_CALL) ||
(mEngine->getPhoneState() == AUDIO_MODE_RINGTONE))) {
-#ifndef LEGACY_ALSA_AUDIO
mpClientInterface->suspendOutput(a2dpOutput);
-#endif
mA2dpSuspended = true;
}
}
diff --git a/services/audiopolicy/service/AudioPolicyClientImpl.cpp b/services/audiopolicy/service/AudioPolicyClientImpl.cpp
index 489a9be..d71daa4 100644
--- a/services/audiopolicy/service/AudioPolicyClientImpl.cpp
+++ b/services/audiopolicy/service/AudioPolicyClientImpl.cpp
@@ -219,6 +219,12 @@ void AudioPolicyService::AudioPolicyClient::onDynamicPolicyMixStateUpdate(
mAudioPolicyService->onDynamicPolicyMixStateUpdate(regId, state);
}
+void AudioPolicyService::AudioPolicyClient::onOutputSessionEffectsUpdate(
+ audio_stream_type_t stream, audio_unique_id_t sessionId, bool added)
+{
+ mAudioPolicyService->onOutputSessionEffectsUpdate(stream, sessionId, added);
+}
+
audio_unique_id_t AudioPolicyService::AudioPolicyClient::newAudioUniqueId()
{
return AudioSystem::newAudioUniqueId();
diff --git a/services/audiopolicy/service/AudioPolicyClientImplLegacy.cpp b/services/audiopolicy/service/AudioPolicyClientImplLegacy.cpp
index a79f8ae..36c85f1 100644
--- a/services/audiopolicy/service/AudioPolicyClientImplLegacy.cpp
+++ b/services/audiopolicy/service/AudioPolicyClientImplLegacy.cpp
@@ -125,8 +125,13 @@ audio_io_handle_t aps_open_output_on_module(void *service __unused,
audio_output_flags_t flags,
const audio_offload_info_t *offloadInfo)
{
+#ifdef HAVE_PRE_KITKAT_AUDIO_POLICY_BLOB
+ return open_output(module, pDevices, pSamplingRate, pFormat, pChannelMask,
+ pLatencyMs, flags, NULL);
+#else
return open_output(module, pDevices, pSamplingRate, pFormat, pChannelMask,
pLatencyMs, flags, offloadInfo);
+#endif
}
audio_io_handle_t aps_open_dup_output(void *service __unused,
diff --git a/services/audiopolicy/service/AudioPolicyEffects.cpp b/services/audiopolicy/service/AudioPolicyEffects.cpp
index 26857b1..f2d7f6f 100644
--- a/services/audiopolicy/service/AudioPolicyEffects.cpp
+++ b/services/audiopolicy/service/AudioPolicyEffects.cpp
@@ -28,6 +28,7 @@
#include <utils/Vector.h>
#include <utils/SortedVector.h>
#include <cutils/config_utils.h>
+#include "AudioPolicyService.h"
#include "AudioPolicyEffects.h"
#include "ServiceUtilities.h"
@@ -37,7 +38,8 @@ namespace android {
// AudioPolicyEffects Implementation
// ----------------------------------------------------------------------------
-AudioPolicyEffects::AudioPolicyEffects()
+AudioPolicyEffects::AudioPolicyEffects(AudioPolicyService *audioPolicyService) :
+ mAudioPolicyService(audioPolicyService)
{
// load automatic audio effect modules
if (access(AUDIO_EFFECT_VENDOR_CONFIG_FILE2, R_OK) == 0) {
@@ -244,6 +246,8 @@ status_t AudioPolicyEffects::addOutputSessionEffects(audio_io_handle_t output,
if (idx < 0) {
procDesc = new EffectVector(audioSession);
mOutputSessions.add(audioSession, procDesc);
+
+ mAudioPolicyService->onOutputSessionEffectsUpdate(stream, audioSession, true);
} else {
// EffectVector is existing and we just need to increase ref count
procDesc = mOutputSessions.valueAt(idx);
@@ -291,15 +295,49 @@ status_t AudioPolicyEffects::releaseOutputSessionEffects(audio_io_handle_t outpu
}
EffectVector *procDesc = mOutputSessions.valueAt(index);
+
+ // just in case it already has a death wish
+ if (procDesc->mRefCount == 0) {
+ return NO_ERROR;
+ }
+
procDesc->mRefCount--;
ALOGV("releaseOutputSessionEffects(): session: %d, refCount: %d",
audioSession, procDesc->mRefCount);
+
+ if (procDesc->mRefCount == 0) {
+ mAudioPolicyService->releaseOutputSessionEffectsDelayed(
+ output, stream, audioSession, 10000);
+ }
+
+ return status;
+}
+
+status_t AudioPolicyEffects::doReleaseOutputSessionEffects(audio_io_handle_t output,
+ audio_stream_type_t stream,
+ int audioSession)
+{
+ status_t status = NO_ERROR;
+ (void) output; // argument not used for now
+
+ Mutex::Autolock _l(mLock);
+ ssize_t index = mOutputSessions.indexOfKey(audioSession);
+ if (index < 0) {
+ ALOGV("doReleaseOutputSessionEffects: no output processing was attached to this stream");
+ return NO_ERROR;
+ }
+
+ EffectVector *procDesc = mOutputSessions.valueAt(index);
+ ALOGV("doReleaseOutputSessionEffects(): session: %d, refCount: %d",
+ audioSession, procDesc->mRefCount);
+
if (procDesc->mRefCount == 0) {
procDesc->setProcessorEnabled(false);
procDesc->mEffects.clear();
delete procDesc;
mOutputSessions.removeItemsAt(index);
- ALOGV("releaseOutputSessionEffects(): output processing released from session: %d",
+ mAudioPolicyService->onOutputSessionEffectsUpdate(stream, audioSession, false);
+ ALOGV("doReleaseOutputSessionEffects(): output processing released from session: %d",
audioSession);
}
return status;
diff --git a/services/audiopolicy/service/AudioPolicyEffects.h b/services/audiopolicy/service/AudioPolicyEffects.h
index 3845050..7988515 100644
--- a/services/audiopolicy/service/AudioPolicyEffects.h
+++ b/services/audiopolicy/service/AudioPolicyEffects.h
@@ -31,6 +31,8 @@
namespace android {
+class AudioPolicyService;
+
// ----------------------------------------------------------------------------
// AudioPolicyEffects class
@@ -44,7 +46,7 @@ public:
// The constructor will parse audio_effects.conf
// First it will look whether vendor specific file exists,
// otherwise it will parse the system default file.
- AudioPolicyEffects();
+ AudioPolicyEffects(AudioPolicyService *audioPolicyService);
virtual ~AudioPolicyEffects();
// NOTE: methods on AudioPolicyEffects should never be called with the AudioPolicyService
@@ -84,6 +86,12 @@ public:
audio_stream_type_t stream,
int audioSession);
+ // For deferred release
+ status_t doReleaseOutputSessionEffects(audio_io_handle_t output,
+ audio_stream_type_t stream,
+ int audioSession);
+
+
private:
// class to store the description of an effects and its parameters
@@ -192,6 +200,8 @@ private:
KeyedVector< audio_stream_type_t, EffectDescVector* > mOutputStreams;
// Automatic output effects are unique for audiosession ID
KeyedVector< int32_t, EffectVector* > mOutputSessions;
+
+ AudioPolicyService *mAudioPolicyService;
};
}; // namespace android
diff --git a/services/audiopolicy/service/AudioPolicyInterfaceImplLegacy.cpp b/services/audiopolicy/service/AudioPolicyInterfaceImplLegacy.cpp
index f76b5c8..318c6d2 100644
--- a/services/audiopolicy/service/AudioPolicyInterfaceImplLegacy.cpp
+++ b/services/audiopolicy/service/AudioPolicyInterfaceImplLegacy.cpp
@@ -275,6 +275,11 @@ status_t AudioPolicyService::getInputForAttr(const audio_attributes_t *attr,
return BAD_VALUE;
}
+#ifdef HAVE_PRE_KITKAT_AUDIO_POLICY_BLOB
+ if (inputSource == AUDIO_SOURCE_HOTWORD)
+ inputSource = AUDIO_SOURCE_VOICE_RECOGNITION;
+#endif
+
sp<AudioPolicyEffects>audioPolicyEffects;
{
Mutex::Autolock _l(mLock);
@@ -524,6 +529,9 @@ status_t AudioPolicyService::queryDefaultPreProcessing(int audioSession,
bool AudioPolicyService::isOffloadSupported(const audio_offload_info_t& info)
{
+#ifdef HAVE_PRE_KITKAT_AUDIO_POLICY_BLOB
+ return false;
+#else
if (mpAudioPolicy == NULL) {
ALOGV("mpAudioPolicy == NULL");
return false;
@@ -535,6 +543,7 @@ bool AudioPolicyService::isOffloadSupported(const audio_offload_info_t& info)
}
return mpAudioPolicy->is_offload_supported(mpAudioPolicy, &info);
+#endif
}
status_t AudioPolicyService::listAudioPorts(audio_port_role_t role __unused,
diff --git a/services/audiopolicy/service/AudioPolicyService.cpp b/services/audiopolicy/service/AudioPolicyService.cpp
index 12cca65..58cfe37 100644
--- a/services/audiopolicy/service/AudioPolicyService.cpp
+++ b/services/audiopolicy/service/AudioPolicyService.cpp
@@ -116,7 +116,7 @@ void AudioPolicyService::onFirstRef()
#endif
}
// load audio processing modules
- sp<AudioPolicyEffects>audioPolicyEffects = new AudioPolicyEffects();
+ sp<AudioPolicyEffects>audioPolicyEffects = new AudioPolicyEffects(this);
{
Mutex::Autolock _l(mLock);
mAudioPolicyEffects = audioPolicyEffects;
@@ -177,6 +177,23 @@ void AudioPolicyService::setAudioPortCallbacksEnabled(bool enabled)
mNotificationClients.valueFor(uid)->setAudioPortCallbacksEnabled(enabled);
}
+status_t AudioPolicyService::setEffectSessionCallbacksEnabled(bool enabled)
+{
+ Mutex::Autolock _l(mNotificationClientsLock);
+
+ uid_t uid = IPCThreadState::self()->getCallingUid();
+ if (mNotificationClients.indexOfKey(uid) < 0) {
+ return NO_INIT;
+ }
+ if (!modifyAudioRoutingAllowed()) {
+ ALOGE("setEffectSessionCallbacksEnabled requires MODIFY_AUDIO_ROUTING");
+ return PERMISSION_DENIED;
+ }
+ mNotificationClients.valueFor(uid)->setEffectSessionCallbacksEnabled(enabled);
+ return OK;
+}
+
+
// removeNotificationClient() is called when the client process dies.
void AudioPolicyService::removeNotificationClient(uid_t uid)
{
@@ -254,11 +271,31 @@ status_t AudioPolicyService::clientSetAudioPortConfig(const struct audio_port_co
return mAudioCommandThread->setAudioPortConfigCommand(config, delayMs);
}
+void AudioPolicyService::onOutputSessionEffectsUpdate(audio_stream_type_t stream,
+ audio_unique_id_t sessionId,
+ bool added)
+{
+ ALOGV("AudioPolicyService::onOutputSessionEffectsUpdate(%d, %d, %d)",
+ stream, sessionId, added);
+ mOutputCommandThread->effectSessionUpdateCommand(stream, sessionId, added);
+}
+
+void AudioPolicyService::doOnOutputSessionEffectsUpdate(audio_stream_type_t stream,
+ audio_unique_id_t sessionId,
+ bool added)
+{
+ Mutex::Autolock _l(mNotificationClientsLock);
+ for (size_t i = 0; i < mNotificationClients.size(); i++) {
+ mNotificationClients.valueAt(i)->onOutputSessionEffectsUpdate(stream, sessionId, added);
+ }
+}
+
AudioPolicyService::NotificationClient::NotificationClient(const sp<AudioPolicyService>& service,
const sp<IAudioPolicyServiceClient>& client,
uid_t uid)
: mService(service), mUid(uid), mAudioPolicyServiceClient(client),
- mAudioPortCallbacksEnabled(false)
+ mAudioPortCallbacksEnabled(false),
+ mEffectSessionCallbacksEnabled(false)
{
}
@@ -289,6 +326,14 @@ void AudioPolicyService::NotificationClient::onAudioPatchListUpdate()
}
}
+void AudioPolicyService::NotificationClient::onOutputSessionEffectsUpdate(
+ audio_stream_type_t stream, audio_unique_id_t sessionId, bool added)
+{
+ if (mAudioPolicyServiceClient != 0 && mEffectSessionCallbacksEnabled) {
+ mAudioPolicyServiceClient->onOutputSessionEffectsUpdate(stream, sessionId, added);
+ }
+}
+
void AudioPolicyService::NotificationClient::onDynamicPolicyMixStateUpdate(
String8 regId, int32_t state)
{
@@ -302,12 +347,23 @@ void AudioPolicyService::NotificationClient::setAudioPortCallbacksEnabled(bool e
mAudioPortCallbacksEnabled = enabled;
}
+void AudioPolicyService::NotificationClient::setEffectSessionCallbacksEnabled(bool enabled)
+{
+ mEffectSessionCallbacksEnabled = enabled;
+}
void AudioPolicyService::binderDied(const wp<IBinder>& who) {
ALOGW("binderDied() %p, calling pid %d", who.unsafe_get(),
IPCThreadState::self()->getCallingPid());
}
+void AudioPolicyService::releaseOutputSessionEffectsDelayed(
+ audio_io_handle_t output, audio_stream_type_t stream,
+ audio_unique_id_t sessionId, int delayMs)
+{
+ mAudioCommandThread->releaseOutputSessionEffectsCommand(output, stream, sessionId, delayMs);
+}
+
static bool tryLock(Mutex& mutex)
{
bool locked = false;
@@ -579,6 +635,35 @@ bool AudioPolicyService::AudioCommandThread::threadLoop()
svc->doOnDynamicPolicyMixStateUpdate(data->mRegId, data->mState);
mLock.lock();
} break;
+ case EFFECT_SESSION_UPDATE: {
+ EffectSessionUpdateData *data =
+ (EffectSessionUpdateData *)command->mParam.get();
+ ALOGV("AudioCommandThread() processing effect session update %d %d %d",
+ data->mStream, data->mSessionId, data->mAdded);
+ svc = mService.promote();
+ if (svc == 0) {
+ break;
+ }
+ mLock.unlock();
+ svc->doOnOutputSessionEffectsUpdate(data->mStream, data->mSessionId, data->mAdded);
+ mLock.lock();
+ } break;
+ case RELEASE_OUTPUT_SESSION_EFFECTS: {
+ ReleaseOutputSessionEffectsData *data =
+ (ReleaseOutputSessionEffectsData *)command->mParam.get();
+ ALOGV("AudioCommandThread() processing release output session effects %d %d %d",
+ data->mOutput, data->mStream, data->mSessionId);
+ svc = mService.promote();
+ if (svc == 0) {
+ break;
+ }
+ mLock.unlock();
+ svc->mAudioPolicyEffects->doReleaseOutputSessionEffects(
+ data->mOutput, data->mStream, data->mSessionId);
+ mLock.lock();
+ } break;
+
+
default:
ALOGW("AudioCommandThread() unknown command %d", command->mCommand);
}
@@ -851,6 +936,38 @@ void AudioPolicyService::AudioCommandThread::dynamicPolicyMixStateUpdateCommand(
sendCommand(command);
}
+void AudioPolicyService::AudioCommandThread::effectSessionUpdateCommand(
+ audio_stream_type_t stream, audio_unique_id_t sessionId, bool added)
+{
+ sp<AudioCommand> command = new AudioCommand();
+ command->mCommand = EFFECT_SESSION_UPDATE;
+ EffectSessionUpdateData *data = new EffectSessionUpdateData();
+ data->mStream = stream;
+ data->mSessionId = sessionId;
+ data->mAdded = added;
+ command->mParam = data;
+ ALOGV("AudioCommandThread() sending effect session update (id=%d) for stream %d (added=%d)",
+ stream, sessionId, added);
+ sendCommand(command);
+}
+
+void AudioPolicyService::AudioCommandThread::releaseOutputSessionEffectsCommand(
+ audio_io_handle_t output, audio_stream_type_t stream,
+ audio_unique_id_t sessionId, int delayMs)
+{
+ sp<AudioCommand> command = new AudioCommand();
+ command->mCommand = RELEASE_OUTPUT_SESSION_EFFECTS;
+ ReleaseOutputSessionEffectsData *data = new ReleaseOutputSessionEffectsData();
+ data->mOutput = output;
+ data->mStream = stream;
+ data->mSessionId = sessionId;
+ command->mParam = data;
+ ALOGV("AudioCommandThread() sending release output session effects (id=%d) for stream %d",
+ sessionId, stream);
+ sendCommand(command, delayMs);
+}
+
+
status_t AudioPolicyService::AudioCommandThread::sendCommand(sp<AudioCommand>& command, int delayMs)
{
{
diff --git a/services/audiopolicy/service/AudioPolicyService.h b/services/audiopolicy/service/AudioPolicyService.h
index d11294b..9b17a26 100644
--- a/services/audiopolicy/service/AudioPolicyService.h
+++ b/services/audiopolicy/service/AudioPolicyService.h
@@ -202,6 +202,8 @@ public:
audio_io_handle_t *handle);
virtual status_t stopAudioSource(audio_io_handle_t handle);
+ virtual status_t setEffectSessionCallbacksEnabled(bool enabled);
+
status_t doStartOutput(audio_io_handle_t output,
audio_stream_type_t stream,
audio_session_t session);
@@ -229,6 +231,15 @@ public:
void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state);
void doOnDynamicPolicyMixStateUpdate(String8 regId, int32_t state);
+ void onOutputSessionEffectsUpdate(audio_stream_type_t stream,
+ audio_unique_id_t sessionId, bool added);
+ void doOnOutputSessionEffectsUpdate(audio_stream_type_t stream,
+ audio_unique_id_t sessionId, bool added);
+ void releaseOutputSessionEffectsDelayed(audio_io_handle_t output,
+ audio_stream_type_t stream,
+ audio_unique_id_t sessionId,
+ int delayMs);
+
private:
AudioPolicyService() ANDROID_API;
virtual ~AudioPolicyService();
@@ -260,7 +271,9 @@ private:
UPDATE_AUDIOPORT_LIST,
UPDATE_AUDIOPATCH_LIST,
SET_AUDIOPORT_CONFIG,
- DYN_POLICY_MIX_STATE_UPDATE
+ DYN_POLICY_MIX_STATE_UPDATE,
+ EFFECT_SESSION_UPDATE,
+ RELEASE_OUTPUT_SESSION_EFFECTS,
};
AudioCommandThread (String8 name, const wp<AudioPolicyService>& service);
@@ -303,6 +316,12 @@ private:
int delayMs);
void dynamicPolicyMixStateUpdateCommand(String8 regId, int32_t state);
void insertCommand_l(AudioCommand *command, int delayMs = 0);
+ void effectSessionUpdateCommand(audio_stream_type_t stream,
+ audio_unique_id_t sessionId, bool added);
+ void releaseOutputSessionEffectsCommand(audio_io_handle_t output,
+ audio_stream_type_t stream,
+ audio_unique_id_t sessionId,
+ int delayMs = 0);
private:
class AudioCommandData;
@@ -399,6 +418,20 @@ private:
int32_t mState;
};
+ class EffectSessionUpdateData : public AudioCommandData {
+ public:
+ audio_stream_type_t mStream;
+ audio_unique_id_t mSessionId;
+ bool mAdded;
+ };
+
+ class ReleaseOutputSessionEffectsData : public AudioCommandData {
+ public:
+ audio_io_handle_t mOutput;
+ audio_stream_type_t mStream;
+ audio_unique_id_t mSessionId;
+ };
+
Mutex mLock;
Condition mWaitWorkCV;
Vector < sp<AudioCommand> > mAudioCommands; // list of pending commands
@@ -508,6 +541,9 @@ private:
virtual audio_unique_id_t newAudioUniqueId();
+ virtual void onOutputSessionEffectsUpdate(audio_stream_type_t stream,
+ audio_unique_id_t sessionId, bool added);
+
private:
AudioPolicyService *mAudioPolicyService;
};
@@ -524,7 +560,9 @@ private:
void onAudioPatchListUpdate();
void onDynamicPolicyMixStateUpdate(String8 regId, int32_t state);
void setAudioPortCallbacksEnabled(bool enabled);
-
+ void setEffectSessionCallbacksEnabled(bool enabled);
+ void onOutputSessionEffectsUpdate(audio_stream_type_t stream,
+ audio_unique_id_t sessionId, bool added);
// IBinder::DeathRecipient
virtual void binderDied(const wp<IBinder>& who);
@@ -536,6 +574,7 @@ private:
const uid_t mUid;
const sp<IAudioPolicyServiceClient> mAudioPolicyServiceClient;
bool mAudioPortCallbacksEnabled;
+ bool mEffectSessionCallbacksEnabled;
};
// Internal dump utilities.