summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/libmedia/AudioSystem.cpp9
-rw-r--r--media/libmedia/IAudioPolicyService.cpp17
2 files changed, 26 insertions, 0 deletions
diff --git a/media/libmedia/AudioSystem.cpp b/media/libmedia/AudioSystem.cpp
index 5624df4..207f96f 100644
--- a/media/libmedia/AudioSystem.cpp
+++ b/media/libmedia/AudioSystem.cpp
@@ -735,6 +735,15 @@ status_t AudioSystem::isStreamActive(audio_stream_type_t stream, bool* state, ui
return NO_ERROR;
}
+status_t AudioSystem::isSourceActive(audio_source_t stream, bool* state)
+{
+ const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
+ if (aps == 0) return PERMISSION_DENIED;
+ if (state == NULL) return BAD_VALUE;
+ *state = aps->isSourceActive(stream);
+ return NO_ERROR;
+}
+
int32_t AudioSystem::getPrimaryOutputSamplingRate()
{
const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
diff --git a/media/libmedia/IAudioPolicyService.cpp b/media/libmedia/IAudioPolicyService.cpp
index 31c5d27..401437c 100644
--- a/media/libmedia/IAudioPolicyService.cpp
+++ b/media/libmedia/IAudioPolicyService.cpp
@@ -52,6 +52,7 @@ enum {
REGISTER_EFFECT,
UNREGISTER_EFFECT,
IS_STREAM_ACTIVE,
+ IS_SOURCE_ACTIVE,
GET_DEVICES_FOR_STREAM,
QUERY_DEFAULT_PRE_PROCESSING,
SET_EFFECT_ENABLED
@@ -329,6 +330,15 @@ public:
return reply.readInt32();
}
+ virtual bool isSourceActive(audio_source_t source) const
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
+ data.writeInt32((int32_t) source);
+ remote()->transact(IS_SOURCE_ACTIVE, data, &reply);
+ return reply.readInt32();
+ }
+
virtual status_t queryDefaultPreProcessing(int audioSession,
effect_descriptor_t *descriptors,
uint32_t *count)
@@ -592,6 +602,13 @@ status_t BnAudioPolicyService::onTransact(
return NO_ERROR;
} break;
+ case IS_SOURCE_ACTIVE: {
+ CHECK_INTERFACE(IAudioPolicyService, data, reply);
+ audio_source_t source = (audio_source_t) data.readInt32();
+ reply->writeInt32( isSourceActive(source));
+ return NO_ERROR;
+ }
+
case QUERY_DEFAULT_PRE_PROCESSING: {
CHECK_INTERFACE(IAudioPolicyService, data, reply);
int audioSession = data.readInt32();