1a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent/*
2a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent * Copyright (C) 2009 The Android Open Source Project
3a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent *
4a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent * Licensed under the Apache License, Version 2.0 (the "License");
5a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent * you may not use this file except in compliance with the License.
6a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent * You may obtain a copy of the License at
7a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent *
8a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent *      http://www.apache.org/licenses/LICENSE-2.0
9a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent *
10a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent * Unless required by applicable law or agreed to in writing, software
11a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent * distributed under the License is distributed on an "AS IS" BASIS,
12a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent * See the License for the specific language governing permissions and
14a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent * limitations under the License.
15a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent */
16a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent
17a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent#ifndef ANDROID_IAUDIOPOLICYSERVICE_H
18a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent#define ANDROID_IAUDIOPOLICYSERVICE_H
19a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent
20a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent#include <stdint.h>
21a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent#include <sys/types.h>
22a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent#include <unistd.h>
23a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent
24a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent#include <utils/RefBase.h>
25a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent#include <utils/Errors.h>
26a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent#include <binder/IInterface.h>
27a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent#include <media/AudioSystem.h>
28a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent
29a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent
30a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurentnamespace android {
31a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent
32a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent// ----------------------------------------------------------------------------
33a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent
34a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurentclass IAudioPolicyService : public IInterface
35a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent{
36a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurentpublic:
37a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    DECLARE_META_INTERFACE(AudioPolicyService);
38a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent
39a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    //
40a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    // IAudioPolicyService interface (see AudioPolicyInterface for method descriptions)
41a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    //
42a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual status_t setDeviceConnectionState(AudioSystem::audio_devices device,
43a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                              AudioSystem::device_connection_state state,
44a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                              const char *device_address) = 0;
45a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual AudioSystem::device_connection_state getDeviceConnectionState(AudioSystem::audio_devices device,
46a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                                                          const char *device_address) = 0;
47a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual status_t setPhoneState(int state) = 0;
48a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual status_t setRingerMode(uint32_t mode, uint32_t mask) = 0;
49a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual status_t setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config) = 0;
50a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual AudioSystem::forced_config getForceUse(AudioSystem::force_use usage) = 0;
51a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream,
52a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                        uint32_t samplingRate = 0,
53a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                        uint32_t format = AudioSystem::FORMAT_DEFAULT,
54a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                        uint32_t channels = 0,
55a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                        AudioSystem::output_flags flags = AudioSystem::OUTPUT_FLAG_INDIRECT) = 0;
568ed6ed0b6216a9dfcbcd6a5ba6a62d28a901baecEric Laurent    virtual status_t startOutput(audio_io_handle_t output,
578ed6ed0b6216a9dfcbcd6a5ba6a62d28a901baecEric Laurent                                 AudioSystem::stream_type stream,
588ed6ed0b6216a9dfcbcd6a5ba6a62d28a901baecEric Laurent                                 int session = 0) = 0;
598ed6ed0b6216a9dfcbcd6a5ba6a62d28a901baecEric Laurent    virtual status_t stopOutput(audio_io_handle_t output,
608ed6ed0b6216a9dfcbcd6a5ba6a62d28a901baecEric Laurent                                AudioSystem::stream_type stream,
618ed6ed0b6216a9dfcbcd6a5ba6a62d28a901baecEric Laurent                                int session = 0) = 0;
62a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual void releaseOutput(audio_io_handle_t output) = 0;
63a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual audio_io_handle_t getInput(int inputSource,
64a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                    uint32_t samplingRate = 0,
65a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                    uint32_t format = AudioSystem::FORMAT_DEFAULT,
66a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                    uint32_t channels = 0,
67a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                    AudioSystem::audio_in_acoustics acoustics = (AudioSystem::audio_in_acoustics)0) = 0;
68a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual status_t startInput(audio_io_handle_t input) = 0;
69a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual status_t stopInput(audio_io_handle_t input) = 0;
70a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual void releaseInput(audio_io_handle_t input) = 0;
71a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual status_t initStreamVolume(AudioSystem::stream_type stream,
72a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                      int indexMin,
73a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                      int indexMax) = 0;
74a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index) = 0;
75a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int *index) = 0;
768ed6ed0b6216a9dfcbcd6a5ba6a62d28a901baecEric Laurent    virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream) = 0;
778ed6ed0b6216a9dfcbcd6a5ba6a62d28a901baecEric Laurent    virtual audio_io_handle_t getOutputForEffect(effect_descriptor_t *desc) = 0;
788ed6ed0b6216a9dfcbcd6a5ba6a62d28a901baecEric Laurent    virtual status_t registerEffect(effect_descriptor_t *desc,
798ed6ed0b6216a9dfcbcd6a5ba6a62d28a901baecEric Laurent                                    audio_io_handle_t output,
808ed6ed0b6216a9dfcbcd6a5ba6a62d28a901baecEric Laurent                                    uint32_t strategy,
818ed6ed0b6216a9dfcbcd6a5ba6a62d28a901baecEric Laurent                                    int session,
828ed6ed0b6216a9dfcbcd6a5ba6a62d28a901baecEric Laurent                                    int id) = 0;
838ed6ed0b6216a9dfcbcd6a5ba6a62d28a901baecEric Laurent    virtual status_t unregisterEffect(int id) = 0;
84a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent};
85a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent
86a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent
87a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent// ----------------------------------------------------------------------------
88a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent
89a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurentclass BnAudioPolicyService : public BnInterface<IAudioPolicyService>
90a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent{
91a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurentpublic:
92a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent    virtual status_t    onTransact( uint32_t code,
93a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                    const Parcel& data,
94a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                    Parcel* reply,
95a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent                                    uint32_t flags = 0);
96a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent};
97a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent
98a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent// ----------------------------------------------------------------------------
99a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent
100a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent}; // namespace android
101a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent
102a553c25b33c99b345cf1c8688f8df0ed8df14e5aEric Laurent#endif // ANDROID_IAUDIOPOLICYSERVICE_H
103