blob: 4804bbd20a393a0e9d2d4773bf083716ad1df129 [file] [log] [blame]
Eric Laurenta553c252009-07-17 12:17:14 -07001/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_IAUDIOPOLICYSERVICE_H
18#define ANDROID_IAUDIOPOLICYSERVICE_H
19
20#include <stdint.h>
21#include <sys/types.h>
22#include <unistd.h>
23
24#include <utils/RefBase.h>
25#include <utils/Errors.h>
26#include <binder/IInterface.h>
27#include <media/AudioSystem.h>
28
29
30namespace android {
31
32// ----------------------------------------------------------------------------
33
34class IAudioPolicyService : public IInterface
35{
36public:
37 DECLARE_META_INTERFACE(AudioPolicyService);
38
39 //
40 // IAudioPolicyService interface (see AudioPolicyInterface for method descriptions)
41 //
42 virtual status_t setDeviceConnectionState(AudioSystem::audio_devices device,
43 AudioSystem::device_connection_state state,
44 const char *device_address) = 0;
45 virtual AudioSystem::device_connection_state getDeviceConnectionState(AudioSystem::audio_devices device,
46 const char *device_address) = 0;
47 virtual status_t setPhoneState(int state) = 0;
48 virtual status_t setRingerMode(uint32_t mode, uint32_t mask) = 0;
49 virtual status_t setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config) = 0;
50 virtual AudioSystem::forced_config getForceUse(AudioSystem::force_use usage) = 0;
51 virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream,
52 uint32_t samplingRate = 0,
53 uint32_t format = AudioSystem::FORMAT_DEFAULT,
54 uint32_t channels = 0,
55 AudioSystem::output_flags flags = AudioSystem::OUTPUT_FLAG_INDIRECT) = 0;
56 virtual status_t startOutput(audio_io_handle_t output, AudioSystem::stream_type stream) = 0;
57 virtual status_t stopOutput(audio_io_handle_t output, AudioSystem::stream_type stream) = 0;
58 virtual void releaseOutput(audio_io_handle_t output) = 0;
59 virtual audio_io_handle_t getInput(int inputSource,
60 uint32_t samplingRate = 0,
61 uint32_t format = AudioSystem::FORMAT_DEFAULT,
62 uint32_t channels = 0,
63 AudioSystem::audio_in_acoustics acoustics = (AudioSystem::audio_in_acoustics)0) = 0;
64 virtual status_t startInput(audio_io_handle_t input) = 0;
65 virtual status_t stopInput(audio_io_handle_t input) = 0;
66 virtual void releaseInput(audio_io_handle_t input) = 0;
67 virtual status_t initStreamVolume(AudioSystem::stream_type stream,
68 int indexMin,
69 int indexMax) = 0;
70 virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index) = 0;
71 virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int *index) = 0;
72};
73
74
75// ----------------------------------------------------------------------------
76
77class BnAudioPolicyService : public BnInterface<IAudioPolicyService>
78{
79public:
80 virtual status_t onTransact( uint32_t code,
81 const Parcel& data,
82 Parcel* reply,
83 uint32_t flags = 0);
84};
85
86// ----------------------------------------------------------------------------
87
88}; // namespace android
89
90#endif // ANDROID_IAUDIOPOLICYSERVICE_H