IAudioPolicyService.h revision de070137f11d346fba77605bd76a44c040a618fc
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
29c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
30c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentnamespace android {
31c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
32c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent// ----------------------------------------------------------------------------
33c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
34c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentclass IAudioPolicyService : public IInterface
35c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent{
36c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentpublic:
37c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    DECLARE_META_INTERFACE(AudioPolicyService);
38c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
39c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    //
40c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    // IAudioPolicyService interface (see AudioPolicyInterface for method descriptions)
41c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    //
42c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t setDeviceConnectionState(AudioSystem::audio_devices device,
43c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                              AudioSystem::device_connection_state state,
44c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                              const char *device_address) = 0;
45c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual AudioSystem::device_connection_state getDeviceConnectionState(AudioSystem::audio_devices device,
46c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                                                          const char *device_address) = 0;
47c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t setPhoneState(int state) = 0;
48c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t setRingerMode(uint32_t mode, uint32_t mask) = 0;
49c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t setForceUse(AudioSystem::force_use usage, AudioSystem::forced_config config) = 0;
50c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual AudioSystem::forced_config getForceUse(AudioSystem::force_use usage) = 0;
51c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual audio_io_handle_t getOutput(AudioSystem::stream_type stream,
52c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                        uint32_t samplingRate = 0,
53c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                        uint32_t format = AudioSystem::FORMAT_DEFAULT,
54c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                        uint32_t channels = 0,
55c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                        AudioSystem::output_flags flags = AudioSystem::OUTPUT_FLAG_INDIRECT) = 0;
56de070137f11d346fba77605bd76a44c040a618fcEric Laurent    virtual status_t startOutput(audio_io_handle_t output,
57de070137f11d346fba77605bd76a44c040a618fcEric Laurent                                 AudioSystem::stream_type stream,
58de070137f11d346fba77605bd76a44c040a618fcEric Laurent                                 int session = 0) = 0;
59de070137f11d346fba77605bd76a44c040a618fcEric Laurent    virtual status_t stopOutput(audio_io_handle_t output,
60de070137f11d346fba77605bd76a44c040a618fcEric Laurent                                AudioSystem::stream_type stream,
61de070137f11d346fba77605bd76a44c040a618fcEric Laurent                                int session = 0) = 0;
62c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual void releaseOutput(audio_io_handle_t output) = 0;
63c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual audio_io_handle_t getInput(int inputSource,
64c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    uint32_t samplingRate = 0,
65c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    uint32_t format = AudioSystem::FORMAT_DEFAULT,
66c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    uint32_t channels = 0,
67c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    AudioSystem::audio_in_acoustics acoustics = (AudioSystem::audio_in_acoustics)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;
71c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t initStreamVolume(AudioSystem::stream_type stream,
72c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                      int indexMin,
73c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                      int indexMax) = 0;
74c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index) = 0;
75c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int *index) = 0;
76de070137f11d346fba77605bd76a44c040a618fcEric Laurent    virtual uint32_t getStrategyForStream(AudioSystem::stream_type stream) = 0;
77de070137f11d346fba77605bd76a44c040a618fcEric Laurent    virtual audio_io_handle_t getOutputForEffect(effect_descriptor_t *desc) = 0;
78de070137f11d346fba77605bd76a44c040a618fcEric Laurent    virtual status_t registerEffect(effect_descriptor_t *desc,
79de070137f11d346fba77605bd76a44c040a618fcEric Laurent                                    audio_io_handle_t output,
80de070137f11d346fba77605bd76a44c040a618fcEric Laurent                                    uint32_t strategy,
81de070137f11d346fba77605bd76a44c040a618fcEric Laurent                                    int session,
82de070137f11d346fba77605bd76a44c040a618fcEric Laurent                                    int id) = 0;
83de070137f11d346fba77605bd76a44c040a618fcEric Laurent    virtual status_t unregisterEffect(int id) = 0;
84c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent};
85c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
86c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
87c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent// ----------------------------------------------------------------------------
88c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
89c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentclass BnAudioPolicyService : public BnInterface<IAudioPolicyService>
90c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent{
91c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentpublic:
92c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t    onTransact( uint32_t code,
93c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    const Parcel& data,
94c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    Parcel* reply,
95c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    uint32_t flags = 0);
96c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent};
97c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
98c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent// ----------------------------------------------------------------------------
99c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
100c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent}; // namespace android
101c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
102c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#endif // ANDROID_IAUDIOPOLICYSERVICE_H
103