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 | |
Eric Laurent | 74adca9 | 2014-11-05 12:15:36 -0800 | [diff] [blame] | 26 | #include <media/AudioEffect.h> |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 27 | #include <media/IAudioPolicyService.h> |
| 28 | |
Dima Zavin | 6476024 | 2011-05-11 14:15:23 -0700 | [diff] [blame] | 29 | #include <system/audio.h> |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 30 | |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 31 | namespace android { |
| 32 | |
| 33 | enum { |
| 34 | SET_DEVICE_CONNECTION_STATE = IBinder::FIRST_CALL_TRANSACTION, |
| 35 | GET_DEVICE_CONNECTION_STATE, |
| 36 | SET_PHONE_STATE, |
Glenn Kasten | 0b07b80 | 2012-01-18 14:56:06 -0800 | [diff] [blame] | 37 | SET_RINGER_MODE, // reserved, no longer used |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 38 | SET_FORCE_USE, |
| 39 | GET_FORCE_USE, |
| 40 | GET_OUTPUT, |
| 41 | START_OUTPUT, |
| 42 | STOP_OUTPUT, |
| 43 | RELEASE_OUTPUT, |
Eric Laurent | caf7f48 | 2014-11-25 17:50:47 -0800 | [diff] [blame] | 44 | GET_INPUT_FOR_ATTR, |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 45 | START_INPUT, |
| 46 | STOP_INPUT, |
| 47 | RELEASE_INPUT, |
| 48 | INIT_STREAM_VOLUME, |
| 49 | SET_STREAM_VOLUME, |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 50 | GET_STREAM_VOLUME, |
| 51 | GET_STRATEGY_FOR_STREAM, |
| 52 | GET_OUTPUT_FOR_EFFECT, |
| 53 | REGISTER_EFFECT, |
Eric Laurent | eda6c36 | 2011-02-02 09:33:30 -0800 | [diff] [blame] | 54 | UNREGISTER_EFFECT, |
Glenn Kasten | 6b2718c | 2011-02-04 13:54:26 -0800 | [diff] [blame] | 55 | IS_STREAM_ACTIVE, |
Jean-Michel Trivi | d708603 | 2012-10-10 12:11:16 -0700 | [diff] [blame] | 56 | IS_SOURCE_ACTIVE, |
Glenn Kasten | 6b2718c | 2011-02-04 13:54:26 -0800 | [diff] [blame] | 57 | GET_DEVICES_FOR_STREAM, |
Eric Laurent | db7c079 | 2011-08-10 10:37:50 -0700 | [diff] [blame] | 58 | QUERY_DEFAULT_PRE_PROCESSING, |
Jean-Michel Trivi | 272ab54 | 2013-02-04 16:26:02 -0800 | [diff] [blame] | 59 | SET_EFFECT_ENABLED, |
Richard Fitzgerald | ad3af33 | 2013-03-25 16:54:37 +0000 | [diff] [blame] | 60 | IS_STREAM_ACTIVE_REMOTELY, |
Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame] | 61 | IS_OFFLOAD_SUPPORTED, |
| 62 | LIST_AUDIO_PORTS, |
| 63 | GET_AUDIO_PORT, |
| 64 | CREATE_AUDIO_PATCH, |
| 65 | RELEASE_AUDIO_PATCH, |
| 66 | LIST_AUDIO_PATCHES, |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 67 | SET_AUDIO_PORT_CONFIG, |
Jean-Michel Trivi | 5bd3f38 | 2014-06-13 16:06:54 -0700 | [diff] [blame] | 68 | REGISTER_CLIENT, |
Eric Laurent | df3dc7e | 2014-07-27 18:39:40 -0700 | [diff] [blame] | 69 | GET_OUTPUT_FOR_ATTR, |
| 70 | ACQUIRE_SOUNDTRIGGER_SESSION, |
Eric Laurent | bb6c9a0 | 2014-09-25 14:11:47 -0700 | [diff] [blame] | 71 | RELEASE_SOUNDTRIGGER_SESSION, |
Eric Laurent | baac183 | 2014-12-01 17:52:59 -0800 | [diff] [blame] | 72 | GET_PHONE_STATE, |
| 73 | REGISTER_POLICY_MIXES, |
Eric Laurent | 554a277 | 2015-04-10 11:29:24 -0700 | [diff] [blame] | 74 | START_AUDIO_SOURCE, |
Eric Laurent | e8726fe | 2015-06-26 09:39:24 -0700 | [diff] [blame^] | 75 | STOP_AUDIO_SOURCE, |
| 76 | SET_AUDIO_PORT_CALLBACK_ENABLED, |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 77 | }; |
| 78 | |
Eric Laurent | 1d670b1 | 2015-02-06 10:44:24 -0800 | [diff] [blame] | 79 | #define MAX_ITEMS_PER_LIST 1024 |
| 80 | |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 81 | class BpAudioPolicyService : public BpInterface<IAudioPolicyService> |
| 82 | { |
| 83 | public: |
| 84 | BpAudioPolicyService(const sp<IBinder>& impl) |
| 85 | : BpInterface<IAudioPolicyService>(impl) |
| 86 | { |
| 87 | } |
| 88 | |
| 89 | virtual status_t setDeviceConnectionState( |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 90 | audio_devices_t device, |
| 91 | audio_policy_dev_state_t state, |
Paul McLean | e743a47 | 2015-01-28 11:07:31 -0800 | [diff] [blame] | 92 | const char *device_address, |
| 93 | const char *device_name) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 94 | { |
| 95 | Parcel data, reply; |
| 96 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 97 | data.writeInt32(static_cast <uint32_t>(device)); |
| 98 | data.writeInt32(static_cast <uint32_t>(state)); |
| 99 | data.writeCString(device_address); |
Paul McLean | e743a47 | 2015-01-28 11:07:31 -0800 | [diff] [blame] | 100 | data.writeCString(device_name); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 101 | remote()->transact(SET_DEVICE_CONNECTION_STATE, data, &reply); |
| 102 | return static_cast <status_t> (reply.readInt32()); |
| 103 | } |
| 104 | |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 105 | virtual audio_policy_dev_state_t getDeviceConnectionState( |
| 106 | audio_devices_t device, |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 107 | const char *device_address) |
| 108 | { |
| 109 | Parcel data, reply; |
| 110 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 111 | data.writeInt32(static_cast <uint32_t>(device)); |
| 112 | data.writeCString(device_address); |
| 113 | remote()->transact(GET_DEVICE_CONNECTION_STATE, data, &reply); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 114 | return static_cast <audio_policy_dev_state_t>(reply.readInt32()); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 115 | } |
| 116 | |
Glenn Kasten | f78aee7 | 2012-01-04 11:00:47 -0800 | [diff] [blame] | 117 | virtual status_t setPhoneState(audio_mode_t state) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 118 | { |
| 119 | Parcel data, reply; |
| 120 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 121 | data.writeInt32(state); |
| 122 | remote()->transact(SET_PHONE_STATE, data, &reply); |
| 123 | return static_cast <status_t> (reply.readInt32()); |
| 124 | } |
| 125 | |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 126 | 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] | 127 | { |
| 128 | Parcel data, reply; |
| 129 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 130 | data.writeInt32(static_cast <uint32_t>(usage)); |
| 131 | data.writeInt32(static_cast <uint32_t>(config)); |
| 132 | remote()->transact(SET_FORCE_USE, data, &reply); |
| 133 | return static_cast <status_t> (reply.readInt32()); |
| 134 | } |
| 135 | |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 136 | 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] | 137 | { |
| 138 | Parcel data, reply; |
| 139 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 140 | data.writeInt32(static_cast <uint32_t>(usage)); |
| 141 | remote()->transact(GET_FORCE_USE, data, &reply); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 142 | return static_cast <audio_policy_forced_cfg_t> (reply.readInt32()); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 143 | } |
| 144 | |
| 145 | virtual audio_io_handle_t getOutput( |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 146 | audio_stream_type_t stream, |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 147 | uint32_t samplingRate, |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 148 | audio_format_t format, |
Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 149 | audio_channel_mask_t channelMask, |
Richard Fitzgerald | ad3af33 | 2013-03-25 16:54:37 +0000 | [diff] [blame] | 150 | audio_output_flags_t flags, |
| 151 | const audio_offload_info_t *offloadInfo) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 152 | { |
| 153 | Parcel data, reply; |
| 154 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 155 | data.writeInt32(static_cast <uint32_t>(stream)); |
| 156 | data.writeInt32(samplingRate); |
| 157 | data.writeInt32(static_cast <uint32_t>(format)); |
Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 158 | data.writeInt32(channelMask); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 159 | data.writeInt32(static_cast <uint32_t>(flags)); |
Glenn Kasten | 2301acc | 2014-01-17 10:21:00 -0800 | [diff] [blame] | 160 | // hasOffloadInfo |
Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 161 | if (offloadInfo == NULL) { |
| 162 | data.writeInt32(0); |
| 163 | } else { |
| 164 | data.writeInt32(1); |
| 165 | data.write(offloadInfo, sizeof(audio_offload_info_t)); |
| 166 | } |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 167 | remote()->transact(GET_OUTPUT, data, &reply); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 168 | return static_cast <audio_io_handle_t> (reply.readInt32()); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 169 | } |
| 170 | |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 171 | virtual status_t getOutputForAttr(const audio_attributes_t *attr, |
| 172 | audio_io_handle_t *output, |
| 173 | audio_session_t session, |
| 174 | audio_stream_type_t *stream, |
Eric Laurent | 8c7e6da | 2015-04-21 17:37:00 -0700 | [diff] [blame] | 175 | uid_t uid, |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 176 | uint32_t samplingRate, |
| 177 | audio_format_t format, |
| 178 | audio_channel_mask_t channelMask, |
| 179 | audio_output_flags_t flags, |
Paul McLean | aa98119 | 2015-03-21 09:55:15 -0700 | [diff] [blame] | 180 | audio_port_handle_t selectedDeviceId, |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 181 | const audio_offload_info_t *offloadInfo) |
Jean-Michel Trivi | 5bd3f38 | 2014-06-13 16:06:54 -0700 | [diff] [blame] | 182 | { |
| 183 | Parcel data, reply; |
| 184 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 185 | if (attr == NULL) { |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 186 | if (stream == NULL) { |
| 187 | ALOGE("getOutputForAttr(): NULL audio attributes and stream type"); |
| 188 | return BAD_VALUE; |
| 189 | } |
| 190 | if (*stream == AUDIO_STREAM_DEFAULT) { |
| 191 | ALOGE("getOutputForAttr unspecified stream type"); |
| 192 | return BAD_VALUE; |
| 193 | } |
Jean-Michel Trivi | 5bd3f38 | 2014-06-13 16:06:54 -0700 | [diff] [blame] | 194 | } |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 195 | if (output == NULL) { |
| 196 | ALOGE("getOutputForAttr NULL output - shouldn't happen"); |
| 197 | return BAD_VALUE; |
| 198 | } |
| 199 | if (attr == NULL) { |
| 200 | data.writeInt32(0); |
| 201 | } else { |
| 202 | data.writeInt32(1); |
| 203 | data.write(attr, sizeof(audio_attributes_t)); |
| 204 | } |
| 205 | data.writeInt32(session); |
| 206 | if (stream == NULL) { |
| 207 | data.writeInt32(0); |
| 208 | } else { |
| 209 | data.writeInt32(1); |
| 210 | data.writeInt32(*stream); |
| 211 | } |
Eric Laurent | 8c7e6da | 2015-04-21 17:37:00 -0700 | [diff] [blame] | 212 | data.writeInt32(uid); |
Jean-Michel Trivi | 5bd3f38 | 2014-06-13 16:06:54 -0700 | [diff] [blame] | 213 | data.writeInt32(samplingRate); |
| 214 | data.writeInt32(static_cast <uint32_t>(format)); |
| 215 | data.writeInt32(channelMask); |
| 216 | data.writeInt32(static_cast <uint32_t>(flags)); |
Paul McLean | aa98119 | 2015-03-21 09:55:15 -0700 | [diff] [blame] | 217 | data.writeInt32(selectedDeviceId); |
Jean-Michel Trivi | 5bd3f38 | 2014-06-13 16:06:54 -0700 | [diff] [blame] | 218 | // hasOffloadInfo |
| 219 | if (offloadInfo == NULL) { |
| 220 | data.writeInt32(0); |
| 221 | } else { |
| 222 | data.writeInt32(1); |
| 223 | data.write(offloadInfo, sizeof(audio_offload_info_t)); |
| 224 | } |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 225 | status_t status = remote()->transact(GET_OUTPUT_FOR_ATTR, data, &reply); |
| 226 | if (status != NO_ERROR) { |
| 227 | return status; |
| 228 | } |
| 229 | status = (status_t)reply.readInt32(); |
| 230 | if (status != NO_ERROR) { |
| 231 | return status; |
| 232 | } |
| 233 | *output = (audio_io_handle_t)reply.readInt32(); |
| 234 | if (stream != NULL) { |
| 235 | *stream = (audio_stream_type_t)reply.readInt32(); |
| 236 | } |
| 237 | return status; |
Jean-Michel Trivi | 5bd3f38 | 2014-06-13 16:06:54 -0700 | [diff] [blame] | 238 | } |
| 239 | |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 240 | virtual status_t startOutput(audio_io_handle_t output, |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 241 | audio_stream_type_t stream, |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 242 | audio_session_t session) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 243 | { |
| 244 | Parcel data, reply; |
| 245 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 246 | data.writeInt32(output); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 247 | data.writeInt32((int32_t) stream); |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 248 | data.writeInt32((int32_t)session); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 249 | remote()->transact(START_OUTPUT, data, &reply); |
| 250 | return static_cast <status_t> (reply.readInt32()); |
| 251 | } |
| 252 | |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 253 | virtual status_t stopOutput(audio_io_handle_t output, |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 254 | audio_stream_type_t stream, |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 255 | audio_session_t session) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 256 | { |
| 257 | Parcel data, reply; |
| 258 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 259 | data.writeInt32(output); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 260 | data.writeInt32((int32_t) stream); |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 261 | data.writeInt32((int32_t)session); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 262 | remote()->transact(STOP_OUTPUT, data, &reply); |
| 263 | return static_cast <status_t> (reply.readInt32()); |
| 264 | } |
| 265 | |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 266 | virtual void releaseOutput(audio_io_handle_t output, |
| 267 | audio_stream_type_t stream, |
| 268 | audio_session_t session) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 269 | { |
| 270 | Parcel data, reply; |
| 271 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 272 | data.writeInt32(output); |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 273 | data.writeInt32((int32_t)stream); |
| 274 | data.writeInt32((int32_t)session); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 275 | remote()->transact(RELEASE_OUTPUT, data, &reply); |
| 276 | } |
| 277 | |
Eric Laurent | caf7f48 | 2014-11-25 17:50:47 -0800 | [diff] [blame] | 278 | virtual status_t getInputForAttr(const audio_attributes_t *attr, |
| 279 | audio_io_handle_t *input, |
| 280 | audio_session_t session, |
Eric Laurent | 8c7e6da | 2015-04-21 17:37:00 -0700 | [diff] [blame] | 281 | uid_t uid, |
Eric Laurent | caf7f48 | 2014-11-25 17:50:47 -0800 | [diff] [blame] | 282 | uint32_t samplingRate, |
| 283 | audio_format_t format, |
| 284 | audio_channel_mask_t channelMask, |
Paul McLean | 466dc8e | 2015-04-17 13:15:36 -0600 | [diff] [blame] | 285 | audio_input_flags_t flags, |
| 286 | audio_port_handle_t selectedDeviceId) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 287 | { |
| 288 | Parcel data, reply; |
| 289 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
Eric Laurent | caf7f48 | 2014-11-25 17:50:47 -0800 | [diff] [blame] | 290 | if (attr == NULL) { |
| 291 | ALOGE("getInputForAttr NULL attr - shouldn't happen"); |
| 292 | return BAD_VALUE; |
| 293 | } |
| 294 | if (input == NULL) { |
| 295 | ALOGE("getInputForAttr NULL input - shouldn't happen"); |
| 296 | return BAD_VALUE; |
| 297 | } |
| 298 | data.write(attr, sizeof(audio_attributes_t)); |
| 299 | data.writeInt32(session); |
Eric Laurent | 8c7e6da | 2015-04-21 17:37:00 -0700 | [diff] [blame] | 300 | data.writeInt32(uid); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 301 | data.writeInt32(samplingRate); |
| 302 | data.writeInt32(static_cast <uint32_t>(format)); |
Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 303 | data.writeInt32(channelMask); |
Glenn Kasten | b3b1660 | 2014-07-16 08:36:31 -0700 | [diff] [blame] | 304 | data.writeInt32(flags); |
Paul McLean | 466dc8e | 2015-04-17 13:15:36 -0600 | [diff] [blame] | 305 | data.writeInt32(selectedDeviceId); |
Eric Laurent | caf7f48 | 2014-11-25 17:50:47 -0800 | [diff] [blame] | 306 | status_t status = remote()->transact(GET_INPUT_FOR_ATTR, data, &reply); |
| 307 | if (status != NO_ERROR) { |
| 308 | return status; |
| 309 | } |
| 310 | status = reply.readInt32(); |
| 311 | if (status != NO_ERROR) { |
| 312 | return status; |
| 313 | } |
| 314 | *input = (audio_io_handle_t)reply.readInt32(); |
| 315 | return NO_ERROR; |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 316 | } |
| 317 | |
Eric Laurent | 4dc6806 | 2014-07-28 17:26:49 -0700 | [diff] [blame] | 318 | virtual status_t startInput(audio_io_handle_t input, |
| 319 | audio_session_t session) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 320 | { |
| 321 | Parcel data, reply; |
| 322 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 323 | data.writeInt32(input); |
Eric Laurent | 4dc6806 | 2014-07-28 17:26:49 -0700 | [diff] [blame] | 324 | data.writeInt32(session); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 325 | remote()->transact(START_INPUT, data, &reply); |
| 326 | return static_cast <status_t> (reply.readInt32()); |
| 327 | } |
| 328 | |
Eric Laurent | 4dc6806 | 2014-07-28 17:26:49 -0700 | [diff] [blame] | 329 | virtual status_t stopInput(audio_io_handle_t input, |
| 330 | audio_session_t session) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 331 | { |
| 332 | Parcel data, reply; |
| 333 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 334 | data.writeInt32(input); |
Eric Laurent | 4dc6806 | 2014-07-28 17:26:49 -0700 | [diff] [blame] | 335 | data.writeInt32(session); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 336 | remote()->transact(STOP_INPUT, data, &reply); |
| 337 | return static_cast <status_t> (reply.readInt32()); |
| 338 | } |
| 339 | |
Eric Laurent | 4dc6806 | 2014-07-28 17:26:49 -0700 | [diff] [blame] | 340 | virtual void releaseInput(audio_io_handle_t input, |
| 341 | audio_session_t session) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 342 | { |
| 343 | Parcel data, reply; |
| 344 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 345 | data.writeInt32(input); |
Eric Laurent | 4dc6806 | 2014-07-28 17:26:49 -0700 | [diff] [blame] | 346 | data.writeInt32(session); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 347 | remote()->transact(RELEASE_INPUT, data, &reply); |
| 348 | } |
| 349 | |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 350 | virtual status_t initStreamVolume(audio_stream_type_t stream, |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 351 | int indexMin, |
| 352 | int indexMax) |
| 353 | { |
| 354 | Parcel data, reply; |
| 355 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 356 | data.writeInt32(static_cast <uint32_t>(stream)); |
| 357 | data.writeInt32(indexMin); |
| 358 | data.writeInt32(indexMax); |
| 359 | remote()->transact(INIT_STREAM_VOLUME, data, &reply); |
| 360 | return static_cast <status_t> (reply.readInt32()); |
| 361 | } |
| 362 | |
Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 363 | virtual status_t setStreamVolumeIndex(audio_stream_type_t stream, |
| 364 | int index, |
| 365 | audio_devices_t device) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 366 | { |
| 367 | Parcel data, reply; |
| 368 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 369 | data.writeInt32(static_cast <uint32_t>(stream)); |
| 370 | data.writeInt32(index); |
Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 371 | data.writeInt32(static_cast <uint32_t>(device)); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 372 | remote()->transact(SET_STREAM_VOLUME, data, &reply); |
| 373 | return static_cast <status_t> (reply.readInt32()); |
| 374 | } |
| 375 | |
Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 376 | virtual status_t getStreamVolumeIndex(audio_stream_type_t stream, |
| 377 | int *index, |
| 378 | audio_devices_t device) |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 379 | { |
| 380 | Parcel data, reply; |
| 381 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 382 | data.writeInt32(static_cast <uint32_t>(stream)); |
Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 383 | data.writeInt32(static_cast <uint32_t>(device)); |
| 384 | |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 385 | remote()->transact(GET_STREAM_VOLUME, data, &reply); |
| 386 | int lIndex = reply.readInt32(); |
| 387 | if (index) *index = lIndex; |
| 388 | return static_cast <status_t> (reply.readInt32()); |
| 389 | } |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 390 | |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 391 | virtual uint32_t getStrategyForStream(audio_stream_type_t stream) |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 392 | { |
| 393 | Parcel data, reply; |
| 394 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 395 | data.writeInt32(static_cast <uint32_t>(stream)); |
| 396 | remote()->transact(GET_STRATEGY_FOR_STREAM, data, &reply); |
| 397 | return reply.readInt32(); |
| 398 | } |
| 399 | |
Eric Laurent | 6374252 | 2012-03-08 13:42:42 -0800 | [diff] [blame] | 400 | virtual audio_devices_t getDevicesForStream(audio_stream_type_t stream) |
Glenn Kasten | 6b2718c | 2011-02-04 13:54:26 -0800 | [diff] [blame] | 401 | { |
| 402 | Parcel data, reply; |
| 403 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 404 | data.writeInt32(static_cast <uint32_t>(stream)); |
| 405 | remote()->transact(GET_DEVICES_FOR_STREAM, data, &reply); |
Eric Laurent | 6374252 | 2012-03-08 13:42:42 -0800 | [diff] [blame] | 406 | return (audio_devices_t) reply.readInt32(); |
Glenn Kasten | 6b2718c | 2011-02-04 13:54:26 -0800 | [diff] [blame] | 407 | } |
| 408 | |
Glenn Kasten | 58e5aa3 | 2012-06-20 14:08:14 -0700 | [diff] [blame] | 409 | virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t *desc) |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 410 | { |
| 411 | Parcel data, reply; |
| 412 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 413 | data.write(desc, sizeof(effect_descriptor_t)); |
| 414 | remote()->transact(GET_OUTPUT_FOR_EFFECT, data, &reply); |
| 415 | return static_cast <audio_io_handle_t> (reply.readInt32()); |
| 416 | } |
| 417 | |
Glenn Kasten | 58e5aa3 | 2012-06-20 14:08:14 -0700 | [diff] [blame] | 418 | virtual status_t registerEffect(const effect_descriptor_t *desc, |
Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 419 | audio_io_handle_t io, |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 420 | uint32_t strategy, |
| 421 | int session, |
| 422 | int id) |
| 423 | { |
| 424 | Parcel data, reply; |
| 425 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 426 | data.write(desc, sizeof(effect_descriptor_t)); |
Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 427 | data.writeInt32(io); |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 428 | data.writeInt32(strategy); |
| 429 | data.writeInt32(session); |
| 430 | data.writeInt32(id); |
| 431 | remote()->transact(REGISTER_EFFECT, data, &reply); |
| 432 | return static_cast <status_t> (reply.readInt32()); |
| 433 | } |
| 434 | |
| 435 | virtual status_t unregisterEffect(int id) |
| 436 | { |
| 437 | Parcel data, reply; |
| 438 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 439 | data.writeInt32(id); |
| 440 | remote()->transact(UNREGISTER_EFFECT, data, &reply); |
| 441 | return static_cast <status_t> (reply.readInt32()); |
| 442 | } |
| 443 | |
Eric Laurent | db7c079 | 2011-08-10 10:37:50 -0700 | [diff] [blame] | 444 | virtual status_t setEffectEnabled(int id, bool enabled) |
| 445 | { |
| 446 | Parcel data, reply; |
| 447 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 448 | data.writeInt32(id); |
| 449 | data.writeInt32(enabled); |
| 450 | remote()->transact(SET_EFFECT_ENABLED, data, &reply); |
| 451 | return static_cast <status_t> (reply.readInt32()); |
| 452 | } |
| 453 | |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 454 | virtual bool isStreamActive(audio_stream_type_t stream, uint32_t inPastMs) const |
Eric Laurent | eda6c36 | 2011-02-02 09:33:30 -0800 | [diff] [blame] | 455 | { |
| 456 | Parcel data, reply; |
| 457 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 458 | data.writeInt32((int32_t) stream); |
Eric Laurent | eda6c36 | 2011-02-02 09:33:30 -0800 | [diff] [blame] | 459 | data.writeInt32(inPastMs); |
| 460 | remote()->transact(IS_STREAM_ACTIVE, data, &reply); |
| 461 | return reply.readInt32(); |
| 462 | } |
Eric Laurent | 57dae99 | 2011-07-24 13:36:09 -0700 | [diff] [blame] | 463 | |
Jean-Michel Trivi | 272ab54 | 2013-02-04 16:26:02 -0800 | [diff] [blame] | 464 | virtual bool isStreamActiveRemotely(audio_stream_type_t stream, uint32_t inPastMs) const |
| 465 | { |
| 466 | Parcel data, reply; |
| 467 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 468 | data.writeInt32((int32_t) stream); |
| 469 | data.writeInt32(inPastMs); |
| 470 | remote()->transact(IS_STREAM_ACTIVE_REMOTELY, data, &reply); |
| 471 | return reply.readInt32(); |
| 472 | } |
| 473 | |
Jean-Michel Trivi | d708603 | 2012-10-10 12:11:16 -0700 | [diff] [blame] | 474 | virtual bool isSourceActive(audio_source_t source) const |
| 475 | { |
| 476 | Parcel data, reply; |
| 477 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 478 | data.writeInt32((int32_t) source); |
| 479 | remote()->transact(IS_SOURCE_ACTIVE, data, &reply); |
| 480 | return reply.readInt32(); |
| 481 | } |
| 482 | |
Eric Laurent | 57dae99 | 2011-07-24 13:36:09 -0700 | [diff] [blame] | 483 | virtual status_t queryDefaultPreProcessing(int audioSession, |
| 484 | effect_descriptor_t *descriptors, |
| 485 | uint32_t *count) |
| 486 | { |
| 487 | if (descriptors == NULL || count == NULL) { |
| 488 | return BAD_VALUE; |
| 489 | } |
| 490 | Parcel data, reply; |
| 491 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 492 | data.writeInt32(audioSession); |
| 493 | data.writeInt32(*count); |
| 494 | status_t status = remote()->transact(QUERY_DEFAULT_PRE_PROCESSING, data, &reply); |
| 495 | if (status != NO_ERROR) { |
| 496 | return status; |
| 497 | } |
| 498 | status = static_cast <status_t> (reply.readInt32()); |
| 499 | uint32_t retCount = reply.readInt32(); |
| 500 | if (retCount != 0) { |
| 501 | uint32_t numDesc = (retCount < *count) ? retCount : *count; |
| 502 | reply.read(descriptors, sizeof(effect_descriptor_t) * numDesc); |
| 503 | } |
| 504 | *count = retCount; |
| 505 | return status; |
| 506 | } |
Richard Fitzgerald | ad3af33 | 2013-03-25 16:54:37 +0000 | [diff] [blame] | 507 | |
| 508 | virtual bool isOffloadSupported(const audio_offload_info_t& info) |
| 509 | { |
Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 510 | Parcel data, reply; |
| 511 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 512 | data.write(&info, sizeof(audio_offload_info_t)); |
| 513 | remote()->transact(IS_OFFLOAD_SUPPORTED, data, &reply); |
Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame] | 514 | return reply.readInt32(); |
| 515 | } |
| 516 | |
| 517 | virtual status_t listAudioPorts(audio_port_role_t role, |
| 518 | audio_port_type_t type, |
| 519 | unsigned int *num_ports, |
| 520 | struct audio_port *ports, |
| 521 | unsigned int *generation) |
| 522 | { |
| 523 | if (num_ports == NULL || (*num_ports != 0 && ports == NULL) || |
| 524 | generation == NULL) { |
| 525 | return BAD_VALUE; |
| 526 | } |
| 527 | Parcel data, reply; |
| 528 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 529 | unsigned int numPortsReq = (ports == NULL) ? 0 : *num_ports; |
| 530 | data.writeInt32(role); |
| 531 | data.writeInt32(type); |
| 532 | data.writeInt32(numPortsReq); |
| 533 | status_t status = remote()->transact(LIST_AUDIO_PORTS, data, &reply); |
| 534 | if (status == NO_ERROR) { |
| 535 | status = (status_t)reply.readInt32(); |
| 536 | *num_ports = (unsigned int)reply.readInt32(); |
| 537 | } |
Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame] | 538 | if (status == NO_ERROR) { |
| 539 | if (numPortsReq > *num_ports) { |
| 540 | numPortsReq = *num_ports; |
| 541 | } |
| 542 | if (numPortsReq > 0) { |
| 543 | reply.read(ports, numPortsReq * sizeof(struct audio_port)); |
| 544 | } |
| 545 | *generation = reply.readInt32(); |
| 546 | } |
| 547 | return status; |
| 548 | } |
| 549 | |
| 550 | virtual status_t getAudioPort(struct audio_port *port) |
| 551 | { |
| 552 | if (port == NULL) { |
| 553 | return BAD_VALUE; |
| 554 | } |
| 555 | Parcel data, reply; |
| 556 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 557 | data.write(port, sizeof(struct audio_port)); |
| 558 | status_t status = remote()->transact(GET_AUDIO_PORT, data, &reply); |
| 559 | if (status != NO_ERROR || |
| 560 | (status = (status_t)reply.readInt32()) != NO_ERROR) { |
| 561 | return status; |
| 562 | } |
| 563 | reply.read(port, sizeof(struct audio_port)); |
| 564 | return status; |
| 565 | } |
| 566 | |
| 567 | virtual status_t createAudioPatch(const struct audio_patch *patch, |
| 568 | audio_patch_handle_t *handle) |
| 569 | { |
| 570 | if (patch == NULL || handle == NULL) { |
| 571 | return BAD_VALUE; |
| 572 | } |
| 573 | Parcel data, reply; |
| 574 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 575 | data.write(patch, sizeof(struct audio_patch)); |
| 576 | data.write(handle, sizeof(audio_patch_handle_t)); |
| 577 | status_t status = remote()->transact(CREATE_AUDIO_PATCH, data, &reply); |
| 578 | if (status != NO_ERROR || |
| 579 | (status = (status_t)reply.readInt32()) != NO_ERROR) { |
| 580 | return status; |
| 581 | } |
| 582 | reply.read(handle, sizeof(audio_patch_handle_t)); |
| 583 | return status; |
| 584 | } |
| 585 | |
| 586 | virtual status_t releaseAudioPatch(audio_patch_handle_t handle) |
| 587 | { |
| 588 | Parcel data, reply; |
| 589 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 590 | data.write(&handle, sizeof(audio_patch_handle_t)); |
| 591 | status_t status = remote()->transact(RELEASE_AUDIO_PATCH, data, &reply); |
| 592 | if (status != NO_ERROR) { |
| 593 | status = (status_t)reply.readInt32(); |
| 594 | } |
| 595 | return status; |
| 596 | } |
| 597 | |
| 598 | virtual status_t listAudioPatches(unsigned int *num_patches, |
| 599 | struct audio_patch *patches, |
| 600 | unsigned int *generation) |
| 601 | { |
| 602 | if (num_patches == NULL || (*num_patches != 0 && patches == NULL) || |
| 603 | generation == NULL) { |
| 604 | return BAD_VALUE; |
| 605 | } |
| 606 | Parcel data, reply; |
| 607 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 608 | unsigned int numPatchesReq = (patches == NULL) ? 0 : *num_patches; |
| 609 | data.writeInt32(numPatchesReq); |
| 610 | status_t status = remote()->transact(LIST_AUDIO_PATCHES, data, &reply); |
| 611 | if (status == NO_ERROR) { |
| 612 | status = (status_t)reply.readInt32(); |
| 613 | *num_patches = (unsigned int)reply.readInt32(); |
| 614 | } |
| 615 | if (status == NO_ERROR) { |
| 616 | if (numPatchesReq > *num_patches) { |
| 617 | numPatchesReq = *num_patches; |
| 618 | } |
| 619 | if (numPatchesReq > 0) { |
| 620 | reply.read(patches, numPatchesReq * sizeof(struct audio_patch)); |
| 621 | } |
| 622 | *generation = reply.readInt32(); |
| 623 | } |
| 624 | return status; |
| 625 | } |
| 626 | |
| 627 | virtual status_t setAudioPortConfig(const struct audio_port_config *config) |
| 628 | { |
| 629 | if (config == NULL) { |
| 630 | return BAD_VALUE; |
| 631 | } |
| 632 | Parcel data, reply; |
| 633 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 634 | data.write(config, sizeof(struct audio_port_config)); |
| 635 | status_t status = remote()->transact(SET_AUDIO_PORT_CONFIG, data, &reply); |
| 636 | if (status != NO_ERROR) { |
| 637 | status = (status_t)reply.readInt32(); |
| 638 | } |
| 639 | return status; |
| 640 | } |
Eric Laurent | df3dc7e | 2014-07-27 18:39:40 -0700 | [diff] [blame] | 641 | |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 642 | virtual void registerClient(const sp<IAudioPolicyServiceClient>& client) |
| 643 | { |
| 644 | Parcel data, reply; |
| 645 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
Marco Nelissen | f888020 | 2014-11-14 07:58:25 -0800 | [diff] [blame] | 646 | data.writeStrongBinder(IInterface::asBinder(client)); |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 647 | remote()->transact(REGISTER_CLIENT, data, &reply); |
| 648 | } |
Eric Laurent | df3dc7e | 2014-07-27 18:39:40 -0700 | [diff] [blame] | 649 | |
Eric Laurent | e8726fe | 2015-06-26 09:39:24 -0700 | [diff] [blame^] | 650 | virtual void setAudioPortCallbacksEnabled(bool enabled) |
| 651 | { |
| 652 | Parcel data, reply; |
| 653 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 654 | data.writeInt32(enabled ? 1 : 0); |
| 655 | remote()->transact(SET_AUDIO_PORT_CALLBACK_ENABLED, data, &reply); |
| 656 | } |
| 657 | |
Eric Laurent | df3dc7e | 2014-07-27 18:39:40 -0700 | [diff] [blame] | 658 | virtual status_t acquireSoundTriggerSession(audio_session_t *session, |
| 659 | audio_io_handle_t *ioHandle, |
| 660 | audio_devices_t *device) |
| 661 | { |
| 662 | if (session == NULL || ioHandle == NULL || device == NULL) { |
| 663 | return BAD_VALUE; |
| 664 | } |
| 665 | Parcel data, reply; |
| 666 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 667 | status_t status = remote()->transact(ACQUIRE_SOUNDTRIGGER_SESSION, data, &reply); |
| 668 | if (status != NO_ERROR) { |
| 669 | return status; |
| 670 | } |
| 671 | status = (status_t)reply.readInt32(); |
| 672 | if (status == NO_ERROR) { |
| 673 | *session = (audio_session_t)reply.readInt32(); |
| 674 | *ioHandle = (audio_io_handle_t)reply.readInt32(); |
| 675 | *device = (audio_devices_t)reply.readInt32(); |
| 676 | } |
| 677 | return status; |
| 678 | } |
| 679 | |
| 680 | virtual status_t releaseSoundTriggerSession(audio_session_t session) |
| 681 | { |
| 682 | Parcel data, reply; |
| 683 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 684 | data.writeInt32(session); |
| 685 | status_t status = remote()->transact(RELEASE_SOUNDTRIGGER_SESSION, data, &reply); |
| 686 | if (status != NO_ERROR) { |
| 687 | return status; |
| 688 | } |
| 689 | return (status_t)reply.readInt32(); |
| 690 | } |
Eric Laurent | bb6c9a0 | 2014-09-25 14:11:47 -0700 | [diff] [blame] | 691 | |
| 692 | virtual audio_mode_t getPhoneState() |
| 693 | { |
| 694 | Parcel data, reply; |
| 695 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 696 | status_t status = remote()->transact(GET_PHONE_STATE, data, &reply); |
| 697 | if (status != NO_ERROR) { |
| 698 | return AUDIO_MODE_INVALID; |
| 699 | } |
| 700 | return (audio_mode_t)reply.readInt32(); |
| 701 | } |
Eric Laurent | baac183 | 2014-12-01 17:52:59 -0800 | [diff] [blame] | 702 | |
| 703 | virtual status_t registerPolicyMixes(Vector<AudioMix> mixes, bool registration) |
| 704 | { |
| 705 | Parcel data, reply; |
| 706 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 707 | data.writeInt32(registration ? 1 : 0); |
| 708 | size_t size = mixes.size(); |
| 709 | if (size > MAX_MIXES_PER_POLICY) { |
| 710 | size = MAX_MIXES_PER_POLICY; |
| 711 | } |
| 712 | size_t sizePosition = data.dataPosition(); |
| 713 | data.writeInt32(size); |
| 714 | size_t finalSize = size; |
| 715 | for (size_t i = 0; i < size; i++) { |
| 716 | size_t position = data.dataPosition(); |
| 717 | if (mixes[i].writeToParcel(&data) != NO_ERROR) { |
| 718 | data.setDataPosition(position); |
| 719 | finalSize--; |
| 720 | } |
| 721 | } |
| 722 | if (size != finalSize) { |
| 723 | size_t position = data.dataPosition(); |
| 724 | data.setDataPosition(sizePosition); |
| 725 | data.writeInt32(finalSize); |
| 726 | data.setDataPosition(position); |
| 727 | } |
| 728 | status_t status = remote()->transact(REGISTER_POLICY_MIXES, data, &reply); |
| 729 | if (status == NO_ERROR) { |
| 730 | status = (status_t)reply.readInt32(); |
| 731 | } |
| 732 | return status; |
| 733 | } |
Eric Laurent | 554a277 | 2015-04-10 11:29:24 -0700 | [diff] [blame] | 734 | |
| 735 | virtual status_t startAudioSource(const struct audio_port_config *source, |
| 736 | const audio_attributes_t *attributes, |
| 737 | audio_io_handle_t *handle) |
| 738 | { |
| 739 | Parcel data, reply; |
| 740 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 741 | if (source == NULL || attributes == NULL || handle == NULL) { |
| 742 | return BAD_VALUE; |
| 743 | } |
| 744 | data.write(source, sizeof(struct audio_port_config)); |
| 745 | data.write(attributes, sizeof(audio_attributes_t)); |
| 746 | status_t status = remote()->transact(START_AUDIO_SOURCE, data, &reply); |
| 747 | if (status != NO_ERROR) { |
| 748 | return status; |
| 749 | } |
| 750 | status = (status_t)reply.readInt32(); |
| 751 | if (status != NO_ERROR) { |
| 752 | return status; |
| 753 | } |
| 754 | *handle = (audio_io_handle_t)reply.readInt32(); |
| 755 | return status; |
| 756 | } |
| 757 | |
| 758 | virtual status_t stopAudioSource(audio_io_handle_t handle) |
| 759 | { |
| 760 | Parcel data, reply; |
| 761 | data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); |
| 762 | data.writeInt32(handle); |
| 763 | status_t status = remote()->transact(STOP_AUDIO_SOURCE, data, &reply); |
| 764 | if (status != NO_ERROR) { |
| 765 | return status; |
| 766 | } |
| 767 | status = (status_t)reply.readInt32(); |
| 768 | return status; |
| 769 | } |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 770 | }; |
| 771 | |
| 772 | IMPLEMENT_META_INTERFACE(AudioPolicyService, "android.media.IAudioPolicyService"); |
| 773 | |
| 774 | // ---------------------------------------------------------------------- |
| 775 | |
| 776 | |
| 777 | status_t BnAudioPolicyService::onTransact( |
| 778 | uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) |
| 779 | { |
Glenn Kasten | e53b9ea | 2012-03-12 16:29:55 -0700 | [diff] [blame] | 780 | switch (code) { |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 781 | case SET_DEVICE_CONNECTION_STATE: { |
| 782 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 783 | audio_devices_t device = |
| 784 | static_cast <audio_devices_t>(data.readInt32()); |
| 785 | audio_policy_dev_state_t state = |
| 786 | static_cast <audio_policy_dev_state_t>(data.readInt32()); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 787 | const char *device_address = data.readCString(); |
Paul McLean | e743a47 | 2015-01-28 11:07:31 -0800 | [diff] [blame] | 788 | const char *device_name = data.readCString(); |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 789 | reply->writeInt32(static_cast<uint32_t> (setDeviceConnectionState(device, |
| 790 | state, |
Paul McLean | e743a47 | 2015-01-28 11:07:31 -0800 | [diff] [blame] | 791 | device_address, |
| 792 | device_name))); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 793 | return NO_ERROR; |
| 794 | } break; |
| 795 | |
| 796 | case GET_DEVICE_CONNECTION_STATE: { |
| 797 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 798 | audio_devices_t device = |
| 799 | static_cast<audio_devices_t> (data.readInt32()); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 800 | const char *device_address = data.readCString(); |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 801 | reply->writeInt32(static_cast<uint32_t> (getDeviceConnectionState(device, |
| 802 | device_address))); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 803 | return NO_ERROR; |
| 804 | } break; |
| 805 | |
| 806 | case SET_PHONE_STATE: { |
| 807 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 808 | reply->writeInt32(static_cast <uint32_t>(setPhoneState( |
| 809 | (audio_mode_t) data.readInt32()))); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 810 | return NO_ERROR; |
| 811 | } break; |
| 812 | |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 813 | case SET_FORCE_USE: { |
| 814 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 815 | audio_policy_force_use_t usage = static_cast <audio_policy_force_use_t>( |
| 816 | data.readInt32()); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 817 | audio_policy_forced_cfg_t config = |
| 818 | static_cast <audio_policy_forced_cfg_t>(data.readInt32()); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 819 | reply->writeInt32(static_cast <uint32_t>(setForceUse(usage, config))); |
| 820 | return NO_ERROR; |
| 821 | } break; |
| 822 | |
| 823 | case GET_FORCE_USE: { |
| 824 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 825 | audio_policy_force_use_t usage = static_cast <audio_policy_force_use_t>( |
| 826 | data.readInt32()); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 827 | reply->writeInt32(static_cast <uint32_t>(getForceUse(usage))); |
| 828 | return NO_ERROR; |
| 829 | } break; |
| 830 | |
| 831 | case GET_OUTPUT: { |
| 832 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 833 | audio_stream_type_t stream = |
| 834 | static_cast <audio_stream_type_t>(data.readInt32()); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 835 | uint32_t samplingRate = data.readInt32(); |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 836 | audio_format_t format = (audio_format_t) data.readInt32(); |
Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 837 | audio_channel_mask_t channelMask = data.readInt32(); |
Eric Laurent | 0ca3cf9 | 2012-04-18 09:24:29 -0700 | [diff] [blame] | 838 | audio_output_flags_t flags = |
| 839 | static_cast <audio_output_flags_t>(data.readInt32()); |
Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 840 | bool hasOffloadInfo = data.readInt32() != 0; |
| 841 | audio_offload_info_t offloadInfo; |
| 842 | if (hasOffloadInfo) { |
| 843 | data.read(&offloadInfo, sizeof(audio_offload_info_t)); |
| 844 | } |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 845 | audio_io_handle_t output = getOutput(stream, |
| 846 | samplingRate, |
| 847 | format, |
Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 848 | channelMask, |
Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 849 | flags, |
| 850 | hasOffloadInfo ? &offloadInfo : NULL); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 851 | reply->writeInt32(static_cast <int>(output)); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 852 | return NO_ERROR; |
| 853 | } break; |
| 854 | |
Jean-Michel Trivi | 5bd3f38 | 2014-06-13 16:06:54 -0700 | [diff] [blame] | 855 | case GET_OUTPUT_FOR_ATTR: { |
| 856 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Glenn Kasten | 85f480e | 2014-11-05 17:44:51 -0800 | [diff] [blame] | 857 | audio_attributes_t attr; |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 858 | bool hasAttributes = data.readInt32() != 0; |
| 859 | if (hasAttributes) { |
| 860 | data.read(&attr, sizeof(audio_attributes_t)); |
| 861 | } |
| 862 | audio_session_t session = (audio_session_t)data.readInt32(); |
| 863 | audio_stream_type_t stream = AUDIO_STREAM_DEFAULT; |
| 864 | bool hasStream = data.readInt32() != 0; |
| 865 | if (hasStream) { |
| 866 | stream = (audio_stream_type_t)data.readInt32(); |
| 867 | } |
Eric Laurent | 8c7e6da | 2015-04-21 17:37:00 -0700 | [diff] [blame] | 868 | uid_t uid = (uid_t)data.readInt32(); |
Jean-Michel Trivi | 5bd3f38 | 2014-06-13 16:06:54 -0700 | [diff] [blame] | 869 | uint32_t samplingRate = data.readInt32(); |
| 870 | audio_format_t format = (audio_format_t) data.readInt32(); |
| 871 | audio_channel_mask_t channelMask = data.readInt32(); |
| 872 | audio_output_flags_t flags = |
| 873 | static_cast <audio_output_flags_t>(data.readInt32()); |
Paul McLean | aa98119 | 2015-03-21 09:55:15 -0700 | [diff] [blame] | 874 | audio_port_handle_t selectedDeviceId = data.readInt32(); |
Jean-Michel Trivi | 5bd3f38 | 2014-06-13 16:06:54 -0700 | [diff] [blame] | 875 | bool hasOffloadInfo = data.readInt32() != 0; |
| 876 | audio_offload_info_t offloadInfo; |
| 877 | if (hasOffloadInfo) { |
| 878 | data.read(&offloadInfo, sizeof(audio_offload_info_t)); |
| 879 | } |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 880 | audio_io_handle_t output; |
| 881 | status_t status = getOutputForAttr(hasAttributes ? &attr : NULL, |
Eric Laurent | 8c7e6da | 2015-04-21 17:37:00 -0700 | [diff] [blame] | 882 | &output, session, &stream, uid, |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 883 | samplingRate, format, channelMask, |
Paul McLean | aa98119 | 2015-03-21 09:55:15 -0700 | [diff] [blame] | 884 | flags, selectedDeviceId, hasOffloadInfo ? &offloadInfo : NULL); |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 885 | reply->writeInt32(status); |
| 886 | reply->writeInt32(output); |
| 887 | reply->writeInt32(stream); |
Jean-Michel Trivi | 5bd3f38 | 2014-06-13 16:06:54 -0700 | [diff] [blame] | 888 | return NO_ERROR; |
| 889 | } break; |
| 890 | |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 891 | case START_OUTPUT: { |
| 892 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 893 | 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] | 894 | audio_stream_type_t stream = |
| 895 | static_cast <audio_stream_type_t>(data.readInt32()); |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 896 | audio_session_t session = (audio_session_t)data.readInt32(); |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 897 | reply->writeInt32(static_cast <uint32_t>(startOutput(output, |
Eric Laurent | ebcb254 | 2014-03-05 18:30:08 -0800 | [diff] [blame] | 898 | stream, |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 899 | session))); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 900 | return NO_ERROR; |
| 901 | } break; |
| 902 | |
| 903 | case STOP_OUTPUT: { |
| 904 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 905 | 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] | 906 | audio_stream_type_t stream = |
| 907 | static_cast <audio_stream_type_t>(data.readInt32()); |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 908 | audio_session_t session = (audio_session_t)data.readInt32(); |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 909 | reply->writeInt32(static_cast <uint32_t>(stopOutput(output, |
Eric Laurent | ebcb254 | 2014-03-05 18:30:08 -0800 | [diff] [blame] | 910 | stream, |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 911 | session))); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 912 | return NO_ERROR; |
| 913 | } break; |
| 914 | |
| 915 | case RELEASE_OUTPUT: { |
| 916 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 917 | audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32()); |
Eric Laurent | e83b55d | 2014-11-14 10:06:21 -0800 | [diff] [blame] | 918 | audio_stream_type_t stream = (audio_stream_type_t)data.readInt32(); |
| 919 | audio_session_t session = (audio_session_t)data.readInt32(); |
| 920 | releaseOutput(output, stream, session); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 921 | return NO_ERROR; |
| 922 | } break; |
| 923 | |
Eric Laurent | caf7f48 | 2014-11-25 17:50:47 -0800 | [diff] [blame] | 924 | case GET_INPUT_FOR_ATTR: { |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 925 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Eric Laurent | caf7f48 | 2014-11-25 17:50:47 -0800 | [diff] [blame] | 926 | audio_attributes_t attr; |
| 927 | data.read(&attr, sizeof(audio_attributes_t)); |
| 928 | audio_session_t session = (audio_session_t)data.readInt32(); |
Eric Laurent | 8c7e6da | 2015-04-21 17:37:00 -0700 | [diff] [blame] | 929 | uid_t uid = (uid_t)data.readInt32(); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 930 | uint32_t samplingRate = data.readInt32(); |
Glenn Kasten | 58f3021 | 2012-01-12 12:27:51 -0800 | [diff] [blame] | 931 | audio_format_t format = (audio_format_t) data.readInt32(); |
Glenn Kasten | 254af18 | 2012-07-03 14:59:05 -0700 | [diff] [blame] | 932 | audio_channel_mask_t channelMask = data.readInt32(); |
Glenn Kasten | b3b1660 | 2014-07-16 08:36:31 -0700 | [diff] [blame] | 933 | audio_input_flags_t flags = (audio_input_flags_t) data.readInt32(); |
Paul McLean | 466dc8e | 2015-04-17 13:15:36 -0600 | [diff] [blame] | 934 | audio_port_handle_t selectedDeviceId = (audio_port_handle_t) data.readInt32(); |
Eric Laurent | caf7f48 | 2014-11-25 17:50:47 -0800 | [diff] [blame] | 935 | audio_io_handle_t input; |
Eric Laurent | 8c7e6da | 2015-04-21 17:37:00 -0700 | [diff] [blame] | 936 | status_t status = getInputForAttr(&attr, &input, session, uid, |
Eric Laurent | caf7f48 | 2014-11-25 17:50:47 -0800 | [diff] [blame] | 937 | samplingRate, format, channelMask, |
Paul McLean | 466dc8e | 2015-04-17 13:15:36 -0600 | [diff] [blame] | 938 | flags, selectedDeviceId); |
Eric Laurent | caf7f48 | 2014-11-25 17:50:47 -0800 | [diff] [blame] | 939 | reply->writeInt32(status); |
| 940 | if (status == NO_ERROR) { |
| 941 | reply->writeInt32(input); |
| 942 | } |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 943 | return NO_ERROR; |
| 944 | } break; |
| 945 | |
| 946 | case START_INPUT: { |
| 947 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 948 | audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32()); |
Eric Laurent | 4dc6806 | 2014-07-28 17:26:49 -0700 | [diff] [blame] | 949 | audio_session_t session = static_cast <audio_session_t>(data.readInt32()); |
| 950 | reply->writeInt32(static_cast <uint32_t>(startInput(input, session))); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 951 | return NO_ERROR; |
| 952 | } break; |
| 953 | |
| 954 | case STOP_INPUT: { |
| 955 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 956 | audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32()); |
Eric Laurent | 4dc6806 | 2014-07-28 17:26:49 -0700 | [diff] [blame] | 957 | audio_session_t session = static_cast <audio_session_t>(data.readInt32()); |
| 958 | reply->writeInt32(static_cast <uint32_t>(stopInput(input, session))); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 959 | return NO_ERROR; |
| 960 | } break; |
| 961 | |
| 962 | case RELEASE_INPUT: { |
| 963 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Eric Laurent | fa2877b | 2009-07-28 08:44:33 -0700 | [diff] [blame] | 964 | audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32()); |
Eric Laurent | 4dc6806 | 2014-07-28 17:26:49 -0700 | [diff] [blame] | 965 | audio_session_t session = static_cast <audio_session_t>(data.readInt32()); |
| 966 | releaseInput(input, session); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 967 | return NO_ERROR; |
| 968 | } break; |
| 969 | |
| 970 | case INIT_STREAM_VOLUME: { |
| 971 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 972 | audio_stream_type_t stream = |
| 973 | static_cast <audio_stream_type_t>(data.readInt32()); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 974 | int indexMin = data.readInt32(); |
| 975 | int indexMax = data.readInt32(); |
| 976 | reply->writeInt32(static_cast <uint32_t>(initStreamVolume(stream, indexMin,indexMax))); |
| 977 | return NO_ERROR; |
| 978 | } break; |
| 979 | |
| 980 | case SET_STREAM_VOLUME: { |
| 981 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 982 | audio_stream_type_t stream = |
| 983 | static_cast <audio_stream_type_t>(data.readInt32()); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 984 | int index = data.readInt32(); |
Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 985 | audio_devices_t device = static_cast <audio_devices_t>(data.readInt32()); |
| 986 | reply->writeInt32(static_cast <uint32_t>(setStreamVolumeIndex(stream, |
| 987 | index, |
| 988 | device))); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 989 | return NO_ERROR; |
| 990 | } break; |
| 991 | |
| 992 | case GET_STREAM_VOLUME: { |
| 993 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 994 | audio_stream_type_t stream = |
| 995 | static_cast <audio_stream_type_t>(data.readInt32()); |
Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 996 | audio_devices_t device = static_cast <audio_devices_t>(data.readInt32()); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 997 | int index; |
Eric Laurent | 83844cc | 2011-11-18 16:43:31 -0800 | [diff] [blame] | 998 | status_t status = getStreamVolumeIndex(stream, &index, device); |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 999 | reply->writeInt32(index); |
| 1000 | reply->writeInt32(static_cast <uint32_t>(status)); |
| 1001 | return NO_ERROR; |
| 1002 | } break; |
| 1003 | |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 1004 | case GET_STRATEGY_FOR_STREAM: { |
| 1005 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 1006 | audio_stream_type_t stream = |
| 1007 | static_cast <audio_stream_type_t>(data.readInt32()); |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 1008 | reply->writeInt32(getStrategyForStream(stream)); |
| 1009 | return NO_ERROR; |
| 1010 | } break; |
| 1011 | |
Glenn Kasten | 6b2718c | 2011-02-04 13:54:26 -0800 | [diff] [blame] | 1012 | case GET_DEVICES_FOR_STREAM: { |
| 1013 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Dima Zavin | fce7a47 | 2011-04-19 22:30:36 -0700 | [diff] [blame] | 1014 | audio_stream_type_t stream = |
| 1015 | static_cast <audio_stream_type_t>(data.readInt32()); |
Glenn Kasten | 6b2718c | 2011-02-04 13:54:26 -0800 | [diff] [blame] | 1016 | reply->writeInt32(static_cast <int>(getDevicesForStream(stream))); |
| 1017 | return NO_ERROR; |
| 1018 | } break; |
| 1019 | |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 1020 | case GET_OUTPUT_FOR_EFFECT: { |
| 1021 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1022 | effect_descriptor_t desc; |
| 1023 | data.read(&desc, sizeof(effect_descriptor_t)); |
| 1024 | audio_io_handle_t output = getOutputForEffect(&desc); |
| 1025 | reply->writeInt32(static_cast <int>(output)); |
| 1026 | return NO_ERROR; |
| 1027 | } break; |
| 1028 | |
| 1029 | case REGISTER_EFFECT: { |
| 1030 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1031 | effect_descriptor_t desc; |
| 1032 | data.read(&desc, sizeof(effect_descriptor_t)); |
Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 1033 | audio_io_handle_t io = data.readInt32(); |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 1034 | uint32_t strategy = data.readInt32(); |
| 1035 | int session = data.readInt32(); |
| 1036 | int id = data.readInt32(); |
| 1037 | reply->writeInt32(static_cast <int32_t>(registerEffect(&desc, |
Eric Laurent | 7c7f10b | 2011-06-17 21:29:58 -0700 | [diff] [blame] | 1038 | io, |
Eric Laurent | de07013 | 2010-07-13 04:45:46 -0700 | [diff] [blame] | 1039 | strategy, |
| 1040 | session, |
| 1041 | id))); |
| 1042 | return NO_ERROR; |
| 1043 | } break; |
| 1044 | |
| 1045 | case UNREGISTER_EFFECT: { |
| 1046 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1047 | int id = data.readInt32(); |
| 1048 | reply->writeInt32(static_cast <int32_t>(unregisterEffect(id))); |
| 1049 | return NO_ERROR; |
| 1050 | } break; |
| 1051 | |
Eric Laurent | db7c079 | 2011-08-10 10:37:50 -0700 | [diff] [blame] | 1052 | case SET_EFFECT_ENABLED: { |
| 1053 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1054 | int id = data.readInt32(); |
| 1055 | bool enabled = static_cast <bool>(data.readInt32()); |
| 1056 | reply->writeInt32(static_cast <int32_t>(setEffectEnabled(id, enabled))); |
| 1057 | return NO_ERROR; |
| 1058 | } break; |
| 1059 | |
Eric Laurent | eda6c36 | 2011-02-02 09:33:30 -0800 | [diff] [blame] | 1060 | case IS_STREAM_ACTIVE: { |
| 1061 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
Glenn Kasten | fff6d71 | 2012-01-12 16:38:12 -0800 | [diff] [blame] | 1062 | audio_stream_type_t stream = (audio_stream_type_t) data.readInt32(); |
Eric Laurent | eda6c36 | 2011-02-02 09:33:30 -0800 | [diff] [blame] | 1063 | uint32_t inPastMs = (uint32_t)data.readInt32(); |
Eric Laurent | ebcb254 | 2014-03-05 18:30:08 -0800 | [diff] [blame] | 1064 | reply->writeInt32( isStreamActive(stream, inPastMs) ); |
Eric Laurent | eda6c36 | 2011-02-02 09:33:30 -0800 | [diff] [blame] | 1065 | return NO_ERROR; |
| 1066 | } break; |
| 1067 | |
Jean-Michel Trivi | 272ab54 | 2013-02-04 16:26:02 -0800 | [diff] [blame] | 1068 | case IS_STREAM_ACTIVE_REMOTELY: { |
| 1069 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1070 | audio_stream_type_t stream = (audio_stream_type_t) data.readInt32(); |
| 1071 | uint32_t inPastMs = (uint32_t)data.readInt32(); |
Eric Laurent | ebcb254 | 2014-03-05 18:30:08 -0800 | [diff] [blame] | 1072 | reply->writeInt32( isStreamActiveRemotely(stream, inPastMs) ); |
Jean-Michel Trivi | 272ab54 | 2013-02-04 16:26:02 -0800 | [diff] [blame] | 1073 | return NO_ERROR; |
| 1074 | } break; |
| 1075 | |
Jean-Michel Trivi | d708603 | 2012-10-10 12:11:16 -0700 | [diff] [blame] | 1076 | case IS_SOURCE_ACTIVE: { |
| 1077 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1078 | audio_source_t source = (audio_source_t) data.readInt32(); |
| 1079 | reply->writeInt32( isSourceActive(source)); |
| 1080 | return NO_ERROR; |
| 1081 | } |
| 1082 | |
Eric Laurent | 57dae99 | 2011-07-24 13:36:09 -0700 | [diff] [blame] | 1083 | case QUERY_DEFAULT_PRE_PROCESSING: { |
| 1084 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1085 | int audioSession = data.readInt32(); |
| 1086 | uint32_t count = data.readInt32(); |
Eric Laurent | 74adca9 | 2014-11-05 12:15:36 -0800 | [diff] [blame] | 1087 | if (count > AudioEffect::kMaxPreProcessing) { |
| 1088 | count = AudioEffect::kMaxPreProcessing; |
| 1089 | } |
Eric Laurent | 57dae99 | 2011-07-24 13:36:09 -0700 | [diff] [blame] | 1090 | uint32_t retCount = count; |
Eric Laurent | 74adca9 | 2014-11-05 12:15:36 -0800 | [diff] [blame] | 1091 | effect_descriptor_t *descriptors = new effect_descriptor_t[count]; |
Eric Laurent | 57dae99 | 2011-07-24 13:36:09 -0700 | [diff] [blame] | 1092 | status_t status = queryDefaultPreProcessing(audioSession, descriptors, &retCount); |
| 1093 | reply->writeInt32(status); |
| 1094 | if (status != NO_ERROR && status != NO_MEMORY) { |
| 1095 | retCount = 0; |
| 1096 | } |
| 1097 | reply->writeInt32(retCount); |
Eric Laurent | 74adca9 | 2014-11-05 12:15:36 -0800 | [diff] [blame] | 1098 | if (retCount != 0) { |
Eric Laurent | 57dae99 | 2011-07-24 13:36:09 -0700 | [diff] [blame] | 1099 | if (retCount < count) { |
| 1100 | count = retCount; |
| 1101 | } |
| 1102 | reply->write(descriptors, sizeof(effect_descriptor_t) * count); |
| 1103 | } |
| 1104 | delete[] descriptors; |
| 1105 | return status; |
| 1106 | } |
| 1107 | |
Richard Fitzgerald | b1a270d | 2013-05-14 12:12:21 +0100 | [diff] [blame] | 1108 | case IS_OFFLOAD_SUPPORTED: { |
| 1109 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1110 | audio_offload_info_t info; |
| 1111 | data.read(&info, sizeof(audio_offload_info_t)); |
| 1112 | bool isSupported = isOffloadSupported(info); |
| 1113 | reply->writeInt32(isSupported); |
| 1114 | return NO_ERROR; |
| 1115 | } |
| 1116 | |
Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame] | 1117 | case LIST_AUDIO_PORTS: { |
| 1118 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1119 | audio_port_role_t role = (audio_port_role_t)data.readInt32(); |
| 1120 | audio_port_type_t type = (audio_port_type_t)data.readInt32(); |
| 1121 | unsigned int numPortsReq = data.readInt32(); |
Eric Laurent | 1d670b1 | 2015-02-06 10:44:24 -0800 | [diff] [blame] | 1122 | if (numPortsReq > MAX_ITEMS_PER_LIST) { |
| 1123 | numPortsReq = MAX_ITEMS_PER_LIST; |
| 1124 | } |
Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame] | 1125 | unsigned int numPorts = numPortsReq; |
Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame] | 1126 | struct audio_port *ports = |
| 1127 | (struct audio_port *)calloc(numPortsReq, sizeof(struct audio_port)); |
Eric Laurent | 1d670b1 | 2015-02-06 10:44:24 -0800 | [diff] [blame] | 1128 | if (ports == NULL) { |
| 1129 | reply->writeInt32(NO_MEMORY); |
| 1130 | reply->writeInt32(0); |
| 1131 | return NO_ERROR; |
| 1132 | } |
| 1133 | unsigned int generation; |
Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame] | 1134 | status_t status = listAudioPorts(role, type, &numPorts, ports, &generation); |
| 1135 | reply->writeInt32(status); |
| 1136 | reply->writeInt32(numPorts); |
Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame] | 1137 | |
| 1138 | if (status == NO_ERROR) { |
| 1139 | if (numPortsReq > numPorts) { |
| 1140 | numPortsReq = numPorts; |
| 1141 | } |
| 1142 | reply->write(ports, numPortsReq * sizeof(struct audio_port)); |
| 1143 | reply->writeInt32(generation); |
| 1144 | } |
| 1145 | free(ports); |
| 1146 | return NO_ERROR; |
| 1147 | } |
| 1148 | |
| 1149 | case GET_AUDIO_PORT: { |
| 1150 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1151 | struct audio_port port; |
| 1152 | data.read(&port, sizeof(struct audio_port)); |
| 1153 | status_t status = getAudioPort(&port); |
| 1154 | reply->writeInt32(status); |
| 1155 | if (status == NO_ERROR) { |
| 1156 | reply->write(&port, sizeof(struct audio_port)); |
| 1157 | } |
| 1158 | return NO_ERROR; |
| 1159 | } |
| 1160 | |
| 1161 | case CREATE_AUDIO_PATCH: { |
| 1162 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1163 | struct audio_patch patch; |
| 1164 | data.read(&patch, sizeof(struct audio_patch)); |
| 1165 | audio_patch_handle_t handle; |
| 1166 | data.read(&handle, sizeof(audio_patch_handle_t)); |
| 1167 | status_t status = createAudioPatch(&patch, &handle); |
| 1168 | reply->writeInt32(status); |
| 1169 | if (status == NO_ERROR) { |
| 1170 | reply->write(&handle, sizeof(audio_patch_handle_t)); |
| 1171 | } |
| 1172 | return NO_ERROR; |
| 1173 | } |
| 1174 | |
| 1175 | case RELEASE_AUDIO_PATCH: { |
| 1176 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1177 | audio_patch_handle_t handle; |
| 1178 | data.read(&handle, sizeof(audio_patch_handle_t)); |
| 1179 | status_t status = releaseAudioPatch(handle); |
| 1180 | reply->writeInt32(status); |
| 1181 | return NO_ERROR; |
| 1182 | } |
| 1183 | |
| 1184 | case LIST_AUDIO_PATCHES: { |
| 1185 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1186 | unsigned int numPatchesReq = data.readInt32(); |
Eric Laurent | 1d670b1 | 2015-02-06 10:44:24 -0800 | [diff] [blame] | 1187 | if (numPatchesReq > MAX_ITEMS_PER_LIST) { |
| 1188 | numPatchesReq = MAX_ITEMS_PER_LIST; |
| 1189 | } |
Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame] | 1190 | unsigned int numPatches = numPatchesReq; |
Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame] | 1191 | struct audio_patch *patches = |
| 1192 | (struct audio_patch *)calloc(numPatchesReq, |
| 1193 | sizeof(struct audio_patch)); |
Eric Laurent | 1d670b1 | 2015-02-06 10:44:24 -0800 | [diff] [blame] | 1194 | if (patches == NULL) { |
| 1195 | reply->writeInt32(NO_MEMORY); |
| 1196 | reply->writeInt32(0); |
| 1197 | return NO_ERROR; |
| 1198 | } |
| 1199 | unsigned int generation; |
Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame] | 1200 | status_t status = listAudioPatches(&numPatches, patches, &generation); |
| 1201 | reply->writeInt32(status); |
| 1202 | reply->writeInt32(numPatches); |
| 1203 | if (status == NO_ERROR) { |
| 1204 | if (numPatchesReq > numPatches) { |
| 1205 | numPatchesReq = numPatches; |
| 1206 | } |
| 1207 | reply->write(patches, numPatchesReq * sizeof(struct audio_patch)); |
| 1208 | reply->writeInt32(generation); |
| 1209 | } |
| 1210 | free(patches); |
| 1211 | return NO_ERROR; |
| 1212 | } |
| 1213 | |
| 1214 | case SET_AUDIO_PORT_CONFIG: { |
| 1215 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1216 | struct audio_port_config config; |
| 1217 | data.read(&config, sizeof(struct audio_port_config)); |
| 1218 | status_t status = setAudioPortConfig(&config); |
| 1219 | reply->writeInt32(status); |
| 1220 | return NO_ERROR; |
| 1221 | } |
Eric Laurent | df3dc7e | 2014-07-27 18:39:40 -0700 | [diff] [blame] | 1222 | |
Eric Laurent | b52c152 | 2014-05-20 11:27:36 -0700 | [diff] [blame] | 1223 | case REGISTER_CLIENT: { |
| 1224 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1225 | sp<IAudioPolicyServiceClient> client = interface_cast<IAudioPolicyServiceClient>( |
| 1226 | data.readStrongBinder()); |
| 1227 | registerClient(client); |
| 1228 | return NO_ERROR; |
| 1229 | } break; |
Eric Laurent | 203b1a1 | 2014-04-01 10:34:16 -0700 | [diff] [blame] | 1230 | |
Eric Laurent | e8726fe | 2015-06-26 09:39:24 -0700 | [diff] [blame^] | 1231 | case SET_AUDIO_PORT_CALLBACK_ENABLED: { |
| 1232 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1233 | setAudioPortCallbacksEnabled(data.readInt32() == 1); |
| 1234 | return NO_ERROR; |
| 1235 | } break; |
| 1236 | |
Eric Laurent | df3dc7e | 2014-07-27 18:39:40 -0700 | [diff] [blame] | 1237 | case ACQUIRE_SOUNDTRIGGER_SESSION: { |
| 1238 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1239 | sp<IAudioPolicyServiceClient> client = interface_cast<IAudioPolicyServiceClient>( |
| 1240 | data.readStrongBinder()); |
| 1241 | audio_session_t session; |
| 1242 | audio_io_handle_t ioHandle; |
| 1243 | audio_devices_t device; |
| 1244 | status_t status = acquireSoundTriggerSession(&session, &ioHandle, &device); |
| 1245 | reply->writeInt32(status); |
| 1246 | if (status == NO_ERROR) { |
| 1247 | reply->writeInt32(session); |
| 1248 | reply->writeInt32(ioHandle); |
| 1249 | reply->writeInt32(device); |
| 1250 | } |
| 1251 | return NO_ERROR; |
| 1252 | } break; |
| 1253 | |
| 1254 | case RELEASE_SOUNDTRIGGER_SESSION: { |
| 1255 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1256 | sp<IAudioPolicyServiceClient> client = interface_cast<IAudioPolicyServiceClient>( |
| 1257 | data.readStrongBinder()); |
| 1258 | audio_session_t session = (audio_session_t)data.readInt32(); |
| 1259 | status_t status = releaseSoundTriggerSession(session); |
| 1260 | reply->writeInt32(status); |
| 1261 | return NO_ERROR; |
| 1262 | } break; |
| 1263 | |
Eric Laurent | bb6c9a0 | 2014-09-25 14:11:47 -0700 | [diff] [blame] | 1264 | case GET_PHONE_STATE: { |
| 1265 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1266 | reply->writeInt32((int32_t)getPhoneState()); |
| 1267 | return NO_ERROR; |
| 1268 | } break; |
| 1269 | |
Eric Laurent | baac183 | 2014-12-01 17:52:59 -0800 | [diff] [blame] | 1270 | case REGISTER_POLICY_MIXES: { |
| 1271 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1272 | bool registration = data.readInt32() == 1; |
| 1273 | Vector<AudioMix> mixes; |
| 1274 | size_t size = (size_t)data.readInt32(); |
| 1275 | if (size > MAX_MIXES_PER_POLICY) { |
| 1276 | size = MAX_MIXES_PER_POLICY; |
| 1277 | } |
| 1278 | for (size_t i = 0; i < size; i++) { |
| 1279 | AudioMix mix; |
| 1280 | if (mix.readFromParcel((Parcel*)&data) == NO_ERROR) { |
| 1281 | mixes.add(mix); |
| 1282 | } |
| 1283 | } |
| 1284 | status_t status = registerPolicyMixes(mixes, registration); |
| 1285 | reply->writeInt32(status); |
| 1286 | return NO_ERROR; |
| 1287 | } break; |
| 1288 | |
Eric Laurent | 554a277 | 2015-04-10 11:29:24 -0700 | [diff] [blame] | 1289 | case START_AUDIO_SOURCE: { |
| 1290 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1291 | struct audio_port_config source; |
| 1292 | data.read(&source, sizeof(struct audio_port_config)); |
| 1293 | audio_attributes_t attributes; |
| 1294 | data.read(&attributes, sizeof(audio_attributes_t)); |
| 1295 | audio_io_handle_t handle; |
| 1296 | status_t status = startAudioSource(&source, &attributes, &handle); |
| 1297 | reply->writeInt32(status); |
| 1298 | reply->writeInt32(handle); |
| 1299 | return NO_ERROR; |
| 1300 | } break; |
| 1301 | |
| 1302 | case STOP_AUDIO_SOURCE: { |
| 1303 | CHECK_INTERFACE(IAudioPolicyService, data, reply); |
| 1304 | audio_io_handle_t handle = (audio_io_handle_t)data.readInt32(); |
| 1305 | status_t status = stopAudioSource(handle); |
| 1306 | reply->writeInt32(status); |
| 1307 | return NO_ERROR; |
| 1308 | } break; |
| 1309 | |
Eric Laurent | c2f1f07 | 2009-07-17 12:17:14 -0700 | [diff] [blame] | 1310 | default: |
| 1311 | return BBinder::onTransact(code, data, reply, flags); |
| 1312 | } |
| 1313 | } |
| 1314 | |
| 1315 | // ---------------------------------------------------------------------------- |
| 1316 | |
Glenn Kasten | 40bc906 | 2015-03-20 09:09:33 -0700 | [diff] [blame] | 1317 | } // namespace android |