AudioPolicyService.h revision eda6c364c253ba97ee45a3adeb8c2b45db1f81db
165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian/* 265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian * Copyright (C) 2009 The Android Open Source Project 365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian * 465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian * Licensed under the Apache License, Version 2.0 (the "License"); 565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian * you may not use this file except in compliance with the License. 665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian * You may obtain a copy of the License at 765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian * 865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian * http://www.apache.org/licenses/LICENSE-2.0 965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian * 1065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian * Unless required by applicable law or agreed to in writing, software 1165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian * distributed under the License is distributed on an "AS IS" BASIS, 1265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian * See the License for the specific language governing permissions and 1465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian * limitations under the License. 1565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian */ 1665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 1765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian#ifndef ANDROID_AUDIOPOLICYSERVICE_H 1865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian#define ANDROID_AUDIOPOLICYSERVICE_H 1965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 2065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian#include <media/IAudioPolicyService.h> 2165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian#include <hardware_legacy/AudioPolicyInterface.h> 2265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian#include <media/ToneGenerator.h> 2365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian#include <utils/Vector.h> 2465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 2565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopiannamespace android { 2665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 2765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopianclass String8; 2865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 2965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian// ---------------------------------------------------------------------------- 3065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 31de070137f11d346fba77605bd76a44c040a618fcEric Laurentclass AudioPolicyService: public BnAudioPolicyService, public AudioPolicyClientInterface, 32de070137f11d346fba77605bd76a44c040a618fcEric Laurent public IBinder::DeathRecipient 3365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian{ 3465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 3565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopianpublic: 3665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian static void instantiate(); 3765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 3865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t dump(int fd, const Vector<String16>& args); 3965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 4065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // 4165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // BnAudioPolicyService (see AudioPolicyInterface for method descriptions) 4265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // 4365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 4465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t setDeviceConnectionState(AudioSystem::audio_devices device, 4565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian AudioSystem::device_connection_state state, 4665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian const char *device_address); 47de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual AudioSystem::device_connection_state getDeviceConnectionState( 48de070137f11d346fba77605bd76a44c040a618fcEric Laurent AudioSystem::audio_devices device, 49de070137f11d346fba77605bd76a44c040a618fcEric Laurent const char *device_address); 5065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t setPhoneState(int state); 5165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t setRingerMode(uint32_t mode, uint32_t mask); 5265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config); 5365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual AudioSystem::forced_config getForceUse(AudioSystem::force_use usage); 5465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream, 5565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t samplingRate = 0, 5665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t format = AudioSystem::FORMAT_DEFAULT, 5765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t channels = 0, 58de070137f11d346fba77605bd76a44c040a618fcEric Laurent AudioSystem::output_flags flags = 59de070137f11d346fba77605bd76a44c040a618fcEric Laurent AudioSystem::OUTPUT_FLAG_INDIRECT); 60de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t startOutput(audio_io_handle_t output, 61de070137f11d346fba77605bd76a44c040a618fcEric Laurent AudioSystem::stream_type stream, 62de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session = 0); 63de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t stopOutput(audio_io_handle_t output, 64de070137f11d346fba77605bd76a44c040a618fcEric Laurent AudioSystem::stream_type stream, 65de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session = 0); 6665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual void releaseOutput(audio_io_handle_t output); 6765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual audio_io_handle_t getInput(int inputSource, 6865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t samplingRate = 0, 6965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t format = AudioSystem::FORMAT_DEFAULT, 7065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t channels = 0, 71de070137f11d346fba77605bd76a44c040a618fcEric Laurent AudioSystem::audio_in_acoustics acoustics = 72de070137f11d346fba77605bd76a44c040a618fcEric Laurent (AudioSystem::audio_in_acoustics)0); 7365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t startInput(audio_io_handle_t input); 7465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t stopInput(audio_io_handle_t input); 7565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual void releaseInput(audio_io_handle_t input); 7665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t initStreamVolume(AudioSystem::stream_type stream, 7765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian int indexMin, 7865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian int indexMax); 7965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index); 8065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int *index); 8165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 82de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream); 83de070137f11d346fba77605bd76a44c040a618fcEric Laurent 84de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual audio_io_handle_t getOutputForEffect(effect_descriptor_t *desc); 85de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t registerEffect(effect_descriptor_t *desc, 86de070137f11d346fba77605bd76a44c040a618fcEric Laurent audio_io_handle_t output, 87de070137f11d346fba77605bd76a44c040a618fcEric Laurent uint32_t strategy, 88de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session, 89de070137f11d346fba77605bd76a44c040a618fcEric Laurent int id); 90de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t unregisterEffect(int id); 91eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent virtual bool isStreamActive(int stream, uint32_t inPastMs = 0) const; 92de070137f11d346fba77605bd76a44c040a618fcEric Laurent 9365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t onTransact( 9465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t code, 9565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian const Parcel& data, 9665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian Parcel* reply, 9765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t flags); 9865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 9965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // IBinder::DeathRecipient 10065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual void binderDied(const wp<IBinder>& who); 10165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 10265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // 10365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // AudioPolicyClientInterface 10465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // 10565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual audio_io_handle_t openOutput(uint32_t *pDevices, 10665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t *pSamplingRate, 10765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t *pFormat, 10865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t *pChannels, 10965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t *pLatencyMs, 11065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian AudioSystem::output_flags flags); 111de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1, 112de070137f11d346fba77605bd76a44c040a618fcEric Laurent audio_io_handle_t output2); 11365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t closeOutput(audio_io_handle_t output); 11465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t suspendOutput(audio_io_handle_t output); 11565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t restoreOutput(audio_io_handle_t output); 11665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual audio_io_handle_t openInput(uint32_t *pDevices, 11765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t *pSamplingRate, 11865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t *pFormat, 11965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t *pChannels, 12065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian uint32_t acoustics); 12165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t closeInput(audio_io_handle_t input); 122de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t setStreamVolume(AudioSystem::stream_type stream, 123de070137f11d346fba77605bd76a44c040a618fcEric Laurent float volume, 124de070137f11d346fba77605bd76a44c040a618fcEric Laurent audio_io_handle_t output, 125de070137f11d346fba77605bd76a44c040a618fcEric Laurent int delayMs = 0); 12665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t setStreamOutput(AudioSystem::stream_type stream, audio_io_handle_t output); 127de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual void setParameters(audio_io_handle_t ioHandle, 128de070137f11d346fba77605bd76a44c040a618fcEric Laurent const String8& keyValuePairs, 129de070137f11d346fba77605bd76a44c040a618fcEric Laurent int delayMs = 0); 13065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys); 13165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t startTone(ToneGenerator::tone_type tone, AudioSystem::stream_type stream); 13265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t stopTone(); 13365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual status_t setVoiceVolume(float volume, int delayMs = 0); 134de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t moveEffects(int session, 135de070137f11d346fba77605bd76a44c040a618fcEric Laurent audio_io_handle_t srcOutput, 136de070137f11d346fba77605bd76a44c040a618fcEric Laurent audio_io_handle_t dstOutput); 13765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 13865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopianprivate: 13965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian AudioPolicyService(); 14065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual ~AudioPolicyService(); 14165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 14265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian status_t dumpInternals(int fd); 14365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 14465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // Thread used for tone playback and to send audio config commands to audio flinger 14565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // For tone playback, using a separate thread is necessary to avoid deadlock with mLock because startTone() 14665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // and stopTone() are normally called with mLock locked and requesting a tone start or stop will cause 14765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // calls to AudioPolicyService and an attempt to lock mLock. 14865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // For audio config commands, it is necessary because audio flinger requires that the calling process (user) 14965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // has permission to modify audio settings. 15065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian class AudioCommandThread : public Thread { 15165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian class AudioCommand; 15265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian public: 15365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 15465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // commands for tone AudioCommand 15565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian enum { 15665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian START_TONE, 15765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian STOP_TONE, 15865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian SET_VOLUME, 15965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian SET_PARAMETERS, 16065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian SET_VOICE_VOLUME 16165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian }; 16265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 16365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian AudioCommandThread (String8 name); 16465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual ~AudioCommandThread(); 16565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 16665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian status_t dump(int fd); 16765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 16865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // Thread virtuals 16965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual void onFirstRef(); 17065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian virtual bool threadLoop(); 17165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 17265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian void exit(); 17365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian void startToneCommand(int type = 0, int stream = 0); 17465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian void stopToneCommand(); 17565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian status_t volumeCommand(int stream, float volume, int output, int delayMs = 0); 17665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian status_t parametersCommand(int ioHandle, const String8& keyValuePairs, int delayMs = 0); 17765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian status_t voiceVolumeCommand(float volume, int delayMs = 0); 17865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian void insertCommand_l(AudioCommand *command, int delayMs = 0); 17965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 18065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian private: 18165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // descriptor for requested tone playback event 18265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian class AudioCommand { 18365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 18465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian public: 18565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian AudioCommand() 18665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian : mCommand(-1) {} 18765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 18865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian void dump(char* buffer, size_t size); 18965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 19065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian int mCommand; // START_TONE, STOP_TONE ... 19165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian nsecs_t mTime; // time stamp 19265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian Condition mCond; // condition for status return 19365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian status_t mStatus; // command status 19465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian bool mWaitStatus; // true if caller is waiting for status 19565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian void *mParam; // command parameter (ToneData, VolumeData, ParametersData) 19665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian }; 19765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 19865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian class ToneData { 19965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian public: 20065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian int mType; // tone type (START_TONE only) 20165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian int mStream; // stream type (START_TONE only) 20265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian }; 20365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 20465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian class VolumeData { 20565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian public: 20665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian int mStream; 20765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian float mVolume; 20865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian int mIO; 20965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian }; 21065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 21165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian class ParametersData { 21265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian public: 21365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian int mIO; 21465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian String8 mKeyValuePairs; 21565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian }; 21665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 21765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian class VoiceVolumeData { 21865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian public: 21965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian float mVolume; 22065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian }; 22165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 22265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian Mutex mLock; 22365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian Condition mWaitWorkCV; 22465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian Vector <AudioCommand *> mAudioCommands; // list of pending commands 22565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian ToneGenerator *mpToneGenerator; // the tone generator 22665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian AudioCommand mLastCommand; // last processed command (used by dump) 22765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian String8 mName; // string used by wake lock fo delayed commands 22865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian }; 22965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 23065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian // Internal dump utilities. 23165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian status_t dumpPermissionDenial(int fd); 23265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 23365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 234eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent mutable Mutex mLock; // prevents concurrent access to AudioPolicy manager functions changing 235eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent // device connection state or routing 23665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian AudioPolicyInterface* mpPolicyManager; // the platform specific policy manager 23765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian sp <AudioCommandThread> mAudioCommandThread; // audio commands thread 23865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian sp <AudioCommandThread> mTonePlaybackThread; // tone playback thread 23965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian}; 24065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 24165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian}; // namespace android 24265ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 24365ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian#endif // ANDROID_AUDIOPOLICYSERVICE_H 24465ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 24565ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 24665ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 24765ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 24865ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 24965ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 25065ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 25165ab47156e1c7dfcd8cc4266253a5ff30219e7f0Mathias Agopian 252