IAudioPolicyService.h revision f78aee70d15daf4690de7e7b4983ee68b0d1381d
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;
49c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t setRingerMode(uint32_t mode, uint32_t mask) = 0;
50fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin    virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config) = 0;
51fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin    virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage) = 0;
52fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin    virtual audio_io_handle_t getOutput(audio_stream_type_t stream,
53c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                        uint32_t samplingRate = 0,
54fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin                                        uint32_t format = AUDIO_FORMAT_DEFAULT,
55c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                        uint32_t channels = 0,
56fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin                                        audio_policy_output_flags_t flags = AUDIO_POLICY_OUTPUT_FLAG_INDIRECT) = 0;
57de070137f11d346fba77605bd76a44c040a618fcEric Laurent    virtual status_t startOutput(audio_io_handle_t output,
58fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin                                 audio_stream_type_t stream,
59de070137f11d346fba77605bd76a44c040a618fcEric Laurent                                 int session = 0) = 0;
60de070137f11d346fba77605bd76a44c040a618fcEric Laurent    virtual status_t stopOutput(audio_io_handle_t output,
61fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin                                audio_stream_type_t stream,
62de070137f11d346fba77605bd76a44c040a618fcEric Laurent                                int session = 0) = 0;
63c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual void releaseOutput(audio_io_handle_t output) = 0;
64c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual audio_io_handle_t getInput(int inputSource,
65c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    uint32_t samplingRate = 0,
66fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin                                    uint32_t format = AUDIO_FORMAT_DEFAULT,
67c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    uint32_t channels = 0,
687c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent                                    audio_in_acoustics_t acoustics = (audio_in_acoustics_t)0,
697c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent                                    int audioSession = 0) = 0;
70c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t startInput(audio_io_handle_t input) = 0;
71c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t stopInput(audio_io_handle_t input) = 0;
72c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual void releaseInput(audio_io_handle_t input) = 0;
73fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin    virtual status_t initStreamVolume(audio_stream_type_t stream,
74c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                      int indexMin,
75c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                      int indexMax) = 0;
76fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin    virtual status_t setStreamVolumeIndex(audio_stream_type_t stream, int index) = 0;
77fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin    virtual status_t getStreamVolumeIndex(audio_stream_type_t stream, int *index) = 0;
78fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin    virtual uint32_t getStrategyForStream(audio_stream_type_t stream) = 0;
79fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin    virtual uint32_t getDevicesForStream(audio_stream_type_t stream) = 0;
80de070137f11d346fba77605bd76a44c040a618fcEric Laurent    virtual audio_io_handle_t getOutputForEffect(effect_descriptor_t *desc) = 0;
81de070137f11d346fba77605bd76a44c040a618fcEric Laurent    virtual status_t registerEffect(effect_descriptor_t *desc,
827c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent                                    audio_io_handle_t io,
83de070137f11d346fba77605bd76a44c040a618fcEric Laurent                                    uint32_t strategy,
84de070137f11d346fba77605bd76a44c040a618fcEric Laurent                                    int session,
85de070137f11d346fba77605bd76a44c040a618fcEric Laurent                                    int id) = 0;
86de070137f11d346fba77605bd76a44c040a618fcEric Laurent    virtual status_t unregisterEffect(int id) = 0;
87db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent    virtual status_t setEffectEnabled(int id, bool enabled) = 0;
88eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent    virtual bool     isStreamActive(int stream, uint32_t inPastMs = 0) const = 0;
8957dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent    virtual status_t queryDefaultPreProcessing(int audioSession,
9057dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent                                              effect_descriptor_t *descriptors,
9157dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent                                              uint32_t *count) = 0;
92c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent};
93c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
94c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
95c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent// ----------------------------------------------------------------------------
96c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
97c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentclass BnAudioPolicyService : public BnInterface<IAudioPolicyService>
98c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent{
99c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentpublic:
100c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent    virtual status_t    onTransact( uint32_t code,
101c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    const Parcel& data,
102c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    Parcel* reply,
103c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent                                    uint32_t flags = 0);
104c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent};
105c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
106c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent// ----------------------------------------------------------------------------
107c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
108c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent}; // namespace android
109c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent
110c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#endif // ANDROID_IAUDIOPOLICYSERVICE_H
111