1 /*
2  * Copyright (C) 2016 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_IAUDIOMANAGER_H
18 #define ANDROID_IAUDIOMANAGER_H
19 
20 #include <utils/Errors.h>
21 #include <binder/IInterface.h>
22 #include <hardware/power.h>
23 #include <system/audio.h>
24 
25 namespace android {
26 
27 // ----------------------------------------------------------------------------
28 
29 class IAudioManager : public IInterface
30 {
31 public:
32     // These transaction IDs must be kept in sync with the method order from
33     // IAudioService.aidl.
34     enum {
35         // transaction IDs for the unsupported methods are commented out
36         /*
37         ADJUSTSUGGESTEDSTREAMVOLUME           = IBinder::FIRST_CALL_TRANSACTION,
38         ADJUSTSTREAMVOLUME                    = IBinder::FIRST_CALL_TRANSACTION + 1,
39         SETSTREAMVOLUME                       = IBinder::FIRST_CALL_TRANSACTION + 2,
40         ISSTREAMMUTE                          = IBinder::FIRST_CALL_TRANSACTION + 3,
41         FORCEREMOTESUBMIXFULLVOLUME           = IBinder::FIRST_CALL_TRANSACTION + 4,
42         ISMASTERMUTE                          = IBinder::FIRST_CALL_TRANSACTION + 5,
43         SETMASTERMUTE                         = IBinder::FIRST_CALL_TRANSACTION + 6,
44         GETSTREAMVOLUME                       = IBinder::FIRST_CALL_TRANSACTION + 7,
45         GETSTREAMMINVOLUME                    = IBinder::FIRST_CALL_TRANSACTION + 8,
46         GETSTREAMMAXVOLUME                    = IBinder::FIRST_CALL_TRANSACTION + 9,
47         GETLASTAUDIBLESTREAMVOLUME            = IBinder::FIRST_CALL_TRANSACTION + 10,
48         SETMICROPHONEMUTE                     = IBinder::FIRST_CALL_TRANSACTION + 11,
49         SETRINGERMODEEXTERNAL                 = IBinder::FIRST_CALL_TRANSACTION + 12,
50         SETRINGERMODEINTERNAL                 = IBinder::FIRST_CALL_TRANSACTION + 13,
51         GETRINGERMODEEXTERNAL                 = IBinder::FIRST_CALL_TRANSACTION + 14,
52         GETRINGERMODEINTERNAL                 = IBinder::FIRST_CALL_TRANSACTION + 15,
53         ISVALIDRINGERMODE                     = IBinder::FIRST_CALL_TRANSACTION + 16,
54         SETVIBRATESETTING                     = IBinder::FIRST_CALL_TRANSACTION + 17,
55         GETVIBRATESETTING                     = IBinder::FIRST_CALL_TRANSACTION + 18,
56         SHOULDVIBRATE                         = IBinder::FIRST_CALL_TRANSACTION + 19,
57         SETMODE                               = IBinder::FIRST_CALL_TRANSACTION + 20,
58         GETMODE                               = IBinder::FIRST_CALL_TRANSACTION + 21,
59         PLAYSOUNDEFFECT                       = IBinder::FIRST_CALL_TRANSACTION + 22,
60         PLAYSOUNDEFFECTVOLUME                 = IBinder::FIRST_CALL_TRANSACTION + 23,
61         LOADSOUNDEFFECTS                      = IBinder::FIRST_CALL_TRANSACTION + 24,
62         UNLOADSOUNDEFFECTS                    = IBinder::FIRST_CALL_TRANSACTION + 25,
63         RELOADAUDIOSETTINGS                   = IBinder::FIRST_CALL_TRANSACTION + 26,
64         AVRCPSUPPORTSABSOLUTEVOLUME           = IBinder::FIRST_CALL_TRANSACTION + 27,
65         SETSPEAKERPHONEON                     = IBinder::FIRST_CALL_TRANSACTION + 28,
66         ISSPEAKERPHONEON                      = IBinder::FIRST_CALL_TRANSACTION + 29,
67         SETBLUETOOTHSCOON                     = IBinder::FIRST_CALL_TRANSACTION + 30,
68         ISBLUETOOTHSCOON                      = IBinder::FIRST_CALL_TRANSACTION + 31,
69         SETBLUETOOTHA2DPON                    = IBinder::FIRST_CALL_TRANSACTION + 32,
70         ISBLUETOOTHA2DPON                     = IBinder::FIRST_CALL_TRANSACTION + 33,
71         REQUESTAUDIOFOCUS                     = IBinder::FIRST_CALL_TRANSACTION + 34,
72         ABANDONAUDIOFOCUS                     = IBinder::FIRST_CALL_TRANSACTION + 35,
73         UNREGISTERAUDIOFOCUSCLIENT            = IBinder::FIRST_CALL_TRANSACTION + 36,
74         GETCURRENTAUDIOFOCUS                  = IBinder::FIRST_CALL_TRANSACTION + 37,
75         STARTBLUETOOTHSCO                     = IBinder::FIRST_CALL_TRANSACTION + 38,
76         STARTBLUETOOTHSCOVIRTUALCALL          = IBinder::FIRST_CALL_TRANSACTION + 39,
77         STOPBLUETOOTHSCO                      = IBinder::FIRST_CALL_TRANSACTION + 40,
78         FORCEVOLUMECONTROLSTREAM              = IBinder::FIRST_CALL_TRANSACTION + 41,
79         SETRINGTONEPLAYER                     = IBinder::FIRST_CALL_TRANSACTION + 42,
80         GETRINGTONEPLAYER                     = IBinder::FIRST_CALL_TRANSACTION + 43,
81         GETUISOUNDSSTREAMTYPE                 = IBinder::FIRST_CALL_TRANSACTION + 44,
82         SETWIREDDEVICECONNECTIONSTATE         = IBinder::FIRST_CALL_TRANSACTION + 45,
83         SETBLUETOOTHA2DPDEVICECONNECTIONSTATE = IBinder::FIRST_CALL_TRANSACTION + 46,
84         HANDLEBLUETOOTHA2DPDEVICECONFIGCHANGE = IBinder::FIRST_CALL_TRANSACTION + 47,
85         STARTWATCHINGROUTES                   = IBinder::FIRST_CALL_TRANSACTION + 48,
86         ISCAMERASOUNDFORCED                   = IBinder::FIRST_CALL_TRANSACTION + 49,
87         SETVOLUMECONTROLLER                   = IBinder::FIRST_CALL_TRANSACTION + 50,
88         NOTIFYVOLUMECONTROLLERVISIBLE         = IBinder::FIRST_CALL_TRANSACTION + 51,
89         ISSTREAMAFFECTEDBYRINGERMODE          = IBinder::FIRST_CALL_TRANSACTION + 52,
90         ISSTREAMAFFECTEDBYMUTE                = IBinder::FIRST_CALL_TRANSACTION + 53,
91         DISABLESAFEMEDIAVOLUME                = IBinder::FIRST_CALL_TRANSACTION + 54,
92         SETHDMISYSTEMAUDIOSUPPORTED           = IBinder::FIRST_CALL_TRANSACTION + 55,
93         ISHDMISYSTEMAUDIOSUPPORTED            = IBinder::FIRST_CALL_TRANSACTION + 56,
94         REGISTERAUDIOPOLICY                   = IBinder::FIRST_CALL_TRANSACTION + 57,
95         UNREGISTERAUDIOPOLICYASYNC            = IBinder::FIRST_CALL_TRANSACTION + 58,
96         SETFOCUSPROPERTIESFORPOLICY           = IBinder::FIRST_CALL_TRANSACTION + 59,
97         SETVOLUMEPOLICY                       = IBinder::FIRST_CALL_TRANSACTION + 60,
98         REGISTERRECORDINGCALLBACK             = IBinder::FIRST_CALL_TRANSACTION + 61,
99         UNREGISTERRECORDINGCALLBACK           = IBinder::FIRST_CALL_TRANSACTION + 62,
100         GETACTIVERECORDINGCONFIGURATIONS      = IBinder::FIRST_CALL_TRANSACTION + 63,
101         REGISTERPLAYBACKCALLBACK              = IBinder::FIRST_CALL_TRANSACTION + 64,
102         UNREGISTERPLAYBACKCALLBACK            = IBinder::FIRST_CALL_TRANSACTION + 65,
103         GETACTIVEPLAYBACKCONFIGURATIONS       = IBinder::FIRST_CALL_TRANSACTION + 66,
104         */
105 
106         TRACK_PLAYER                          = IBinder::FIRST_CALL_TRANSACTION + 67,
107         PLAYER_ATTRIBUTES                     = IBinder::FIRST_CALL_TRANSACTION + 68,
108         PLAYER_EVENT                          = IBinder::FIRST_CALL_TRANSACTION + 69,
109         RELEASE_PLAYER                        = IBinder::FIRST_CALL_TRANSACTION + 70,
110 
111         /*
112         DISABLE_RINGTONE_SYNC                 = IBinder::FIRST_CALL_TRANSACTION + 71,
113         */
114     };
115 
116     DECLARE_META_INTERFACE(AudioManager)
117 
118     // The parcels created by these methods must be kept in sync with the
119     // corresponding methods from IAudioService.aidl and objects it imports.
120     virtual audio_unique_id_t trackPlayer(player_type_t playerType, audio_usage_t usage,
121                 audio_content_type_t content, const sp<IBinder>& player) = 0;
122     /*oneway*/ virtual status_t playerAttributes(audio_unique_id_t piid, audio_usage_t usage,
123                 audio_content_type_t content)= 0;
124     /*oneway*/ virtual status_t playerEvent(audio_unique_id_t piid, player_state_t event) = 0;
125     /*oneway*/ virtual status_t releasePlayer(audio_unique_id_t piid) = 0;
126 };
127 
128 // ----------------------------------------------------------------------------
129 
130 }; // namespace android
131 
132 #endif // ANDROID_IAUDIOMANAGER_H
133