IAudioPolicyService.h revision c2f1f07084818942352c6bbfb36af9b6b330eb4e
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;
56c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t startOutput(audio_io_handle_t output, AudioSystem::stream_type stream) = 0;
57c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t stopOutput(audio_io_handle_t output, AudioSystem::stream_type stream) = 0;
58c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual void releaseOutput(audio_io_handle_t output) = 0;
59c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual audio_io_handle_t getInput(int inputSource,
60c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    uint32_t samplingRate = 0,
61c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    uint32_t format = AudioSystem::FORMAT_DEFAULT,
62c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    uint32_t channels = 0,
63c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    AudioSystem::audio_in_acoustics acoustics = (AudioSystem::audio_in_acoustics)0) = 0;
64c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t startInput(audio_io_handle_t input) = 0;
65c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t stopInput(audio_io_handle_t input) = 0;
66c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual void releaseInput(audio_io_handle_t input) = 0;
67c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t initStreamVolume(AudioSystem::stream_type stream,
68c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                      int indexMin,
69c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                      int indexMax) = 0;
70c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t setStreamVolumeIndex(AudioSystem::stream_type stream, int index) = 0;
71c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t getStreamVolumeIndex(AudioSystem::stream_type stream, int *index) = 0;
72c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent};
73c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
74c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
75c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent// ----------------------------------------------------------------------------
76c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
77c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentclass BnAudioPolicyService : public BnInterface<IAudioPolicyService>
78c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent{
79c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentpublic:
80c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t    onTransact( uint32_t code,
81c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    const Parcel& data,
82c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    Parcel* reply,
83c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    uint32_t flags = 0);
84c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent};
85c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
86c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent// ----------------------------------------------------------------------------
87c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
88c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent}; // namespace android
89c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
90c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#endif // ANDROID_IAUDIOPOLICYSERVICE_H
91