IAudioPolicyService.h revision 58e5aa34f01d663654d8bafad65db1dda42161ff
1c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent/* 2c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent * Copyright (C) 2009 The Android Open Source Project 3c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent * 4c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent * Licensed under the Apache License, Version 2.0 (the "License"); 5c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent * you may not use this file except in compliance with the License. 6c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent * You may obtain a copy of the License at 7c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent * 8c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent * http://www.apache.org/licenses/LICENSE-2.0 9c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent * 10c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent * Unless required by applicable law or agreed to in writing, software 11c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent * distributed under the License is distributed on an "AS IS" BASIS, 12c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent * See the License for the specific language governing permissions and 14c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent * limitations under the License. 15c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent */ 16c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 17c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#ifndef ANDROID_IAUDIOPOLICYSERVICE_H 18c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#define ANDROID_IAUDIOPOLICYSERVICE_H 19c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 20c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#include <stdint.h> 21c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#include <sys/types.h> 22c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#include <unistd.h> 23c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 24c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#include <utils/RefBase.h> 25c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#include <utils/Errors.h> 26c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#include <binder/IInterface.h> 27c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#include <media/AudioSystem.h> 28c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 297394a4f358fa9908a9f0a7c954b65c399f4268e6Dima Zavin#include <system/audio_policy.h> 30c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 31c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentnamespace android { 32c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 33c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent// ---------------------------------------------------------------------------- 34c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 35c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentclass IAudioPolicyService : public IInterface 36c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent{ 37c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentpublic: 38c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent DECLARE_META_INTERFACE(AudioPolicyService); 39c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 40c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent // 41c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent // IAudioPolicyService interface (see AudioPolicyInterface for method descriptions) 42c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent // 43fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual status_t setDeviceConnectionState(audio_devices_t device, 44fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_policy_dev_state_t state, 45c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent const char *device_address) = 0; 46fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual audio_policy_dev_state_t getDeviceConnectionState(audio_devices_t device, 47c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent const char *device_address) = 0; 48f78aee70d15daf4690de7e7b4983ee68b0d1381dGlenn Kasten virtual status_t setPhoneState(audio_mode_t state) = 0; 49fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config) = 0; 50fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage) = 0; 51fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual audio_io_handle_t getOutput(audio_stream_type_t stream, 52c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t samplingRate = 0, 5358f30210ea540b6ce5aa6a46330cd3499483cb97Glenn Kasten audio_format_t format = AUDIO_FORMAT_DEFAULT, 54254af180475346b6186b49c297f340c9c4817511Glenn Kasten audio_channel_mask_t channelMask = 0, 550ca3cf94c0dfc173ad7886ae162c4b67067539f6Eric Laurent audio_output_flags_t flags = AUDIO_OUTPUT_FLAG_NONE) = 0; 56de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t startOutput(audio_io_handle_t output, 57fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream, 58de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session = 0) = 0; 59de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t stopOutput(audio_io_handle_t output, 60fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream, 61de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session = 0) = 0; 62c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual void releaseOutput(audio_io_handle_t output) = 0; 63eba51fb3a361f67a6a64d5a16eba6084fe27d60eGlenn Kasten virtual audio_io_handle_t getInput(audio_source_t inputSource, 64c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t samplingRate = 0, 6558f30210ea540b6ce5aa6a46330cd3499483cb97Glenn Kasten audio_format_t format = AUDIO_FORMAT_DEFAULT, 66254af180475346b6186b49c297f340c9c4817511Glenn Kasten audio_channel_mask_t channelMask = 0, 677c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent int audioSession = 0) = 0; 68c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual status_t startInput(audio_io_handle_t input) = 0; 69c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual status_t stopInput(audio_io_handle_t input) = 0; 70c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual void releaseInput(audio_io_handle_t input) = 0; 71fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual status_t initStreamVolume(audio_stream_type_t stream, 72c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int indexMin, 73c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int indexMax) = 0; 7483844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent virtual status_t setStreamVolumeIndex(audio_stream_type_t stream, 7583844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent int index, 7683844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent audio_devices_t device) = 0; 7783844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent virtual status_t getStreamVolumeIndex(audio_stream_type_t stream, 7883844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent int *index, 7983844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent audio_devices_t device) = 0; 80fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual uint32_t getStrategyForStream(audio_stream_type_t stream) = 0; 816374252107fd6539397598195ea6defd5870fafbEric Laurent virtual audio_devices_t getDevicesForStream(audio_stream_type_t stream) = 0; 8258e5aa34f01d663654d8bafad65db1dda42161ffGlenn Kasten virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t *desc) = 0; 8358e5aa34f01d663654d8bafad65db1dda42161ffGlenn Kasten virtual status_t registerEffect(const effect_descriptor_t *desc, 847c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent audio_io_handle_t io, 85de070137f11d346fba77605bd76a44c040a618fcEric Laurent uint32_t strategy, 86de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session, 87de070137f11d346fba77605bd76a44c040a618fcEric Laurent int id) = 0; 88de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t unregisterEffect(int id) = 0; 89db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent virtual status_t setEffectEnabled(int id, bool enabled) = 0; 90fff6d715a8db0daf08a50634f242c40268de3d49Glenn Kasten virtual bool isStreamActive(audio_stream_type_t stream, uint32_t inPastMs = 0) const = 0; 9157dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent virtual status_t queryDefaultPreProcessing(int audioSession, 9257dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent effect_descriptor_t *descriptors, 9357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent uint32_t *count) = 0; 94c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent}; 95c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 96c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 97c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent// ---------------------------------------------------------------------------- 98c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 99c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentclass BnAudioPolicyService : public BnInterface<IAudioPolicyService> 100c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent{ 101c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentpublic: 102c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual status_t onTransact( uint32_t code, 103c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent const Parcel& data, 104c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel* reply, 105c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t flags = 0); 106c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent}; 107c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 108c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent// ---------------------------------------------------------------------------- 109c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 110c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent}; // namespace android 111c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 112c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#endif // ANDROID_IAUDIOPOLICYSERVICE_H 113