| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1 | /* | 
 | 2 | ** | 
 | 3 | ** Copyright 2009, The Android Open Source Project | 
 | 4 | ** | 
 | 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); | 
 | 6 | ** you may not use this file except in compliance with the License. | 
 | 7 | ** You may obtain a copy of the License at | 
 | 8 | ** | 
 | 9 | **     http://www.apache.org/licenses/LICENSE-2.0 | 
 | 10 | ** | 
 | 11 | ** Unless required by applicable law or agreed to in writing, software | 
 | 12 | ** distributed under the License is distributed on an "AS IS" BASIS, | 
 | 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
 | 14 | ** See the License for the specific language governing permissions and | 
 | 15 | ** limitations under the License. | 
 | 16 | */ | 
 | 17 |  | 
 | 18 | #define LOG_TAG "IAudioPolicyService" | 
 | 19 | #include <utils/Log.h> | 
 | 20 |  | 
 | 21 | #include <stdint.h> | 
 | 22 | #include <sys/types.h> | 
 | 23 |  | 
 | 24 | #include <binder/Parcel.h> | 
 | 25 |  | 
 | 26 | #include <media/IAudioPolicyService.h> | 
 | 27 |  | 
| Dima Zavin | 6476024 | 2011-05-11 14:15:23 -0700 | [diff] [blame] | 28 | #include <system/audio.h> | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 29 |  | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 30 | namespace android { | 
 | 31 |  | 
 | 32 | enum { | 
 | 33 |     SET_DEVICE_CONNECTION_STATE = IBinder::FIRST_CALL_TRANSACTION, | 
 | 34 |     GET_DEVICE_CONNECTION_STATE, | 
 | 35 |     SET_PHONE_STATE, | 
| Glenn Kasten | 0b07b80 | 2012-01-18 14:56:06 -0800 | [diff] [blame] | 36 |     SET_RINGER_MODE,    // reserved, no longer used | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 37 |     SET_FORCE_USE, | 
 | 38 |     GET_FORCE_USE, | 
 | 39 |     GET_OUTPUT, | 
 | 40 |     START_OUTPUT, | 
 | 41 |     STOP_OUTPUT, | 
 | 42 |     RELEASE_OUTPUT, | 
 | 43 |     GET_INPUT, | 
 | 44 |     START_INPUT, | 
 | 45 |     STOP_INPUT, | 
 | 46 |     RELEASE_INPUT, | 
 | 47 |     INIT_STREAM_VOLUME, | 
 | 48 |     SET_STREAM_VOLUME, | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 49 |     GET_STREAM_VOLUME, | 
 | 50 |     GET_STRATEGY_FOR_STREAM, | 
 | 51 |     GET_OUTPUT_FOR_EFFECT, | 
 | 52 |     REGISTER_EFFECT, | 
| Eric Laurent | eda6c36 | 2011-02-02 09:33:30 -0800 | [diff] [blame] | 53 |     UNREGISTER_EFFECT, | 
| Glenn Kasten | 6b2718c | 2011-02-04 13:54:26 -0800 | [diff] [blame] | 54 |     IS_STREAM_ACTIVE, | 
| Jean-Michel Trivi | d708603 | 2012-10-10 12:11:16 -0700 | [diff] [blame] | 55 |     IS_SOURCE_ACTIVE, | 
| Glenn Kasten | 6b2718c | 2011-02-04 13:54:26 -0800 | [diff] [blame] | 56 |     GET_DEVICES_FOR_STREAM, | 
| Eric Laurent | db7c079 | 2011-08-10 10:37:50 -0700 | [diff] [blame] | 57 |     QUERY_DEFAULT_PRE_PROCESSING, | 
| Jean-Michel Trivi | 272ab54 | 2013-02-04 16:26:02 -0800 | [diff] [blame] | 58 |     SET_EFFECT_ENABLED, | 
| Richard Fitzgerald | ad3af33 | 2013-03-25 16:54:37 +0000 | [diff] [blame] | 59 |     IS_STREAM_ACTIVE_REMOTELY, | 
| Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame^] | 60 |     IS_OFFLOAD_SUPPORTED, | 
 | 61 |     LIST_AUDIO_PORTS, | 
 | 62 |     GET_AUDIO_PORT, | 
 | 63 |     CREATE_AUDIO_PATCH, | 
 | 64 |     RELEASE_AUDIO_PATCH, | 
 | 65 |     LIST_AUDIO_PATCHES, | 
 | 66 |     SET_AUDIO_PORT_CONFIG | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 67 | }; | 
 | 68 |  | 
 | 69 | class BpAudioPolicyService : public BpInterface<IAudioPolicyService> | 
 | 70 | { | 
 | 71 | public: | 
 | 72 |     BpAudioPolicyService(const sp<IBinder>& impl) | 
 | 73 |         : BpInterface<IAudioPolicyService>(impl) | 
 | 74 |     { | 
 | 75 |     } | 
 | 76 |  | 
 | 77 |     virtual status_t setDeviceConnectionState( | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 78 |                                     audio_devices_t device, | 
 | 79 |                                     audio_policy_dev_state_t state, | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 80 |                                     const char *device_address) | 
 | 81 |     { | 
 | 82 |         Parcel data, reply; | 
 | 83 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 84 |         data.writeInt32(static_cast <uint32_t>(device)); | 
 | 85 |         data.writeInt32(static_cast <uint32_t>(state)); | 
 | 86 |         data.writeCString(device_address); | 
 | 87 |         remote()->transact(SET_DEVICE_CONNECTION_STATE, data, &reply); | 
 | 88 |         return static_cast <status_t> (reply.readInt32()); | 
 | 89 |     } | 
 | 90 |  | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 91 |     virtual audio_policy_dev_state_t getDeviceConnectionState( | 
 | 92 |                                     audio_devices_t device, | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 93 |                                     const char *device_address) | 
 | 94 |     { | 
 | 95 |         Parcel data, reply; | 
 | 96 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 97 |         data.writeInt32(static_cast <uint32_t>(device)); | 
 | 98 |         data.writeCString(device_address); | 
 | 99 |         remote()->transact(GET_DEVICE_CONNECTION_STATE, data, &reply); | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 100 |         return static_cast <audio_policy_dev_state_t>(reply.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 101 |     } | 
 | 102 |  | 
| Glenn Kasten | f78aee7 | 2012-01-04 11:00:47 -0800 | [diff] [blame] | 103 |     virtual status_t setPhoneState(audio_mode_t state) | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 104 |     { | 
 | 105 |         Parcel data, reply; | 
 | 106 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 107 |         data.writeInt32(state); | 
 | 108 |         remote()->transact(SET_PHONE_STATE, data, &reply); | 
 | 109 |         return static_cast <status_t> (reply.readInt32()); | 
 | 110 |     } | 
 | 111 |  | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 112 |     virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config) | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 113 |     { | 
 | 114 |         Parcel data, reply; | 
 | 115 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 116 |         data.writeInt32(static_cast <uint32_t>(usage)); | 
 | 117 |         data.writeInt32(static_cast <uint32_t>(config)); | 
 | 118 |         remote()->transact(SET_FORCE_USE, data, &reply); | 
 | 119 |         return static_cast <status_t> (reply.readInt32()); | 
 | 120 |     } | 
 | 121 |  | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 122 |     virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage) | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 123 |     { | 
 | 124 |         Parcel data, reply; | 
 | 125 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 126 |         data.writeInt32(static_cast <uint32_t>(usage)); | 
 | 127 |         remote()->transact(GET_FORCE_USE, data, &reply); | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 128 |         return static_cast <audio_policy_forced_cfg_t> (reply.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 129 |     } | 
 | 130 |  | 
 | 131 |     virtual audio_io_handle_t getOutput( | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 132 |                                         audio_stream_type_t stream, | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 133 |                                         uint32_t samplingRate, | 
| Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 134 |                                         audio_format_t format, | 
| Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 135 |                                         audio_channel_mask_t channelMask, | 
| Richard Fitzgerald | ad3af33 | 2013-03-25 16:54:37 +0000 | [diff] [blame] | 136 |                                         audio_output_flags_t flags, | 
 | 137 |                                         const audio_offload_info_t *offloadInfo) | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 138 |     { | 
 | 139 |         Parcel data, reply; | 
 | 140 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 141 |         data.writeInt32(static_cast <uint32_t>(stream)); | 
 | 142 |         data.writeInt32(samplingRate); | 
 | 143 |         data.writeInt32(static_cast <uint32_t>(format)); | 
| Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 144 |         data.writeInt32(channelMask); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 145 |         data.writeInt32(static_cast <uint32_t>(flags)); | 
| Glenn Kasten | 2301acc | 2014-01-17 10:21:00 -0800 | [diff] [blame] | 146 |         // hasOffloadInfo | 
| Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 147 |         if (offloadInfo == NULL) { | 
 | 148 |             data.writeInt32(0); | 
 | 149 |         } else { | 
 | 150 |             data.writeInt32(1); | 
 | 151 |             data.write(offloadInfo, sizeof(audio_offload_info_t)); | 
 | 152 |         } | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 153 |         remote()->transact(GET_OUTPUT, data, &reply); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 154 |         return static_cast <audio_io_handle_t> (reply.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 155 |     } | 
 | 156 |  | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 157 |     virtual status_t startOutput(audio_io_handle_t output, | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 158 |                                  audio_stream_type_t stream, | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 159 |                                  int session) | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 160 |     { | 
 | 161 |         Parcel data, reply; | 
 | 162 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 163 |         data.writeInt32(output); | 
| Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 164 |         data.writeInt32((int32_t) stream); | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 165 |         data.writeInt32(session); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 166 |         remote()->transact(START_OUTPUT, data, &reply); | 
 | 167 |         return static_cast <status_t> (reply.readInt32()); | 
 | 168 |     } | 
 | 169 |  | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 170 |     virtual status_t stopOutput(audio_io_handle_t output, | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 171 |                                 audio_stream_type_t stream, | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 172 |                                 int session) | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 173 |     { | 
 | 174 |         Parcel data, reply; | 
 | 175 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 176 |         data.writeInt32(output); | 
| Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 177 |         data.writeInt32((int32_t) stream); | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 178 |         data.writeInt32(session); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 179 |         remote()->transact(STOP_OUTPUT, data, &reply); | 
 | 180 |         return static_cast <status_t> (reply.readInt32()); | 
 | 181 |     } | 
 | 182 |  | 
 | 183 |     virtual void releaseOutput(audio_io_handle_t output) | 
 | 184 |     { | 
 | 185 |         Parcel data, reply; | 
 | 186 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 187 |         data.writeInt32(output); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 188 |         remote()->transact(RELEASE_OUTPUT, data, &reply); | 
 | 189 |     } | 
 | 190 |  | 
 | 191 |     virtual audio_io_handle_t getInput( | 
| Glenn Kasten | eba51fb | 2012-01-23 13:58:49 -0800 | [diff] [blame] | 192 |                                     audio_source_t inputSource, | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 193 |                                     uint32_t samplingRate, | 
| Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 194 |                                     audio_format_t format, | 
| Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 195 |                                     audio_channel_mask_t channelMask, | 
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 196 |                                     int audioSession) | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 197 |     { | 
 | 198 |         Parcel data, reply; | 
 | 199 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
| Glenn Kasten | eba51fb | 2012-01-23 13:58:49 -0800 | [diff] [blame] | 200 |         data.writeInt32((int32_t) inputSource); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 201 |         data.writeInt32(samplingRate); | 
 | 202 |         data.writeInt32(static_cast <uint32_t>(format)); | 
| Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 203 |         data.writeInt32(channelMask); | 
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 204 |         data.writeInt32(audioSession); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 205 |         remote()->transact(GET_INPUT, data, &reply); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 206 |         return static_cast <audio_io_handle_t> (reply.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 207 |     } | 
 | 208 |  | 
 | 209 |     virtual status_t startInput(audio_io_handle_t input) | 
 | 210 |     { | 
 | 211 |         Parcel data, reply; | 
 | 212 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 213 |         data.writeInt32(input); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 214 |         remote()->transact(START_INPUT, data, &reply); | 
 | 215 |         return static_cast <status_t> (reply.readInt32()); | 
 | 216 |     } | 
 | 217 |  | 
 | 218 |     virtual status_t stopInput(audio_io_handle_t input) | 
 | 219 |     { | 
 | 220 |         Parcel data, reply; | 
 | 221 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 222 |         data.writeInt32(input); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 223 |         remote()->transact(STOP_INPUT, data, &reply); | 
 | 224 |         return static_cast <status_t> (reply.readInt32()); | 
 | 225 |     } | 
 | 226 |  | 
 | 227 |     virtual void releaseInput(audio_io_handle_t input) | 
 | 228 |     { | 
 | 229 |         Parcel data, reply; | 
 | 230 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 231 |         data.writeInt32(input); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 232 |         remote()->transact(RELEASE_INPUT, data, &reply); | 
 | 233 |     } | 
 | 234 |  | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 235 |     virtual status_t initStreamVolume(audio_stream_type_t stream, | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 236 |                                     int indexMin, | 
 | 237 |                                     int indexMax) | 
 | 238 |     { | 
 | 239 |         Parcel data, reply; | 
 | 240 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 241 |         data.writeInt32(static_cast <uint32_t>(stream)); | 
 | 242 |         data.writeInt32(indexMin); | 
 | 243 |         data.writeInt32(indexMax); | 
 | 244 |         remote()->transact(INIT_STREAM_VOLUME, data, &reply); | 
 | 245 |         return static_cast <status_t> (reply.readInt32()); | 
 | 246 |     } | 
 | 247 |  | 
| Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 248 |     virtual status_t setStreamVolumeIndex(audio_stream_type_t stream, | 
 | 249 |                                           int index, | 
 | 250 |                                           audio_devices_t device) | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 251 |     { | 
 | 252 |         Parcel data, reply; | 
 | 253 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 254 |         data.writeInt32(static_cast <uint32_t>(stream)); | 
 | 255 |         data.writeInt32(index); | 
| Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 256 |         data.writeInt32(static_cast <uint32_t>(device)); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 257 |         remote()->transact(SET_STREAM_VOLUME, data, &reply); | 
 | 258 |         return static_cast <status_t> (reply.readInt32()); | 
 | 259 |     } | 
 | 260 |  | 
| Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 261 |     virtual status_t getStreamVolumeIndex(audio_stream_type_t stream, | 
 | 262 |                                           int *index, | 
 | 263 |                                           audio_devices_t device) | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 264 |     { | 
 | 265 |         Parcel data, reply; | 
 | 266 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 267 |         data.writeInt32(static_cast <uint32_t>(stream)); | 
| Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 268 |         data.writeInt32(static_cast <uint32_t>(device)); | 
 | 269 |  | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 270 |         remote()->transact(GET_STREAM_VOLUME, data, &reply); | 
 | 271 |         int lIndex = reply.readInt32(); | 
 | 272 |         if (index) *index = lIndex; | 
 | 273 |         return static_cast <status_t> (reply.readInt32()); | 
 | 274 |     } | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 275 |  | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 276 |     virtual uint32_t getStrategyForStream(audio_stream_type_t stream) | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 277 |     { | 
 | 278 |         Parcel data, reply; | 
 | 279 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 280 |         data.writeInt32(static_cast <uint32_t>(stream)); | 
 | 281 |         remote()->transact(GET_STRATEGY_FOR_STREAM, data, &reply); | 
 | 282 |         return reply.readInt32(); | 
 | 283 |     } | 
 | 284 |  | 
| Eric Laurent | 6374252 | 2012-03-08 13:42:42 -0800 | [diff] [blame] | 285 |     virtual audio_devices_t getDevicesForStream(audio_stream_type_t stream) | 
| Glenn Kasten | 6b2718c | 2011-02-04 13:54:26 -0800 | [diff] [blame] | 286 |     { | 
 | 287 |         Parcel data, reply; | 
 | 288 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 289 |         data.writeInt32(static_cast <uint32_t>(stream)); | 
 | 290 |         remote()->transact(GET_DEVICES_FOR_STREAM, data, &reply); | 
| Eric Laurent | 6374252 | 2012-03-08 13:42:42 -0800 | [diff] [blame] | 291 |         return (audio_devices_t) reply.readInt32(); | 
| Glenn Kasten | 6b2718c | 2011-02-04 13:54:26 -0800 | [diff] [blame] | 292 |     } | 
 | 293 |  | 
| Glenn Kasten | 58e5aa3 | 2012-06-20 14:08:14 -0700 | [diff] [blame] | 294 |     virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t *desc) | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 295 |     { | 
 | 296 |         Parcel data, reply; | 
 | 297 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 298 |         data.write(desc, sizeof(effect_descriptor_t)); | 
 | 299 |         remote()->transact(GET_OUTPUT_FOR_EFFECT, data, &reply); | 
 | 300 |         return static_cast <audio_io_handle_t> (reply.readInt32()); | 
 | 301 |     } | 
 | 302 |  | 
| Glenn Kasten | 58e5aa3 | 2012-06-20 14:08:14 -0700 | [diff] [blame] | 303 |     virtual status_t registerEffect(const effect_descriptor_t *desc, | 
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 304 |                                         audio_io_handle_t io, | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 305 |                                         uint32_t strategy, | 
 | 306 |                                         int session, | 
 | 307 |                                         int id) | 
 | 308 |     { | 
 | 309 |         Parcel data, reply; | 
 | 310 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 311 |         data.write(desc, sizeof(effect_descriptor_t)); | 
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 312 |         data.writeInt32(io); | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 313 |         data.writeInt32(strategy); | 
 | 314 |         data.writeInt32(session); | 
 | 315 |         data.writeInt32(id); | 
 | 316 |         remote()->transact(REGISTER_EFFECT, data, &reply); | 
 | 317 |         return static_cast <status_t> (reply.readInt32()); | 
 | 318 |     } | 
 | 319 |  | 
 | 320 |     virtual status_t unregisterEffect(int id) | 
 | 321 |     { | 
 | 322 |         Parcel data, reply; | 
 | 323 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 324 |         data.writeInt32(id); | 
 | 325 |         remote()->transact(UNREGISTER_EFFECT, data, &reply); | 
 | 326 |         return static_cast <status_t> (reply.readInt32()); | 
 | 327 |     } | 
 | 328 |  | 
| Eric Laurent | db7c079 | 2011-08-10 10:37:50 -0700 | [diff] [blame] | 329 |     virtual status_t setEffectEnabled(int id, bool enabled) | 
 | 330 |     { | 
 | 331 |         Parcel data, reply; | 
 | 332 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 333 |         data.writeInt32(id); | 
 | 334 |         data.writeInt32(enabled); | 
 | 335 |         remote()->transact(SET_EFFECT_ENABLED, data, &reply); | 
 | 336 |         return static_cast <status_t> (reply.readInt32()); | 
 | 337 |     } | 
 | 338 |  | 
| Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 339 |     virtual bool isStreamActive(audio_stream_type_t stream, uint32_t inPastMs) const | 
| Eric Laurent | eda6c36 | 2011-02-02 09:33:30 -0800 | [diff] [blame] | 340 |     { | 
 | 341 |         Parcel data, reply; | 
 | 342 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
| Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 343 |         data.writeInt32((int32_t) stream); | 
| Eric Laurent | eda6c36 | 2011-02-02 09:33:30 -0800 | [diff] [blame] | 344 |         data.writeInt32(inPastMs); | 
 | 345 |         remote()->transact(IS_STREAM_ACTIVE, data, &reply); | 
 | 346 |         return reply.readInt32(); | 
 | 347 |     } | 
| Eric Laurent | 57dae99 | 2011-07-24 13:36:09 -0700 | [diff] [blame] | 348 |  | 
| Jean-Michel Trivi | 272ab54 | 2013-02-04 16:26:02 -0800 | [diff] [blame] | 349 |     virtual bool isStreamActiveRemotely(audio_stream_type_t stream, uint32_t inPastMs) const | 
 | 350 |     { | 
 | 351 |         Parcel data, reply; | 
 | 352 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 353 |         data.writeInt32((int32_t) stream); | 
 | 354 |         data.writeInt32(inPastMs); | 
 | 355 |         remote()->transact(IS_STREAM_ACTIVE_REMOTELY, data, &reply); | 
 | 356 |         return reply.readInt32(); | 
 | 357 |     } | 
 | 358 |  | 
| Jean-Michel Trivi | d708603 | 2012-10-10 12:11:16 -0700 | [diff] [blame] | 359 |     virtual bool isSourceActive(audio_source_t source) const | 
 | 360 |     { | 
 | 361 |         Parcel data, reply; | 
 | 362 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 363 |         data.writeInt32((int32_t) source); | 
 | 364 |         remote()->transact(IS_SOURCE_ACTIVE, data, &reply); | 
 | 365 |         return reply.readInt32(); | 
 | 366 |     } | 
 | 367 |  | 
| Eric Laurent | 57dae99 | 2011-07-24 13:36:09 -0700 | [diff] [blame] | 368 |     virtual status_t queryDefaultPreProcessing(int audioSession, | 
 | 369 |                                                effect_descriptor_t *descriptors, | 
 | 370 |                                                uint32_t *count) | 
 | 371 |     { | 
 | 372 |         if (descriptors == NULL || count == NULL) { | 
 | 373 |             return BAD_VALUE; | 
 | 374 |         } | 
 | 375 |         Parcel data, reply; | 
 | 376 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 377 |         data.writeInt32(audioSession); | 
 | 378 |         data.writeInt32(*count); | 
 | 379 |         status_t status = remote()->transact(QUERY_DEFAULT_PRE_PROCESSING, data, &reply); | 
 | 380 |         if (status != NO_ERROR) { | 
 | 381 |             return status; | 
 | 382 |         } | 
 | 383 |         status = static_cast <status_t> (reply.readInt32()); | 
 | 384 |         uint32_t retCount = reply.readInt32(); | 
 | 385 |         if (retCount != 0) { | 
 | 386 |             uint32_t numDesc = (retCount < *count) ? retCount : *count; | 
 | 387 |             reply.read(descriptors, sizeof(effect_descriptor_t) * numDesc); | 
 | 388 |         } | 
 | 389 |         *count = retCount; | 
 | 390 |         return status; | 
 | 391 |     } | 
| Richard Fitzgerald | ad3af33 | 2013-03-25 16:54:37 +0000 | [diff] [blame] | 392 |  | 
 | 393 |     virtual bool isOffloadSupported(const audio_offload_info_t& info) | 
 | 394 |     { | 
| Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 395 |         Parcel data, reply; | 
 | 396 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 397 |         data.write(&info, sizeof(audio_offload_info_t)); | 
 | 398 |         remote()->transact(IS_OFFLOAD_SUPPORTED, data, &reply); | 
| Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame^] | 399 |         return reply.readInt32(); | 
 | 400 |     } | 
 | 401 |  | 
 | 402 |     virtual status_t listAudioPorts(audio_port_role_t role, | 
 | 403 |                                     audio_port_type_t type, | 
 | 404 |                                     unsigned int *num_ports, | 
 | 405 |                                     struct audio_port *ports, | 
 | 406 |                                     unsigned int *generation) | 
 | 407 |     { | 
 | 408 |         if (num_ports == NULL || (*num_ports != 0 && ports == NULL) || | 
 | 409 |                 generation == NULL) { | 
 | 410 |             return BAD_VALUE; | 
 | 411 |         } | 
 | 412 |         Parcel data, reply; | 
 | 413 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 414 |         unsigned int numPortsReq = (ports == NULL) ? 0 : *num_ports; | 
 | 415 |         data.writeInt32(role); | 
 | 416 |         data.writeInt32(type); | 
 | 417 |         data.writeInt32(numPortsReq); | 
 | 418 |         status_t status = remote()->transact(LIST_AUDIO_PORTS, data, &reply); | 
 | 419 |         if (status == NO_ERROR) { | 
 | 420 |             status = (status_t)reply.readInt32(); | 
 | 421 |             *num_ports = (unsigned int)reply.readInt32(); | 
 | 422 |         } | 
 | 423 |         ALOGI("listAudioPorts() status %d got *num_ports %d", status, *num_ports); | 
 | 424 |         if (status == NO_ERROR) { | 
 | 425 |             if (numPortsReq > *num_ports) { | 
 | 426 |                 numPortsReq = *num_ports; | 
 | 427 |             } | 
 | 428 |             if (numPortsReq > 0) { | 
 | 429 |                 reply.read(ports, numPortsReq * sizeof(struct audio_port)); | 
 | 430 |             } | 
 | 431 |             *generation = reply.readInt32(); | 
 | 432 |         } | 
 | 433 |         return status; | 
 | 434 |     } | 
 | 435 |  | 
 | 436 |     virtual status_t getAudioPort(struct audio_port *port) | 
 | 437 |     { | 
 | 438 |         if (port == NULL) { | 
 | 439 |             return BAD_VALUE; | 
 | 440 |         } | 
 | 441 |         Parcel data, reply; | 
 | 442 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 443 |         data.write(port, sizeof(struct audio_port)); | 
 | 444 |         status_t status = remote()->transact(GET_AUDIO_PORT, data, &reply); | 
 | 445 |         if (status != NO_ERROR || | 
 | 446 |                 (status = (status_t)reply.readInt32()) != NO_ERROR) { | 
 | 447 |             return status; | 
 | 448 |         } | 
 | 449 |         reply.read(port, sizeof(struct audio_port)); | 
 | 450 |         return status; | 
 | 451 |     } | 
 | 452 |  | 
 | 453 |     virtual status_t createAudioPatch(const struct audio_patch *patch, | 
 | 454 |                                        audio_patch_handle_t *handle) | 
 | 455 |     { | 
 | 456 |         if (patch == NULL || handle == NULL) { | 
 | 457 |             return BAD_VALUE; | 
 | 458 |         } | 
 | 459 |         Parcel data, reply; | 
 | 460 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 461 |         data.write(patch, sizeof(struct audio_patch)); | 
 | 462 |         data.write(handle, sizeof(audio_patch_handle_t)); | 
 | 463 |         status_t status = remote()->transact(CREATE_AUDIO_PATCH, data, &reply); | 
 | 464 |         if (status != NO_ERROR || | 
 | 465 |                 (status = (status_t)reply.readInt32()) != NO_ERROR) { | 
 | 466 |             return status; | 
 | 467 |         } | 
 | 468 |         reply.read(handle, sizeof(audio_patch_handle_t)); | 
 | 469 |         return status; | 
 | 470 |     } | 
 | 471 |  | 
 | 472 |     virtual status_t releaseAudioPatch(audio_patch_handle_t handle) | 
 | 473 |     { | 
 | 474 |         Parcel data, reply; | 
 | 475 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 476 |         data.write(&handle, sizeof(audio_patch_handle_t)); | 
 | 477 |         status_t status = remote()->transact(RELEASE_AUDIO_PATCH, data, &reply); | 
 | 478 |         if (status != NO_ERROR) { | 
 | 479 |             status = (status_t)reply.readInt32(); | 
 | 480 |         } | 
 | 481 |         return status; | 
 | 482 |     } | 
 | 483 |  | 
 | 484 |     virtual status_t listAudioPatches(unsigned int *num_patches, | 
 | 485 |                                       struct audio_patch *patches, | 
 | 486 |                                       unsigned int *generation) | 
 | 487 |     { | 
 | 488 |         if (num_patches == NULL || (*num_patches != 0 && patches == NULL) || | 
 | 489 |                 generation == NULL) { | 
 | 490 |             return BAD_VALUE; | 
 | 491 |         } | 
 | 492 |         Parcel data, reply; | 
 | 493 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 494 |         unsigned int numPatchesReq = (patches == NULL) ? 0 : *num_patches; | 
 | 495 |         data.writeInt32(numPatchesReq); | 
 | 496 |         status_t status = remote()->transact(LIST_AUDIO_PATCHES, data, &reply); | 
 | 497 |         if (status == NO_ERROR) { | 
 | 498 |             status = (status_t)reply.readInt32(); | 
 | 499 |             *num_patches = (unsigned int)reply.readInt32(); | 
 | 500 |         } | 
 | 501 |         if (status == NO_ERROR) { | 
 | 502 |             if (numPatchesReq > *num_patches) { | 
 | 503 |                 numPatchesReq = *num_patches; | 
 | 504 |             } | 
 | 505 |             if (numPatchesReq > 0) { | 
 | 506 |                 reply.read(patches, numPatchesReq * sizeof(struct audio_patch)); | 
 | 507 |             } | 
 | 508 |             *generation = reply.readInt32(); | 
 | 509 |         } | 
 | 510 |         return status; | 
 | 511 |     } | 
 | 512 |  | 
 | 513 |     virtual status_t setAudioPortConfig(const struct audio_port_config *config) | 
 | 514 |     { | 
 | 515 |         if (config == NULL) { | 
 | 516 |             return BAD_VALUE; | 
 | 517 |         } | 
 | 518 |         Parcel data, reply; | 
 | 519 |         data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); | 
 | 520 |         data.write(config, sizeof(struct audio_port_config)); | 
 | 521 |         status_t status = remote()->transact(SET_AUDIO_PORT_CONFIG, data, &reply); | 
 | 522 |         if (status != NO_ERROR) { | 
 | 523 |             status = (status_t)reply.readInt32(); | 
 | 524 |         } | 
 | 525 |         return status; | 
 | 526 |     } | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 527 | }; | 
 | 528 |  | 
 | 529 | IMPLEMENT_META_INTERFACE(AudioPolicyService, "android.media.IAudioPolicyService"); | 
 | 530 |  | 
 | 531 | // ---------------------------------------------------------------------- | 
 | 532 |  | 
 | 533 |  | 
 | 534 | status_t BnAudioPolicyService::onTransact( | 
 | 535 |     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) | 
 | 536 | { | 
| Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 537 |     switch (code) { | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 538 |         case SET_DEVICE_CONNECTION_STATE: { | 
 | 539 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 540 |             audio_devices_t device = | 
 | 541 |                     static_cast <audio_devices_t>(data.readInt32()); | 
 | 542 |             audio_policy_dev_state_t state = | 
 | 543 |                     static_cast <audio_policy_dev_state_t>(data.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 544 |             const char *device_address = data.readCString(); | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 545 |             reply->writeInt32(static_cast<uint32_t> (setDeviceConnectionState(device, | 
 | 546 |                                                                               state, | 
 | 547 |                                                                               device_address))); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 548 |             return NO_ERROR; | 
 | 549 |         } break; | 
 | 550 |  | 
 | 551 |         case GET_DEVICE_CONNECTION_STATE: { | 
 | 552 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 553 |             audio_devices_t device = | 
 | 554 |                     static_cast<audio_devices_t> (data.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 555 |             const char *device_address = data.readCString(); | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 556 |             reply->writeInt32(static_cast<uint32_t> (getDeviceConnectionState(device, | 
 | 557 |                                                                               device_address))); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 558 |             return NO_ERROR; | 
 | 559 |         } break; | 
 | 560 |  | 
 | 561 |         case SET_PHONE_STATE: { | 
 | 562 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 563 |             reply->writeInt32(static_cast <uint32_t>(setPhoneState( | 
 | 564 |                     (audio_mode_t) data.readInt32()))); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 565 |             return NO_ERROR; | 
 | 566 |         } break; | 
 | 567 |  | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 568 |         case SET_FORCE_USE: { | 
 | 569 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 570 |             audio_policy_force_use_t usage = static_cast <audio_policy_force_use_t>( | 
 | 571 |                     data.readInt32()); | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 572 |             audio_policy_forced_cfg_t config = | 
 | 573 |                     static_cast <audio_policy_forced_cfg_t>(data.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 574 |             reply->writeInt32(static_cast <uint32_t>(setForceUse(usage, config))); | 
 | 575 |             return NO_ERROR; | 
 | 576 |         } break; | 
 | 577 |  | 
 | 578 |         case GET_FORCE_USE: { | 
 | 579 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 580 |             audio_policy_force_use_t usage = static_cast <audio_policy_force_use_t>( | 
 | 581 |                     data.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 582 |             reply->writeInt32(static_cast <uint32_t>(getForceUse(usage))); | 
 | 583 |             return NO_ERROR; | 
 | 584 |         } break; | 
 | 585 |  | 
 | 586 |         case GET_OUTPUT: { | 
 | 587 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 588 |             audio_stream_type_t stream = | 
 | 589 |                     static_cast <audio_stream_type_t>(data.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 590 |             uint32_t samplingRate = data.readInt32(); | 
| Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 591 |             audio_format_t format = (audio_format_t) data.readInt32(); | 
| Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 592 |             audio_channel_mask_t channelMask = data.readInt32(); | 
| Eric Laurent | 0ca3cf9 | 2012-04-18 09:24:29 -0700 | [diff] [blame] | 593 |             audio_output_flags_t flags = | 
 | 594 |                     static_cast <audio_output_flags_t>(data.readInt32()); | 
| Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 595 |             bool hasOffloadInfo = data.readInt32() != 0; | 
 | 596 |             audio_offload_info_t offloadInfo; | 
 | 597 |             if (hasOffloadInfo) { | 
 | 598 |                 data.read(&offloadInfo, sizeof(audio_offload_info_t)); | 
 | 599 |             } | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 600 |             audio_io_handle_t output = getOutput(stream, | 
 | 601 |                                                  samplingRate, | 
 | 602 |                                                  format, | 
| Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 603 |                                                  channelMask, | 
| Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 604 |                                                  flags, | 
 | 605 |                                                  hasOffloadInfo ? &offloadInfo : NULL); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 606 |             reply->writeInt32(static_cast <int>(output)); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 607 |             return NO_ERROR; | 
 | 608 |         } break; | 
 | 609 |  | 
 | 610 |         case START_OUTPUT: { | 
 | 611 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 612 |             audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32()); | 
| Eric Laurent | ebcb254 | 2014-03-05 18:30:08 -0800 | [diff] [blame] | 613 |             audio_stream_type_t stream = | 
 | 614 |                                 static_cast <audio_stream_type_t>(data.readInt32()); | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 615 |             int session = data.readInt32(); | 
 | 616 |             reply->writeInt32(static_cast <uint32_t>(startOutput(output, | 
| Eric Laurent | ebcb254 | 2014-03-05 18:30:08 -0800 | [diff] [blame] | 617 |                                                                  stream, | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 618 |                                                                  session))); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 619 |             return NO_ERROR; | 
 | 620 |         } break; | 
 | 621 |  | 
 | 622 |         case STOP_OUTPUT: { | 
 | 623 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 624 |             audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32()); | 
| Eric Laurent | ebcb254 | 2014-03-05 18:30:08 -0800 | [diff] [blame] | 625 |             audio_stream_type_t stream = | 
 | 626 |                                 static_cast <audio_stream_type_t>(data.readInt32()); | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 627 |             int session = data.readInt32(); | 
 | 628 |             reply->writeInt32(static_cast <uint32_t>(stopOutput(output, | 
| Eric Laurent | ebcb254 | 2014-03-05 18:30:08 -0800 | [diff] [blame] | 629 |                                                                 stream, | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 630 |                                                                 session))); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 631 |             return NO_ERROR; | 
 | 632 |         } break; | 
 | 633 |  | 
 | 634 |         case RELEASE_OUTPUT: { | 
 | 635 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 636 |             audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 637 |             releaseOutput(output); | 
 | 638 |             return NO_ERROR; | 
 | 639 |         } break; | 
 | 640 |  | 
 | 641 |         case GET_INPUT: { | 
 | 642 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Glenn Kasten | eba51fb | 2012-01-23 13:58:49 -0800 | [diff] [blame] | 643 |             audio_source_t inputSource = (audio_source_t) data.readInt32(); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 644 |             uint32_t samplingRate = data.readInt32(); | 
| Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 645 |             audio_format_t format = (audio_format_t) data.readInt32(); | 
| Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 646 |             audio_channel_mask_t channelMask = data.readInt32(); | 
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 647 |             int audioSession = data.readInt32(); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 648 |             audio_io_handle_t input = getInput(inputSource, | 
 | 649 |                                                samplingRate, | 
 | 650 |                                                format, | 
| Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 651 |                                                channelMask, | 
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 652 |                                                audioSession); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 653 |             reply->writeInt32(static_cast <int>(input)); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 654 |             return NO_ERROR; | 
 | 655 |         } break; | 
 | 656 |  | 
 | 657 |         case START_INPUT: { | 
 | 658 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 659 |             audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 660 |             reply->writeInt32(static_cast <uint32_t>(startInput(input))); | 
 | 661 |             return NO_ERROR; | 
 | 662 |         } break; | 
 | 663 |  | 
 | 664 |         case STOP_INPUT: { | 
 | 665 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 666 |             audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 667 |             reply->writeInt32(static_cast <uint32_t>(stopInput(input))); | 
 | 668 |             return NO_ERROR; | 
 | 669 |         } break; | 
 | 670 |  | 
 | 671 |         case RELEASE_INPUT: { | 
 | 672 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 673 |             audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 674 |             releaseInput(input); | 
 | 675 |             return NO_ERROR; | 
 | 676 |         } break; | 
 | 677 |  | 
 | 678 |         case INIT_STREAM_VOLUME: { | 
 | 679 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 680 |             audio_stream_type_t stream = | 
 | 681 |                     static_cast <audio_stream_type_t>(data.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 682 |             int indexMin = data.readInt32(); | 
 | 683 |             int indexMax = data.readInt32(); | 
 | 684 |             reply->writeInt32(static_cast <uint32_t>(initStreamVolume(stream, indexMin,indexMax))); | 
 | 685 |             return NO_ERROR; | 
 | 686 |         } break; | 
 | 687 |  | 
 | 688 |         case SET_STREAM_VOLUME: { | 
 | 689 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 690 |             audio_stream_type_t stream = | 
 | 691 |                     static_cast <audio_stream_type_t>(data.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 692 |             int index = data.readInt32(); | 
| Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 693 |             audio_devices_t device = static_cast <audio_devices_t>(data.readInt32()); | 
 | 694 |             reply->writeInt32(static_cast <uint32_t>(setStreamVolumeIndex(stream, | 
 | 695 |                                                                           index, | 
 | 696 |                                                                           device))); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 697 |             return NO_ERROR; | 
 | 698 |         } break; | 
 | 699 |  | 
 | 700 |         case GET_STREAM_VOLUME: { | 
 | 701 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 702 |             audio_stream_type_t stream = | 
 | 703 |                     static_cast <audio_stream_type_t>(data.readInt32()); | 
| Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 704 |             audio_devices_t device = static_cast <audio_devices_t>(data.readInt32()); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 705 |             int index; | 
| Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 706 |             status_t status = getStreamVolumeIndex(stream, &index, device); | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 707 |             reply->writeInt32(index); | 
 | 708 |             reply->writeInt32(static_cast <uint32_t>(status)); | 
 | 709 |             return NO_ERROR; | 
 | 710 |         } break; | 
 | 711 |  | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 712 |         case GET_STRATEGY_FOR_STREAM: { | 
 | 713 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 714 |             audio_stream_type_t stream = | 
 | 715 |                     static_cast <audio_stream_type_t>(data.readInt32()); | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 716 |             reply->writeInt32(getStrategyForStream(stream)); | 
 | 717 |             return NO_ERROR; | 
 | 718 |         } break; | 
 | 719 |  | 
| Glenn Kasten | 6b2718c | 2011-02-04 13:54:26 -0800 | [diff] [blame] | 720 |         case GET_DEVICES_FOR_STREAM: { | 
 | 721 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 722 |             audio_stream_type_t stream = | 
 | 723 |                     static_cast <audio_stream_type_t>(data.readInt32()); | 
| Glenn Kasten | 6b2718c | 2011-02-04 13:54:26 -0800 | [diff] [blame] | 724 |             reply->writeInt32(static_cast <int>(getDevicesForStream(stream))); | 
 | 725 |             return NO_ERROR; | 
 | 726 |         } break; | 
 | 727 |  | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 728 |         case GET_OUTPUT_FOR_EFFECT: { | 
 | 729 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
 | 730 |             effect_descriptor_t desc; | 
 | 731 |             data.read(&desc, sizeof(effect_descriptor_t)); | 
 | 732 |             audio_io_handle_t output = getOutputForEffect(&desc); | 
 | 733 |             reply->writeInt32(static_cast <int>(output)); | 
 | 734 |             return NO_ERROR; | 
 | 735 |         } break; | 
 | 736 |  | 
 | 737 |         case REGISTER_EFFECT: { | 
 | 738 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
 | 739 |             effect_descriptor_t desc; | 
 | 740 |             data.read(&desc, sizeof(effect_descriptor_t)); | 
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 741 |             audio_io_handle_t io = data.readInt32(); | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 742 |             uint32_t strategy = data.readInt32(); | 
 | 743 |             int session = data.readInt32(); | 
 | 744 |             int id = data.readInt32(); | 
 | 745 |             reply->writeInt32(static_cast <int32_t>(registerEffect(&desc, | 
| Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 746 |                                                                    io, | 
| Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 747 |                                                                    strategy, | 
 | 748 |                                                                    session, | 
 | 749 |                                                                    id))); | 
 | 750 |             return NO_ERROR; | 
 | 751 |         } break; | 
 | 752 |  | 
 | 753 |         case UNREGISTER_EFFECT: { | 
 | 754 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
 | 755 |             int id = data.readInt32(); | 
 | 756 |             reply->writeInt32(static_cast <int32_t>(unregisterEffect(id))); | 
 | 757 |             return NO_ERROR; | 
 | 758 |         } break; | 
 | 759 |  | 
| Eric Laurent | db7c079 | 2011-08-10 10:37:50 -0700 | [diff] [blame] | 760 |         case SET_EFFECT_ENABLED: { | 
 | 761 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
 | 762 |             int id = data.readInt32(); | 
 | 763 |             bool enabled = static_cast <bool>(data.readInt32()); | 
 | 764 |             reply->writeInt32(static_cast <int32_t>(setEffectEnabled(id, enabled))); | 
 | 765 |             return NO_ERROR; | 
 | 766 |         } break; | 
 | 767 |  | 
| Eric Laurent | eda6c36 | 2011-02-02 09:33:30 -0800 | [diff] [blame] | 768 |         case IS_STREAM_ACTIVE: { | 
 | 769 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
| Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 770 |             audio_stream_type_t stream = (audio_stream_type_t) data.readInt32(); | 
| Eric Laurent | eda6c36 | 2011-02-02 09:33:30 -0800 | [diff] [blame] | 771 |             uint32_t inPastMs = (uint32_t)data.readInt32(); | 
| Eric Laurent | ebcb254 | 2014-03-05 18:30:08 -0800 | [diff] [blame] | 772 |             reply->writeInt32( isStreamActive(stream, inPastMs) ); | 
| Eric Laurent | eda6c36 | 2011-02-02 09:33:30 -0800 | [diff] [blame] | 773 |             return NO_ERROR; | 
 | 774 |         } break; | 
 | 775 |  | 
| Jean-Michel Trivi | 272ab54 | 2013-02-04 16:26:02 -0800 | [diff] [blame] | 776 |         case IS_STREAM_ACTIVE_REMOTELY: { | 
 | 777 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
 | 778 |             audio_stream_type_t stream = (audio_stream_type_t) data.readInt32(); | 
 | 779 |             uint32_t inPastMs = (uint32_t)data.readInt32(); | 
| Eric Laurent | ebcb254 | 2014-03-05 18:30:08 -0800 | [diff] [blame] | 780 |             reply->writeInt32( isStreamActiveRemotely(stream, inPastMs) ); | 
| Jean-Michel Trivi | 272ab54 | 2013-02-04 16:26:02 -0800 | [diff] [blame] | 781 |             return NO_ERROR; | 
 | 782 |         } break; | 
 | 783 |  | 
| Jean-Michel Trivi | d708603 | 2012-10-10 12:11:16 -0700 | [diff] [blame] | 784 |         case IS_SOURCE_ACTIVE: { | 
 | 785 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
 | 786 |             audio_source_t source = (audio_source_t) data.readInt32(); | 
 | 787 |             reply->writeInt32( isSourceActive(source)); | 
 | 788 |             return NO_ERROR; | 
 | 789 |         } | 
 | 790 |  | 
| Eric Laurent | 57dae99 | 2011-07-24 13:36:09 -0700 | [diff] [blame] | 791 |         case QUERY_DEFAULT_PRE_PROCESSING: { | 
 | 792 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
 | 793 |             int audioSession = data.readInt32(); | 
 | 794 |             uint32_t count = data.readInt32(); | 
 | 795 |             uint32_t retCount = count; | 
 | 796 |             effect_descriptor_t *descriptors = | 
 | 797 |                     (effect_descriptor_t *)new char[count * sizeof(effect_descriptor_t)]; | 
 | 798 |             status_t status = queryDefaultPreProcessing(audioSession, descriptors, &retCount); | 
 | 799 |             reply->writeInt32(status); | 
 | 800 |             if (status != NO_ERROR && status != NO_MEMORY) { | 
 | 801 |                 retCount = 0; | 
 | 802 |             } | 
 | 803 |             reply->writeInt32(retCount); | 
 | 804 |             if (retCount) { | 
 | 805 |                 if (retCount < count) { | 
 | 806 |                     count = retCount; | 
 | 807 |                 } | 
 | 808 |                 reply->write(descriptors, sizeof(effect_descriptor_t) * count); | 
 | 809 |             } | 
 | 810 |             delete[] descriptors; | 
 | 811 |             return status; | 
 | 812 |         } | 
 | 813 |  | 
| Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 814 |         case IS_OFFLOAD_SUPPORTED: { | 
 | 815 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
 | 816 |             audio_offload_info_t info; | 
 | 817 |             data.read(&info, sizeof(audio_offload_info_t)); | 
 | 818 |             bool isSupported = isOffloadSupported(info); | 
 | 819 |             reply->writeInt32(isSupported); | 
 | 820 |             return NO_ERROR; | 
 | 821 |         } | 
 | 822 |  | 
| Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame^] | 823 |         case LIST_AUDIO_PORTS: { | 
 | 824 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
 | 825 |             audio_port_role_t role = (audio_port_role_t)data.readInt32(); | 
 | 826 |             audio_port_type_t type = (audio_port_type_t)data.readInt32(); | 
 | 827 |             unsigned int numPortsReq = data.readInt32(); | 
 | 828 |             unsigned int numPorts = numPortsReq; | 
 | 829 |             unsigned int generation; | 
 | 830 |             struct audio_port *ports = | 
 | 831 |                     (struct audio_port *)calloc(numPortsReq, sizeof(struct audio_port)); | 
 | 832 |             status_t status = listAudioPorts(role, type, &numPorts, ports, &generation); | 
 | 833 |             reply->writeInt32(status); | 
 | 834 |             reply->writeInt32(numPorts); | 
 | 835 |             ALOGI("LIST_AUDIO_PORTS status %d got numPorts %d", status, numPorts); | 
 | 836 |  | 
 | 837 |             if (status == NO_ERROR) { | 
 | 838 |                 if (numPortsReq > numPorts) { | 
 | 839 |                     numPortsReq = numPorts; | 
 | 840 |                 } | 
 | 841 |                 reply->write(ports, numPortsReq * sizeof(struct audio_port)); | 
 | 842 |                 reply->writeInt32(generation); | 
 | 843 |             } | 
 | 844 |             free(ports); | 
 | 845 |             return NO_ERROR; | 
 | 846 |         } | 
 | 847 |  | 
 | 848 |         case GET_AUDIO_PORT: { | 
 | 849 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
 | 850 |             struct audio_port port; | 
 | 851 |             data.read(&port, sizeof(struct audio_port)); | 
 | 852 |             status_t status = getAudioPort(&port); | 
 | 853 |             reply->writeInt32(status); | 
 | 854 |             if (status == NO_ERROR) { | 
 | 855 |                 reply->write(&port, sizeof(struct audio_port)); | 
 | 856 |             } | 
 | 857 |             return NO_ERROR; | 
 | 858 |         } | 
 | 859 |  | 
 | 860 |         case CREATE_AUDIO_PATCH: { | 
 | 861 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
 | 862 |             struct audio_patch patch; | 
 | 863 |             data.read(&patch, sizeof(struct audio_patch)); | 
 | 864 |             audio_patch_handle_t handle; | 
 | 865 |             data.read(&handle, sizeof(audio_patch_handle_t)); | 
 | 866 |             status_t status = createAudioPatch(&patch, &handle); | 
 | 867 |             reply->writeInt32(status); | 
 | 868 |             if (status == NO_ERROR) { | 
 | 869 |                 reply->write(&handle, sizeof(audio_patch_handle_t)); | 
 | 870 |             } | 
 | 871 |             return NO_ERROR; | 
 | 872 |         } | 
 | 873 |  | 
 | 874 |         case RELEASE_AUDIO_PATCH: { | 
 | 875 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
 | 876 |             audio_patch_handle_t handle; | 
 | 877 |             data.read(&handle, sizeof(audio_patch_handle_t)); | 
 | 878 |             status_t status = releaseAudioPatch(handle); | 
 | 879 |             reply->writeInt32(status); | 
 | 880 |             return NO_ERROR; | 
 | 881 |         } | 
 | 882 |  | 
 | 883 |         case LIST_AUDIO_PATCHES: { | 
 | 884 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
 | 885 |             unsigned int numPatchesReq = data.readInt32(); | 
 | 886 |             unsigned int numPatches = numPatchesReq; | 
 | 887 |             unsigned int generation; | 
 | 888 |             struct audio_patch *patches = | 
 | 889 |                     (struct audio_patch *)calloc(numPatchesReq, | 
 | 890 |                                                  sizeof(struct audio_patch)); | 
 | 891 |             status_t status = listAudioPatches(&numPatches, patches, &generation); | 
 | 892 |             reply->writeInt32(status); | 
 | 893 |             reply->writeInt32(numPatches); | 
 | 894 |             if (status == NO_ERROR) { | 
 | 895 |                 if (numPatchesReq > numPatches) { | 
 | 896 |                     numPatchesReq = numPatches; | 
 | 897 |                 } | 
 | 898 |                 reply->write(patches, numPatchesReq * sizeof(struct audio_patch)); | 
 | 899 |                 reply->writeInt32(generation); | 
 | 900 |             } | 
 | 901 |             free(patches); | 
 | 902 |             return NO_ERROR; | 
 | 903 |         } | 
 | 904 |  | 
 | 905 |         case SET_AUDIO_PORT_CONFIG: { | 
 | 906 |             CHECK_INTERFACE(IAudioPolicyService, data, reply); | 
 | 907 |             struct audio_port_config config; | 
 | 908 |             data.read(&config, sizeof(struct audio_port_config)); | 
 | 909 |             status_t status = setAudioPortConfig(&config); | 
 | 910 |             reply->writeInt32(status); | 
 | 911 |             return NO_ERROR; | 
 | 912 |         } | 
 | 913 |  | 
| Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 914 |         default: | 
 | 915 |             return BBinder::onTransact(code, data, reply, flags); | 
 | 916 |     } | 
 | 917 | } | 
 | 918 |  | 
 | 919 | // ---------------------------------------------------------------------------- | 
 | 920 |  | 
 | 921 | }; // namespace android |