Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Phil Burk | a4eb0d8 | 2017-04-12 15:44:06 -0700 | [diff] [blame] | 17 | #include <aaudio/AAudio.h> |
Phil Burk | 2ac035f | 2017-06-23 14:51:14 -0700 | [diff] [blame^] | 18 | #include <binder/IPCThreadState.h> |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 19 | |
| 20 | #include "binding/AudioEndpointParcelable.h" |
| 21 | #include "binding/AAudioStreamRequest.h" |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 22 | #include "binding/AAudioServiceDefinitions.h" |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 23 | #include "binding/AAudioStreamConfiguration.h" |
| 24 | #include "binding/IAAudioService.h" |
| 25 | #include "utility/AAudioUtilities.h" |
| 26 | |
| 27 | namespace android { |
| 28 | |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 29 | using aaudio::aaudio_handle_t; |
| 30 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 31 | /** |
| 32 | * This is used by the AAudio Client to talk to the AAudio Service. |
| 33 | * |
| 34 | * The order of parameters in the Parcels must match with code in AAudioService.cpp. |
| 35 | */ |
| 36 | class BpAAudioService : public BpInterface<IAAudioService> |
| 37 | { |
| 38 | public: |
| 39 | explicit BpAAudioService(const sp<IBinder>& impl) |
| 40 | : BpInterface<IAAudioService>(impl) |
| 41 | { |
| 42 | } |
| 43 | |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 44 | virtual aaudio_handle_t openStream(const aaudio::AAudioStreamRequest &request, |
| 45 | aaudio::AAudioStreamConfiguration &configurationOutput) override { |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 46 | Parcel data, reply; |
| 47 | // send command |
| 48 | data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor()); |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 49 | // request.dump(); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 50 | request.writeToParcel(&data); |
| 51 | status_t err = remote()->transact(OPEN_STREAM, data, &reply); |
| 52 | if (err != NO_ERROR) { |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 53 | ALOGE("BpAAudioService::client openStream transact failed %d", err); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 54 | return AAudioConvert_androidToAAudioResult(err); |
| 55 | } |
| 56 | // parse reply |
| 57 | aaudio_handle_t stream; |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 58 | err = reply.readInt32(&stream); |
Phil Burk | ec89b2e | 2017-06-20 15:05:06 -0700 | [diff] [blame] | 59 | ALOGD("BpAAudioService::client openStream returned stream = 0x%08x", stream); |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 60 | if (err != NO_ERROR) { |
| 61 | ALOGE("BpAAudioService::client transact(OPEN_STREAM) readInt %d", err); |
| 62 | return AAudioConvert_androidToAAudioResult(err); |
| 63 | } else if (stream < 0) { |
| 64 | ALOGE("BpAAudioService::client OPEN_STREAM passed stream %d", stream); |
| 65 | return stream; |
| 66 | } |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 67 | err = configurationOutput.readFromParcel(&reply); |
| 68 | if (err != NO_ERROR) { |
| 69 | ALOGE("BpAAudioService::client openStream readFromParcel failed %d", err); |
| 70 | closeStream(stream); |
| 71 | return AAudioConvert_androidToAAudioResult(err); |
| 72 | } |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 73 | return stream; |
| 74 | } |
| 75 | |
| 76 | virtual aaudio_result_t closeStream(aaudio_handle_t streamHandle) override { |
| 77 | Parcel data, reply; |
| 78 | // send command |
| 79 | data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor()); |
| 80 | data.writeInt32(streamHandle); |
| 81 | status_t err = remote()->transact(CLOSE_STREAM, data, &reply); |
| 82 | if (err != NO_ERROR) { |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 83 | ALOGE("BpAAudioService::client closeStream transact failed %d", err); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 84 | return AAudioConvert_androidToAAudioResult(err); |
| 85 | } |
| 86 | // parse reply |
| 87 | aaudio_result_t res; |
| 88 | reply.readInt32(&res); |
| 89 | return res; |
| 90 | } |
| 91 | |
| 92 | virtual aaudio_result_t getStreamDescription(aaudio_handle_t streamHandle, |
| 93 | aaudio::AudioEndpointParcelable &parcelable) { |
| 94 | Parcel data, reply; |
| 95 | // send command |
| 96 | data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor()); |
| 97 | data.writeInt32(streamHandle); |
| 98 | status_t err = remote()->transact(GET_STREAM_DESCRIPTION, data, &reply); |
| 99 | if (err != NO_ERROR) { |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 100 | ALOGE("BpAAudioService::client transact(GET_STREAM_DESCRIPTION) returns %d", err); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 101 | return AAudioConvert_androidToAAudioResult(err); |
| 102 | } |
| 103 | // parse reply |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 104 | aaudio_result_t result; |
| 105 | err = reply.readInt32(&result); |
| 106 | if (err != NO_ERROR) { |
| 107 | ALOGE("BpAAudioService::client transact(GET_STREAM_DESCRIPTION) readInt %d", err); |
| 108 | return AAudioConvert_androidToAAudioResult(err); |
| 109 | } else if (result != AAUDIO_OK) { |
| 110 | ALOGE("BpAAudioService::client GET_STREAM_DESCRIPTION passed result %d", result); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 111 | return result; |
| 112 | } |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 113 | err = parcelable.readFromParcel(&reply);; |
| 114 | if (err != NO_ERROR) { |
| 115 | ALOGE("BpAAudioService::client transact(GET_STREAM_DESCRIPTION) read endpoint %d", err); |
| 116 | return AAudioConvert_androidToAAudioResult(err); |
| 117 | } |
| 118 | //parcelable.dump(); |
| 119 | result = parcelable.validate(); |
| 120 | if (result != AAUDIO_OK) { |
| 121 | ALOGE("BpAAudioService::client GET_STREAM_DESCRIPTION validation fails %d", result); |
| 122 | return result; |
| 123 | } |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 124 | return result; |
| 125 | } |
| 126 | |
| 127 | // TODO should we wait for a reply? |
| 128 | virtual aaudio_result_t startStream(aaudio_handle_t streamHandle) override { |
| 129 | Parcel data, reply; |
| 130 | // send command |
| 131 | data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor()); |
| 132 | data.writeInt32(streamHandle); |
| 133 | status_t err = remote()->transact(START_STREAM, data, &reply); |
| 134 | if (err != NO_ERROR) { |
| 135 | return AAudioConvert_androidToAAudioResult(err); |
| 136 | } |
| 137 | // parse reply |
| 138 | aaudio_result_t res; |
| 139 | reply.readInt32(&res); |
| 140 | return res; |
| 141 | } |
| 142 | |
| 143 | virtual aaudio_result_t pauseStream(aaudio_handle_t streamHandle) override { |
| 144 | Parcel data, reply; |
| 145 | // send command |
| 146 | data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor()); |
| 147 | data.writeInt32(streamHandle); |
| 148 | status_t err = remote()->transact(PAUSE_STREAM, data, &reply); |
| 149 | if (err != NO_ERROR) { |
| 150 | return AAudioConvert_androidToAAudioResult(err); |
| 151 | } |
| 152 | // parse reply |
| 153 | aaudio_result_t res; |
| 154 | reply.readInt32(&res); |
| 155 | return res; |
| 156 | } |
| 157 | |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 158 | virtual aaudio_result_t stopStream(aaudio_handle_t streamHandle) override { |
| 159 | Parcel data, reply; |
| 160 | // send command |
| 161 | data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor()); |
| 162 | data.writeInt32(streamHandle); |
| 163 | status_t err = remote()->transact(STOP_STREAM, data, &reply); |
| 164 | if (err != NO_ERROR) { |
| 165 | return AAudioConvert_androidToAAudioResult(err); |
| 166 | } |
| 167 | // parse reply |
| 168 | aaudio_result_t res; |
| 169 | reply.readInt32(&res); |
| 170 | return res; |
| 171 | } |
| 172 | |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 173 | virtual aaudio_result_t flushStream(aaudio_handle_t streamHandle) override { |
| 174 | Parcel data, reply; |
| 175 | // send command |
| 176 | data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor()); |
| 177 | data.writeInt32(streamHandle); |
| 178 | status_t err = remote()->transact(FLUSH_STREAM, data, &reply); |
| 179 | if (err != NO_ERROR) { |
| 180 | return AAudioConvert_androidToAAudioResult(err); |
| 181 | } |
| 182 | // parse reply |
| 183 | aaudio_result_t res; |
| 184 | reply.readInt32(&res); |
| 185 | return res; |
| 186 | } |
| 187 | |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 188 | virtual aaudio_result_t registerAudioThread(aaudio_handle_t streamHandle, |
Phil Burk | 2ac035f | 2017-06-23 14:51:14 -0700 | [diff] [blame^] | 189 | pid_t clientThreadId, |
| 190 | int64_t periodNanoseconds) |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 191 | override { |
| 192 | Parcel data, reply; |
| 193 | // send command |
| 194 | data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor()); |
| 195 | data.writeInt32(streamHandle); |
| 196 | data.writeInt32((int32_t) clientThreadId); |
| 197 | data.writeInt64(periodNanoseconds); |
| 198 | status_t err = remote()->transact(REGISTER_AUDIO_THREAD, data, &reply); |
| 199 | if (err != NO_ERROR) { |
| 200 | return AAudioConvert_androidToAAudioResult(err); |
| 201 | } |
| 202 | // parse reply |
| 203 | aaudio_result_t res; |
| 204 | reply.readInt32(&res); |
| 205 | return res; |
| 206 | } |
| 207 | |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 208 | virtual aaudio_result_t unregisterAudioThread(aaudio_handle_t streamHandle, |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 209 | pid_t clientThreadId) |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 210 | override { |
| 211 | Parcel data, reply; |
| 212 | // send command |
| 213 | data.writeInterfaceToken(IAAudioService::getInterfaceDescriptor()); |
| 214 | data.writeInt32(streamHandle); |
| 215 | data.writeInt32((int32_t) clientThreadId); |
| 216 | status_t err = remote()->transact(UNREGISTER_AUDIO_THREAD, data, &reply); |
| 217 | if (err != NO_ERROR) { |
| 218 | return AAudioConvert_androidToAAudioResult(err); |
| 219 | } |
| 220 | // parse reply |
| 221 | aaudio_result_t res; |
| 222 | reply.readInt32(&res); |
| 223 | return res; |
| 224 | } |
| 225 | |
| 226 | }; |
| 227 | |
| 228 | // Implement an interface to the service. |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 229 | // This is here so that you don't have to link with libaaudio static library. |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 230 | IMPLEMENT_META_INTERFACE(AAudioService, "IAAudioService"); |
| 231 | |
| 232 | // The order of parameters in the Parcels must match with code in BpAAudioService |
| 233 | |
| 234 | status_t BnAAudioService::onTransact(uint32_t code, const Parcel& data, |
| 235 | Parcel* reply, uint32_t flags) { |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 236 | aaudio_handle_t stream; |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 237 | aaudio::AAudioStreamRequest request; |
| 238 | aaudio::AAudioStreamConfiguration configuration; |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 239 | pid_t tid; |
Phil Burk | 3316d5e | 2017-02-15 11:23:01 -0800 | [diff] [blame] | 240 | int64_t nanoseconds; |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 241 | aaudio_result_t result; |
| 242 | ALOGV("BnAAudioService::onTransact(%i) %i", code, flags); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 243 | |
| 244 | switch(code) { |
| 245 | case OPEN_STREAM: { |
Andy Hung | a880518 | 2017-06-27 16:17:40 -0700 | [diff] [blame] | 246 | CHECK_INTERFACE(IAAudioService, data, reply); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 247 | request.readFromParcel(&data); |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 248 | //ALOGD("BnAAudioService::client openStream request dump --------------------"); |
| 249 | //request.dump(); |
Phil Burk | 2ac035f | 2017-06-23 14:51:14 -0700 | [diff] [blame^] | 250 | // Override the uid and pid from the client in case they are incorrect. |
| 251 | request.setUserId(IPCThreadState::self()->getCallingUid()); |
| 252 | request.setProcessId(IPCThreadState::self()->getCallingPid()); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 253 | stream = openStream(request, configuration); |
Phil Burk | 2ac035f | 2017-06-23 14:51:14 -0700 | [diff] [blame^] | 254 | //ALOGD("BnAAudioService::onTransact OPEN_STREAM server handle = 0x%08X ----", stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 255 | reply->writeInt32(stream); |
| 256 | configuration.writeToParcel(reply); |
| 257 | return NO_ERROR; |
| 258 | } break; |
| 259 | |
| 260 | case CLOSE_STREAM: { |
Andy Hung | a880518 | 2017-06-27 16:17:40 -0700 | [diff] [blame] | 261 | CHECK_INTERFACE(IAAudioService, data, reply); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 262 | data.readInt32(&stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 263 | result = closeStream(stream); |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 264 | //ALOGD("BnAAudioService::onTransact CLOSE_STREAM 0x%08X, result = %d", |
| 265 | // stream, result); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 266 | reply->writeInt32(result); |
| 267 | return NO_ERROR; |
| 268 | } break; |
| 269 | |
| 270 | case GET_STREAM_DESCRIPTION: { |
Andy Hung | a880518 | 2017-06-27 16:17:40 -0700 | [diff] [blame] | 271 | CHECK_INTERFACE(IAAudioService, data, reply); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 272 | data.readInt32(&stream); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 273 | aaudio::AudioEndpointParcelable parcelable; |
| 274 | result = getStreamDescription(stream, parcelable); |
| 275 | if (result != AAUDIO_OK) { |
| 276 | return AAudioConvert_aaudioToAndroidStatus(result); |
| 277 | } |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 278 | result = parcelable.validate(); |
| 279 | if (result != AAUDIO_OK) { |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 280 | ALOGE("BnAAudioService::onTransact getStreamDescription() returns %d", result); |
| 281 | parcelable.dump(); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 282 | return AAudioConvert_aaudioToAndroidStatus(result); |
| 283 | } |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 284 | reply->writeInt32(result); |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 285 | parcelable.writeToParcel(reply); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 286 | return NO_ERROR; |
| 287 | } break; |
| 288 | |
| 289 | case START_STREAM: { |
Andy Hung | a880518 | 2017-06-27 16:17:40 -0700 | [diff] [blame] | 290 | CHECK_INTERFACE(IAAudioService, data, reply); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 291 | data.readInt32(&stream); |
| 292 | result = startStream(stream); |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 293 | ALOGV("BnAAudioService::onTransact START_STREAM 0x%08X, result = %d", |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 294 | stream, result); |
| 295 | reply->writeInt32(result); |
| 296 | return NO_ERROR; |
| 297 | } break; |
| 298 | |
| 299 | case PAUSE_STREAM: { |
Andy Hung | a880518 | 2017-06-27 16:17:40 -0700 | [diff] [blame] | 300 | CHECK_INTERFACE(IAAudioService, data, reply); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 301 | data.readInt32(&stream); |
| 302 | result = pauseStream(stream); |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 303 | ALOGV("BnAAudioService::onTransact PAUSE_STREAM 0x%08X, result = %d", |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 304 | stream, result); |
| 305 | reply->writeInt32(result); |
| 306 | return NO_ERROR; |
| 307 | } break; |
| 308 | |
| 309 | case STOP_STREAM: { |
Andy Hung | a880518 | 2017-06-27 16:17:40 -0700 | [diff] [blame] | 310 | CHECK_INTERFACE(IAAudioService, data, reply); |
Phil Burk | 71f35bb | 2017-04-13 16:05:07 -0700 | [diff] [blame] | 311 | data.readInt32(&stream); |
| 312 | result = stopStream(stream); |
| 313 | ALOGV("BnAAudioService::onTransact STOP_STREAM 0x%08X, result = %d", |
| 314 | stream, result); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 315 | reply->writeInt32(result); |
| 316 | return NO_ERROR; |
| 317 | } break; |
| 318 | |
| 319 | case FLUSH_STREAM: { |
Andy Hung | a880518 | 2017-06-27 16:17:40 -0700 | [diff] [blame] | 320 | CHECK_INTERFACE(IAAudioService, data, reply); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 321 | data.readInt32(&stream); |
| 322 | result = flushStream(stream); |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 323 | ALOGV("BnAAudioService::onTransact FLUSH_STREAM 0x%08X, result = %d", |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 324 | stream, result); |
| 325 | reply->writeInt32(result); |
| 326 | return NO_ERROR; |
| 327 | } break; |
| 328 | |
| 329 | case REGISTER_AUDIO_THREAD: { |
Andy Hung | a880518 | 2017-06-27 16:17:40 -0700 | [diff] [blame] | 330 | CHECK_INTERFACE(IAAudioService, data, reply); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 331 | data.readInt32(&stream); |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 332 | data.readInt32(&tid); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 333 | data.readInt64(&nanoseconds); |
Phil Burk | 2ac035f | 2017-06-23 14:51:14 -0700 | [diff] [blame^] | 334 | result = registerAudioThread(stream, tid, nanoseconds); |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 335 | ALOGV("BnAAudioService::onTransact REGISTER_AUDIO_THREAD 0x%08X, result = %d", |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 336 | stream, result); |
| 337 | reply->writeInt32(result); |
| 338 | return NO_ERROR; |
| 339 | } break; |
| 340 | |
| 341 | case UNREGISTER_AUDIO_THREAD: { |
Andy Hung | a880518 | 2017-06-27 16:17:40 -0700 | [diff] [blame] | 342 | CHECK_INTERFACE(IAAudioService, data, reply); |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 343 | data.readInt32(&stream); |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 344 | data.readInt32(&tid); |
Phil Burk | 2ac035f | 2017-06-23 14:51:14 -0700 | [diff] [blame^] | 345 | result = unregisterAudioThread(stream, tid); |
Phil Burk | c0c70e3 | 2017-02-09 13:18:38 -0800 | [diff] [blame] | 346 | ALOGV("BnAAudioService::onTransact UNREGISTER_AUDIO_THREAD 0x%08X, result = %d", |
Phil Burk | 5ed503c | 2017-02-01 09:38:15 -0800 | [diff] [blame] | 347 | stream, result); |
| 348 | reply->writeInt32(result); |
| 349 | return NO_ERROR; |
| 350 | } break; |
| 351 | |
| 352 | default: |
| 353 | // ALOGW("BnAAudioService::onTransact not handled %u", code); |
| 354 | return BBinder::onTransact(code, data, reply, flags); |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | } /* namespace android */ |