blob: 255e350988eb7841806e9c366a0a774156068388 [file] [log] [blame]
Marco Nelissen3a34bef2011-08-02 13:33:41 -07001/*
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08002**
3** Copyright 2007, 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 "IAudioFlinger"
Eric Laurentc2f1f072009-07-17 12:17:14 -070019//#define LOG_NDEBUG 0
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080020#include <utils/Log.h>
21
22#include <stdint.h>
23#include <sys/types.h>
24
Mathias Agopian75624082009-05-19 19:08:10 -070025#include <binder/Parcel.h>
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080026
27#include <media/IAudioFlinger.h>
28
29namespace android {
30
31enum {
32 CREATE_TRACK = IBinder::FIRST_CALL_TRANSACTION,
33 OPEN_RECORD,
34 SAMPLE_RATE,
Glenn Kasten5876f2f2012-11-30 10:52:16 -080035 RESERVED, // obsolete, was CHANNEL_COUNT
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080036 FORMAT,
37 FRAME_COUNT,
38 LATENCY,
39 SET_MASTER_VOLUME,
40 SET_MASTER_MUTE,
41 MASTER_VOLUME,
42 MASTER_MUTE,
43 SET_STREAM_VOLUME,
44 SET_STREAM_MUTE,
45 STREAM_VOLUME,
46 STREAM_MUTE,
47 SET_MODE,
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080048 SET_MIC_MUTE,
49 GET_MIC_MUTE,
Eric Laurentc2f1f072009-07-17 12:17:14 -070050 SET_PARAMETERS,
51 GET_PARAMETERS,
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080052 REGISTER_CLIENT,
53 GET_INPUTBUFFERSIZE,
Eric Laurentc2f1f072009-07-17 12:17:14 -070054 OPEN_OUTPUT,
55 OPEN_DUPLICATE_OUTPUT,
56 CLOSE_OUTPUT,
57 SUSPEND_OUTPUT,
58 RESTORE_OUTPUT,
59 OPEN_INPUT,
60 CLOSE_INPUT,
Glenn Kastend2304db2014-02-03 07:40:31 -080061 INVALIDATE_STREAM,
Eric Laurent342e9cf2010-01-19 17:37:09 -080062 SET_VOICE_VOLUME,
Eric Laurent05bca2f2010-02-26 02:47:27 -080063 GET_RENDER_POSITION,
Eric Laurentbe916aa2010-06-01 23:49:17 -070064 GET_INPUT_FRAMES_LOST,
65 NEW_AUDIO_SESSION_ID,
Marco Nelissen3a34bef2011-08-02 13:33:41 -070066 ACQUIRE_AUDIO_SESSION_ID,
67 RELEASE_AUDIO_SESSION_ID,
Eric Laurentbe916aa2010-06-01 23:49:17 -070068 QUERY_NUM_EFFECTS,
Eric Laurentffe9c252010-06-23 17:38:20 -070069 QUERY_EFFECT,
Eric Laurentbe916aa2010-06-01 23:49:17 -070070 GET_EFFECT_DESCRIPTOR,
Eric Laurentde070132010-07-13 04:45:46 -070071 CREATE_EFFECT,
Eric Laurenta4c5a552012-03-29 10:12:40 -070072 MOVE_EFFECTS,
Glenn Kastencc0f1cf2012-09-24 11:27:18 -070073 LOAD_HW_MODULE,
74 GET_PRIMARY_OUTPUT_SAMPLING_RATE,
75 GET_PRIMARY_OUTPUT_FRAME_COUNT,
Glenn Kasten4182c4e2013-07-15 14:45:07 -070076 SET_LOW_RAM_DEVICE,
Eric Laurent4b123402014-04-11 09:22:20 -070077 LIST_AUDIO_PORTS,
78 GET_AUDIO_PORT,
79 CREATE_AUDIO_PATCH,
80 RELEASE_AUDIO_PATCH,
81 LIST_AUDIO_PATCHES,
Eric Laurent93c3d412014-08-01 14:48:35 -070082 SET_AUDIO_PORT_CONFIG,
Eric Laurent72e3f392015-05-20 14:43:50 -070083 GET_AUDIO_HW_SYNC,
Glenn Kasten4a8308b2016-04-18 14:10:01 -070084 SYSTEM_READY,
85 FRAME_COUNT_HAL,
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080086};
87
Eric Laurentf75c2fe2015-04-02 13:49:15 -070088#define MAX_ITEMS_PER_LIST 1024
89
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080090class BpAudioFlinger : public BpInterface<IAudioFlinger>
91{
92public:
Chih-Hung Hsieh090ef602016-04-27 10:39:54 -070093 explicit BpAudioFlinger(const sp<IBinder>& impl)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -080094 : BpInterface<IAudioFlinger>(impl)
95 {
96 }
97
98 virtual sp<IAudioTrack> createTrack(
Glenn Kastenfff6d712012-01-12 16:38:12 -080099 audio_stream_type_t streamType,
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800100 uint32_t sampleRate,
Glenn Kasten58f30212012-01-12 12:27:51 -0800101 audio_format_t format,
Glenn Kastendd8104c2012-07-02 12:42:44 -0700102 audio_channel_mask_t channelMask,
Glenn Kasten74935e42013-12-19 08:56:45 -0800103 size_t *pFrameCount,
Eric Laurent05067782016-06-01 18:27:28 -0700104 audio_output_flags_t *flags,
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800105 const sp<IMemory>& sharedBuffer,
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800106 audio_io_handle_t output,
Haynes Mathew George9ea77cd2016-04-06 17:07:48 -0700107 pid_t pid,
Glenn Kasten3acbd052012-02-28 10:39:56 -0800108 pid_t tid,
Glenn Kastend848eb42016-03-08 13:42:11 -0800109 audio_session_t *sessionId,
Marco Nelissen462fd2f2013-01-14 14:12:05 -0800110 int clientUid,
Eric Laurent20b9ef02016-12-05 11:03:16 -0800111 status_t *status,
112 audio_port_handle_t portId)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800113 {
114 Parcel data, reply;
Eric Laurent5841db72009-09-09 05:16:08 -0700115 sp<IAudioTrack> track;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800116 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kastenfff6d712012-01-12 16:38:12 -0800117 data.writeInt32((int32_t) streamType);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800118 data.writeInt32(sampleRate);
119 data.writeInt32(format);
Jean-Michel Trivi0d255b22011-05-24 15:53:33 -0700120 data.writeInt32(channelMask);
Glenn Kasten74935e42013-12-19 08:56:45 -0800121 size_t frameCount = pFrameCount != NULL ? *pFrameCount : 0;
Glenn Kastene03dd222014-01-28 11:04:39 -0800122 data.writeInt64(frameCount);
Eric Laurent05067782016-06-01 18:27:28 -0700123 audio_output_flags_t lFlags = flags != NULL ? *flags : AUDIO_OUTPUT_FLAG_NONE;
Glenn Kastene0b07172012-11-06 15:03:34 -0800124 data.writeInt32(lFlags);
Glenn Kasten2301acc2014-01-17 10:21:00 -0800125 // haveSharedBuffer
Eric Laurent3d00aa62013-09-24 09:53:27 -0700126 if (sharedBuffer != 0) {
127 data.writeInt32(true);
Marco Nelissen06b46062014-11-14 07:58:25 -0800128 data.writeStrongBinder(IInterface::asBinder(sharedBuffer));
Eric Laurent3d00aa62013-09-24 09:53:27 -0700129 } else {
130 data.writeInt32(false);
131 }
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800132 data.writeInt32((int32_t) output);
Haynes Mathew George9ea77cd2016-04-06 17:07:48 -0700133 data.writeInt32((int32_t) pid);
Glenn Kasten3acbd052012-02-28 10:39:56 -0800134 data.writeInt32((int32_t) tid);
Glenn Kastend848eb42016-03-08 13:42:11 -0800135 audio_session_t lSessionId = AUDIO_SESSION_ALLOCATE;
Eric Laurentbe916aa2010-06-01 23:49:17 -0700136 if (sessionId != NULL) {
137 lSessionId = *sessionId;
138 }
139 data.writeInt32(lSessionId);
Marco Nelissen462fd2f2013-01-14 14:12:05 -0800140 data.writeInt32(clientUid);
Eric Laurent20b9ef02016-12-05 11:03:16 -0800141 data.writeInt32(portId);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800142 status_t lStatus = remote()->transact(CREATE_TRACK, data, &reply);
143 if (lStatus != NO_ERROR) {
Steve Block29357bc2012-01-06 19:20:56 +0000144 ALOGE("createTrack error: %s", strerror(-lStatus));
Eric Laurent5841db72009-09-09 05:16:08 -0700145 } else {
Glenn Kastenb53fc4e2014-05-02 08:03:58 -0700146 frameCount = reply.readInt64();
Glenn Kasten74935e42013-12-19 08:56:45 -0800147 if (pFrameCount != NULL) {
148 *pFrameCount = frameCount;
149 }
Eric Laurent05067782016-06-01 18:27:28 -0700150 lFlags = (audio_output_flags_t)reply.readInt32();
Glenn Kastene0b07172012-11-06 15:03:34 -0800151 if (flags != NULL) {
152 *flags = lFlags;
153 }
Glenn Kastend848eb42016-03-08 13:42:11 -0800154 lSessionId = (audio_session_t) reply.readInt32();
Eric Laurentbe916aa2010-06-01 23:49:17 -0700155 if (sessionId != NULL) {
156 *sessionId = lSessionId;
157 }
Eric Laurent5841db72009-09-09 05:16:08 -0700158 lStatus = reply.readInt32();
159 track = interface_cast<IAudioTrack>(reply.readStrongBinder());
Glenn Kasten0cde0762014-01-16 15:06:36 -0800160 if (lStatus == NO_ERROR) {
161 if (track == 0) {
162 ALOGE("createTrack should have returned an IAudioTrack");
163 lStatus = UNKNOWN_ERROR;
164 }
165 } else {
166 if (track != 0) {
167 ALOGE("createTrack returned an IAudioTrack but with status %d", lStatus);
168 track.clear();
169 }
170 }
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800171 }
Glenn Kasten507b2862013-07-31 16:12:13 -0700172 if (status != NULL) {
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800173 *status = lStatus;
174 }
Eric Laurent5841db72009-09-09 05:16:08 -0700175 return track;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800176 }
177
178 virtual sp<IAudioRecord> openRecord(
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800179 audio_io_handle_t input,
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800180 uint32_t sampleRate,
Glenn Kasten58f30212012-01-12 12:27:51 -0800181 audio_format_t format,
Glenn Kasten28b76b32012-07-03 17:24:41 -0700182 audio_channel_mask_t channelMask,
Svet Ganovbe71aa22015-04-28 12:06:02 -0700183 const String16& opPackageName,
Glenn Kasten74935e42013-12-19 08:56:45 -0800184 size_t *pFrameCount,
Eric Laurent05067782016-06-01 18:27:28 -0700185 audio_input_flags_t *flags,
Haynes Mathew George9ea77cd2016-04-06 17:07:48 -0700186 pid_t pid,
Glenn Kasten1879fff2012-07-11 15:36:59 -0700187 pid_t tid,
Jean-Michel Trivi4cb66832015-05-01 18:34:17 -0700188 int clientUid,
Glenn Kastend848eb42016-03-08 13:42:11 -0800189 audio_session_t *sessionId,
Glenn Kasten7df8c0b2014-07-03 12:23:29 -0700190 size_t *notificationFrames,
Glenn Kastend776ac62014-05-07 09:16:09 -0700191 sp<IMemory>& cblk,
192 sp<IMemory>& buffers,
Eric Laurent20b9ef02016-12-05 11:03:16 -0800193 status_t *status,
194 audio_port_handle_t portId)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800195 {
196 Parcel data, reply;
Eric Laurent5841db72009-09-09 05:16:08 -0700197 sp<IAudioRecord> record;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800198 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800199 data.writeInt32((int32_t) input);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800200 data.writeInt32(sampleRate);
201 data.writeInt32(format);
Jean-Michel Trivi0d255b22011-05-24 15:53:33 -0700202 data.writeInt32(channelMask);
Dianne Hackborneaa34702015-04-29 12:57:58 -0700203 data.writeString16(opPackageName);
Glenn Kasten74935e42013-12-19 08:56:45 -0800204 size_t frameCount = pFrameCount != NULL ? *pFrameCount : 0;
Glenn Kastene03dd222014-01-28 11:04:39 -0800205 data.writeInt64(frameCount);
Eric Laurent05067782016-06-01 18:27:28 -0700206 audio_input_flags_t lFlags = flags != NULL ? *flags : AUDIO_INPUT_FLAG_NONE;
Glenn Kasteneeca3262013-07-31 16:12:48 -0700207 data.writeInt32(lFlags);
Haynes Mathew George9ea77cd2016-04-06 17:07:48 -0700208 data.writeInt32((int32_t) pid);
Glenn Kasten1879fff2012-07-11 15:36:59 -0700209 data.writeInt32((int32_t) tid);
Jean-Michel Trivi4cb66832015-05-01 18:34:17 -0700210 data.writeInt32((int32_t) clientUid);
Glenn Kastend848eb42016-03-08 13:42:11 -0800211 audio_session_t lSessionId = AUDIO_SESSION_ALLOCATE;
Eric Laurentbe916aa2010-06-01 23:49:17 -0700212 if (sessionId != NULL) {
213 lSessionId = *sessionId;
214 }
215 data.writeInt32(lSessionId);
Glenn Kasten74105912014-07-03 12:28:53 -0700216 data.writeInt64(notificationFrames != NULL ? *notificationFrames : 0);
Eric Laurent20b9ef02016-12-05 11:03:16 -0800217 data.writeInt32(portId);
Glenn Kastend776ac62014-05-07 09:16:09 -0700218 cblk.clear();
219 buffers.clear();
Eric Laurent5841db72009-09-09 05:16:08 -0700220 status_t lStatus = remote()->transact(OPEN_RECORD, data, &reply);
221 if (lStatus != NO_ERROR) {
Steve Block29357bc2012-01-06 19:20:56 +0000222 ALOGE("openRecord error: %s", strerror(-lStatus));
Eric Laurent5841db72009-09-09 05:16:08 -0700223 } else {
Glenn Kastenb53fc4e2014-05-02 08:03:58 -0700224 frameCount = reply.readInt64();
Glenn Kasten74935e42013-12-19 08:56:45 -0800225 if (pFrameCount != NULL) {
226 *pFrameCount = frameCount;
227 }
Eric Laurent05067782016-06-01 18:27:28 -0700228 lFlags = (audio_input_flags_t)reply.readInt32();
Glenn Kasteneeca3262013-07-31 16:12:48 -0700229 if (flags != NULL) {
230 *flags = lFlags;
231 }
Glenn Kastend848eb42016-03-08 13:42:11 -0800232 lSessionId = (audio_session_t) reply.readInt32();
Eric Laurentbe916aa2010-06-01 23:49:17 -0700233 if (sessionId != NULL) {
234 *sessionId = lSessionId;
235 }
Glenn Kasten7df8c0b2014-07-03 12:23:29 -0700236 size_t lNotificationFrames = (size_t) reply.readInt64();
237 if (notificationFrames != NULL) {
238 *notificationFrames = lNotificationFrames;
239 }
Eric Laurent5841db72009-09-09 05:16:08 -0700240 lStatus = reply.readInt32();
241 record = interface_cast<IAudioRecord>(reply.readStrongBinder());
Glenn Kastend776ac62014-05-07 09:16:09 -0700242 cblk = interface_cast<IMemory>(reply.readStrongBinder());
243 if (cblk != 0 && cblk->pointer() == NULL) {
244 cblk.clear();
245 }
246 buffers = interface_cast<IMemory>(reply.readStrongBinder());
247 if (buffers != 0 && buffers->pointer() == NULL) {
248 buffers.clear();
249 }
Glenn Kastene93cf2c2013-09-24 11:52:37 -0700250 if (lStatus == NO_ERROR) {
251 if (record == 0) {
252 ALOGE("openRecord should have returned an IAudioRecord");
253 lStatus = UNKNOWN_ERROR;
Glenn Kastend776ac62014-05-07 09:16:09 -0700254 } else if (cblk == 0) {
255 ALOGE("openRecord should have returned a cblk");
256 lStatus = NO_MEMORY;
Glenn Kastene93cf2c2013-09-24 11:52:37 -0700257 }
Glenn Kastend776ac62014-05-07 09:16:09 -0700258 // buffers is permitted to be 0
Glenn Kastene93cf2c2013-09-24 11:52:37 -0700259 } else {
Glenn Kastend776ac62014-05-07 09:16:09 -0700260 if (record != 0 || cblk != 0 || buffers != 0) {
261 ALOGE("openRecord returned an IAudioRecord, cblk, "
262 "or buffers but with status %d", lStatus);
Glenn Kastene93cf2c2013-09-24 11:52:37 -0700263 }
264 }
Glenn Kastend776ac62014-05-07 09:16:09 -0700265 if (lStatus != NO_ERROR) {
266 record.clear();
267 cblk.clear();
268 buffers.clear();
269 }
Eric Laurent5841db72009-09-09 05:16:08 -0700270 }
Glenn Kasten507b2862013-07-31 16:12:13 -0700271 if (status != NULL) {
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800272 *status = lStatus;
273 }
Eric Laurent5841db72009-09-09 05:16:08 -0700274 return record;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800275 }
276
Glenn Kasten2c073da2016-02-26 09:14:08 -0800277 virtual uint32_t sampleRate(audio_io_handle_t ioHandle) const
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800278 {
279 Parcel data, reply;
280 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kasten2c073da2016-02-26 09:14:08 -0800281 data.writeInt32((int32_t) ioHandle);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800282 remote()->transact(SAMPLE_RATE, data, &reply);
283 return reply.readInt32();
284 }
285
Glenn Kasten4a8308b2016-04-18 14:10:01 -0700286 // RESERVED for channelCount()
287
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800288 virtual audio_format_t format(audio_io_handle_t output) const
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800289 {
290 Parcel data, reply;
291 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800292 data.writeInt32((int32_t) output);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800293 remote()->transact(FORMAT, data, &reply);
Glenn Kasten58f30212012-01-12 12:27:51 -0800294 return (audio_format_t) reply.readInt32();
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800295 }
296
Glenn Kasten2c073da2016-02-26 09:14:08 -0800297 virtual size_t frameCount(audio_io_handle_t ioHandle) const
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800298 {
299 Parcel data, reply;
300 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kasten2c073da2016-02-26 09:14:08 -0800301 data.writeInt32((int32_t) ioHandle);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800302 remote()->transact(FRAME_COUNT, data, &reply);
Glenn Kastene03dd222014-01-28 11:04:39 -0800303 return reply.readInt64();
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800304 }
305
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800306 virtual uint32_t latency(audio_io_handle_t output) const
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800307 {
308 Parcel data, reply;
309 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800310 data.writeInt32((int32_t) output);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800311 remote()->transact(LATENCY, data, &reply);
312 return reply.readInt32();
313 }
314
315 virtual status_t setMasterVolume(float value)
316 {
317 Parcel data, reply;
318 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
319 data.writeFloat(value);
320 remote()->transact(SET_MASTER_VOLUME, data, &reply);
321 return reply.readInt32();
322 }
323
324 virtual status_t setMasterMute(bool muted)
325 {
326 Parcel data, reply;
327 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
328 data.writeInt32(muted);
329 remote()->transact(SET_MASTER_MUTE, data, &reply);
330 return reply.readInt32();
331 }
332
333 virtual float masterVolume() const
334 {
335 Parcel data, reply;
336 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
337 remote()->transact(MASTER_VOLUME, data, &reply);
338 return reply.readFloat();
339 }
340
341 virtual bool masterMute() const
342 {
343 Parcel data, reply;
344 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
345 remote()->transact(MASTER_MUTE, data, &reply);
346 return reply.readInt32();
347 }
348
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800349 virtual status_t setStreamVolume(audio_stream_type_t stream, float value,
350 audio_io_handle_t output)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800351 {
352 Parcel data, reply;
353 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kastenfff6d712012-01-12 16:38:12 -0800354 data.writeInt32((int32_t) stream);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800355 data.writeFloat(value);
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800356 data.writeInt32((int32_t) output);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800357 remote()->transact(SET_STREAM_VOLUME, data, &reply);
358 return reply.readInt32();
359 }
360
Glenn Kastenfff6d712012-01-12 16:38:12 -0800361 virtual status_t setStreamMute(audio_stream_type_t stream, bool muted)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800362 {
363 Parcel data, reply;
364 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kastenfff6d712012-01-12 16:38:12 -0800365 data.writeInt32((int32_t) stream);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800366 data.writeInt32(muted);
367 remote()->transact(SET_STREAM_MUTE, data, &reply);
368 return reply.readInt32();
369 }
370
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800371 virtual float streamVolume(audio_stream_type_t stream, audio_io_handle_t output) const
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800372 {
373 Parcel data, reply;
374 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kastenfff6d712012-01-12 16:38:12 -0800375 data.writeInt32((int32_t) stream);
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800376 data.writeInt32((int32_t) output);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800377 remote()->transact(STREAM_VOLUME, data, &reply);
378 return reply.readFloat();
379 }
380
Glenn Kastenfff6d712012-01-12 16:38:12 -0800381 virtual bool streamMute(audio_stream_type_t stream) const
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800382 {
383 Parcel data, reply;
384 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kastenfff6d712012-01-12 16:38:12 -0800385 data.writeInt32((int32_t) stream);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800386 remote()->transact(STREAM_MUTE, data, &reply);
387 return reply.readInt32();
388 }
389
Glenn Kastenf78aee72012-01-04 11:00:47 -0800390 virtual status_t setMode(audio_mode_t mode)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800391 {
392 Parcel data, reply;
393 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
394 data.writeInt32(mode);
395 remote()->transact(SET_MODE, data, &reply);
396 return reply.readInt32();
397 }
398
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800399 virtual status_t setMicMute(bool state)
400 {
401 Parcel data, reply;
402 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
403 data.writeInt32(state);
404 remote()->transact(SET_MIC_MUTE, data, &reply);
405 return reply.readInt32();
406 }
407
408 virtual bool getMicMute() const
409 {
410 Parcel data, reply;
411 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
412 remote()->transact(GET_MIC_MUTE, data, &reply);
413 return reply.readInt32();
414 }
415
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800416 virtual status_t setParameters(audio_io_handle_t ioHandle, const String8& keyValuePairs)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800417 {
418 Parcel data, reply;
419 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800420 data.writeInt32((int32_t) ioHandle);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700421 data.writeString8(keyValuePairs);
422 remote()->transact(SET_PARAMETERS, data, &reply);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800423 return reply.readInt32();
424 }
Eric Laurentc2f1f072009-07-17 12:17:14 -0700425
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800426 virtual String8 getParameters(audio_io_handle_t ioHandle, const String8& keys) const
Eric Laurentc2f1f072009-07-17 12:17:14 -0700427 {
428 Parcel data, reply;
429 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800430 data.writeInt32((int32_t) ioHandle);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700431 data.writeString8(keys);
432 remote()->transact(GET_PARAMETERS, data, &reply);
433 return reply.readString8();
434 }
435
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800436 virtual void registerClient(const sp<IAudioFlingerClient>& client)
437 {
438 Parcel data, reply;
439 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Marco Nelissen06b46062014-11-14 07:58:25 -0800440 data.writeStrongBinder(IInterface::asBinder(client));
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800441 remote()->transact(REGISTER_CLIENT, data, &reply);
442 }
Eric Laurentc2f1f072009-07-17 12:17:14 -0700443
Glenn Kastendd8104c2012-07-02 12:42:44 -0700444 virtual size_t getInputBufferSize(uint32_t sampleRate, audio_format_t format,
445 audio_channel_mask_t channelMask) const
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800446 {
447 Parcel data, reply;
448 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
449 data.writeInt32(sampleRate);
450 data.writeInt32(format);
Glenn Kastendd8104c2012-07-02 12:42:44 -0700451 data.writeInt32(channelMask);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800452 remote()->transact(GET_INPUTBUFFERSIZE, data, &reply);
Glenn Kastene03dd222014-01-28 11:04:39 -0800453 return reply.readInt64();
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800454 }
Eric Laurentc2f1f072009-07-17 12:17:14 -0700455
Eric Laurentcf2c0212014-07-25 16:20:43 -0700456 virtual status_t openOutput(audio_module_handle_t module,
457 audio_io_handle_t *output,
458 audio_config_t *config,
459 audio_devices_t *devices,
460 const String8& address,
461 uint32_t *latencyMs,
462 audio_output_flags_t flags)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800463 {
Eric Laurentcf2c0212014-07-25 16:20:43 -0700464 if (output == NULL || config == NULL || devices == NULL || latencyMs == NULL) {
465 return BAD_VALUE;
466 }
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800467 Parcel data, reply;
468 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Eric Laurenta4c5a552012-03-29 10:12:40 -0700469 data.writeInt32(module);
Eric Laurentcf2c0212014-07-25 16:20:43 -0700470 data.write(config, sizeof(audio_config_t));
471 data.writeInt32(*devices);
472 data.writeString8(address);
Glenn Kasten18868c52012-03-07 09:15:37 -0800473 data.writeInt32((int32_t) flags);
Eric Laurentcf2c0212014-07-25 16:20:43 -0700474 status_t status = remote()->transact(OPEN_OUTPUT, data, &reply);
475 if (status != NO_ERROR) {
476 *output = AUDIO_IO_HANDLE_NONE;
477 return status;
Richard Fitzgeraldb1a270d2013-05-14 12:12:21 +0100478 }
Eric Laurentcf2c0212014-07-25 16:20:43 -0700479 status = (status_t)reply.readInt32();
480 if (status != NO_ERROR) {
481 *output = AUDIO_IO_HANDLE_NONE;
482 return status;
Glenn Kasten507b2862013-07-31 16:12:13 -0700483 }
Eric Laurentcf2c0212014-07-25 16:20:43 -0700484 *output = (audio_io_handle_t)reply.readInt32();
485 ALOGV("openOutput() returned output, %d", *output);
486 reply.read(config, sizeof(audio_config_t));
487 *devices = (audio_devices_t)reply.readInt32();
488 *latencyMs = reply.readInt32();
489 return NO_ERROR;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800490 }
491
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800492 virtual audio_io_handle_t openDuplicateOutput(audio_io_handle_t output1,
493 audio_io_handle_t output2)
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800494 {
495 Parcel data, reply;
496 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800497 data.writeInt32((int32_t) output1);
498 data.writeInt32((int32_t) output2);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700499 remote()->transact(OPEN_DUPLICATE_OUTPUT, data, &reply);
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800500 return (audio_io_handle_t) reply.readInt32();
Eric Laurentc2f1f072009-07-17 12:17:14 -0700501 }
502
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800503 virtual status_t closeOutput(audio_io_handle_t output)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700504 {
505 Parcel data, reply;
506 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800507 data.writeInt32((int32_t) output);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700508 remote()->transact(CLOSE_OUTPUT, data, &reply);
509 return reply.readInt32();
510 }
511
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800512 virtual status_t suspendOutput(audio_io_handle_t output)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700513 {
514 Parcel data, reply;
515 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800516 data.writeInt32((int32_t) output);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700517 remote()->transact(SUSPEND_OUTPUT, data, &reply);
518 return reply.readInt32();
519 }
520
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800521 virtual status_t restoreOutput(audio_io_handle_t output)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700522 {
523 Parcel data, reply;
524 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800525 data.writeInt32((int32_t) output);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700526 remote()->transact(RESTORE_OUTPUT, data, &reply);
527 return reply.readInt32();
528 }
529
Eric Laurentcf2c0212014-07-25 16:20:43 -0700530 virtual status_t openInput(audio_module_handle_t module,
531 audio_io_handle_t *input,
532 audio_config_t *config,
533 audio_devices_t *device,
534 const String8& address,
535 audio_source_t source,
536 audio_input_flags_t flags)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700537 {
Eric Laurentcf2c0212014-07-25 16:20:43 -0700538 if (input == NULL || config == NULL || device == NULL) {
539 return BAD_VALUE;
540 }
Eric Laurentc2f1f072009-07-17 12:17:14 -0700541 Parcel data, reply;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700542 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Eric Laurenta4c5a552012-03-29 10:12:40 -0700543 data.writeInt32(module);
Eric Laurentcf2c0212014-07-25 16:20:43 -0700544 data.writeInt32(*input);
545 data.write(config, sizeof(audio_config_t));
546 data.writeInt32(*device);
547 data.writeString8(address);
548 data.writeInt32(source);
Glenn Kastenec40d282014-07-15 15:31:26 -0700549 data.writeInt32(flags);
Eric Laurentcf2c0212014-07-25 16:20:43 -0700550 status_t status = remote()->transact(OPEN_INPUT, data, &reply);
551 if (status != NO_ERROR) {
552 *input = AUDIO_IO_HANDLE_NONE;
553 return status;
Glenn Kasten507b2862013-07-31 16:12:13 -0700554 }
Eric Laurentcf2c0212014-07-25 16:20:43 -0700555 status = (status_t)reply.readInt32();
556 if (status != NO_ERROR) {
557 *input = AUDIO_IO_HANDLE_NONE;
558 return status;
Glenn Kasten507b2862013-07-31 16:12:13 -0700559 }
Eric Laurentcf2c0212014-07-25 16:20:43 -0700560 *input = (audio_io_handle_t)reply.readInt32();
561 reply.read(config, sizeof(audio_config_t));
562 *device = (audio_devices_t)reply.readInt32();
563 return NO_ERROR;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700564 }
565
Eric Laurentfa2877b2009-07-28 08:44:33 -0700566 virtual status_t closeInput(int input)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700567 {
568 Parcel data, reply;
569 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Eric Laurentfa2877b2009-07-28 08:44:33 -0700570 data.writeInt32(input);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700571 remote()->transact(CLOSE_INPUT, data, &reply);
572 return reply.readInt32();
573 }
574
Glenn Kastend2304db2014-02-03 07:40:31 -0800575 virtual status_t invalidateStream(audio_stream_type_t stream)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700576 {
577 Parcel data, reply;
578 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kastenfff6d712012-01-12 16:38:12 -0800579 data.writeInt32((int32_t) stream);
Glenn Kastend2304db2014-02-03 07:40:31 -0800580 remote()->transact(INVALIDATE_STREAM, data, &reply);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700581 return reply.readInt32();
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800582 }
Eric Laurentf0ee6f42009-10-21 08:14:22 -0700583
584 virtual status_t setVoiceVolume(float volume)
585 {
586 Parcel data, reply;
587 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
588 data.writeFloat(volume);
589 remote()->transact(SET_VOICE_VOLUME, data, &reply);
590 return reply.readInt32();
591 }
Eric Laurent342e9cf2010-01-19 17:37:09 -0800592
Kévin PETIT377b2ec2014-02-03 12:35:36 +0000593 virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames,
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800594 audio_io_handle_t output) const
Eric Laurent342e9cf2010-01-19 17:37:09 -0800595 {
596 Parcel data, reply;
597 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800598 data.writeInt32((int32_t) output);
Eric Laurent342e9cf2010-01-19 17:37:09 -0800599 remote()->transact(GET_RENDER_POSITION, data, &reply);
600 status_t status = reply.readInt32();
601 if (status == NO_ERROR) {
602 uint32_t tmp = reply.readInt32();
Glenn Kasten507b2862013-07-31 16:12:13 -0700603 if (halFrames != NULL) {
Eric Laurent342e9cf2010-01-19 17:37:09 -0800604 *halFrames = tmp;
605 }
606 tmp = reply.readInt32();
Glenn Kasten507b2862013-07-31 16:12:13 -0700607 if (dspFrames != NULL) {
Eric Laurent342e9cf2010-01-19 17:37:09 -0800608 *dspFrames = tmp;
609 }
610 }
611 return status;
612 }
Eric Laurent05bca2f2010-02-26 02:47:27 -0800613
Glenn Kasten5f972c02014-01-13 09:59:31 -0800614 virtual uint32_t getInputFramesLost(audio_io_handle_t ioHandle) const
Eric Laurent05bca2f2010-02-26 02:47:27 -0800615 {
616 Parcel data, reply;
617 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800618 data.writeInt32((int32_t) ioHandle);
Glenn Kasten5f972c02014-01-13 09:59:31 -0800619 status_t status = remote()->transact(GET_INPUT_FRAMES_LOST, data, &reply);
620 if (status != NO_ERROR) {
621 return 0;
622 }
623 return (uint32_t) reply.readInt32();
Eric Laurent05bca2f2010-02-26 02:47:27 -0800624 }
Eric Laurentbe916aa2010-06-01 23:49:17 -0700625
Glenn Kasteneeecb982016-02-26 10:44:04 -0800626 virtual audio_unique_id_t newAudioUniqueId(audio_unique_id_use_t use)
Eric Laurentbe916aa2010-06-01 23:49:17 -0700627 {
628 Parcel data, reply;
629 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Glenn Kasteneeecb982016-02-26 10:44:04 -0800630 data.writeInt32((int32_t) use);
Eric Laurentbe916aa2010-06-01 23:49:17 -0700631 status_t status = remote()->transact(NEW_AUDIO_SESSION_ID, data, &reply);
Eric Laurentde3f8392014-07-27 18:38:22 -0700632 audio_unique_id_t id = AUDIO_SESSION_ALLOCATE;
Eric Laurentbe916aa2010-06-01 23:49:17 -0700633 if (status == NO_ERROR) {
634 id = reply.readInt32();
635 }
636 return id;
637 }
638
Glenn Kastend848eb42016-03-08 13:42:11 -0800639 virtual void acquireAudioSessionId(audio_session_t audioSession, int pid)
Marco Nelissen3a34bef2011-08-02 13:33:41 -0700640 {
641 Parcel data, reply;
642 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
643 data.writeInt32(audioSession);
Marco Nelissend457c972014-02-11 08:47:07 -0800644 data.writeInt32(pid);
Marco Nelissen3a34bef2011-08-02 13:33:41 -0700645 remote()->transact(ACQUIRE_AUDIO_SESSION_ID, data, &reply);
646 }
647
Glenn Kastend848eb42016-03-08 13:42:11 -0800648 virtual void releaseAudioSessionId(audio_session_t audioSession, int pid)
Marco Nelissen3a34bef2011-08-02 13:33:41 -0700649 {
650 Parcel data, reply;
651 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
652 data.writeInt32(audioSession);
Marco Nelissend457c972014-02-11 08:47:07 -0800653 data.writeInt32(pid);
Marco Nelissen3a34bef2011-08-02 13:33:41 -0700654 remote()->transact(RELEASE_AUDIO_SESSION_ID, data, &reply);
655 }
656
Glenn Kastenf587ba52012-01-26 16:25:10 -0800657 virtual status_t queryNumberEffects(uint32_t *numEffects) const
Eric Laurentbe916aa2010-06-01 23:49:17 -0700658 {
659 Parcel data, reply;
660 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
661 status_t status = remote()->transact(QUERY_NUM_EFFECTS, data, &reply);
662 if (status != NO_ERROR) {
663 return status;
664 }
665 status = reply.readInt32();
666 if (status != NO_ERROR) {
667 return status;
668 }
Glenn Kasten9d1f02d2012-02-08 17:47:58 -0800669 if (numEffects != NULL) {
Eric Laurentbe916aa2010-06-01 23:49:17 -0700670 *numEffects = (uint32_t)reply.readInt32();
671 }
672 return NO_ERROR;
673 }
674
Glenn Kastenf587ba52012-01-26 16:25:10 -0800675 virtual status_t queryEffect(uint32_t index, effect_descriptor_t *pDescriptor) const
Eric Laurentbe916aa2010-06-01 23:49:17 -0700676 {
677 if (pDescriptor == NULL) {
678 return BAD_VALUE;
679 }
680 Parcel data, reply;
681 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Eric Laurentffe9c252010-06-23 17:38:20 -0700682 data.writeInt32(index);
683 status_t status = remote()->transact(QUERY_EFFECT, data, &reply);
Eric Laurentbe916aa2010-06-01 23:49:17 -0700684 if (status != NO_ERROR) {
685 return status;
686 }
687 status = reply.readInt32();
688 if (status != NO_ERROR) {
689 return status;
690 }
691 reply.read(pDescriptor, sizeof(effect_descriptor_t));
692 return NO_ERROR;
693 }
694
Glenn Kasten5e92a782012-01-30 07:40:52 -0800695 virtual status_t getEffectDescriptor(const effect_uuid_t *pUuid,
Glenn Kastenf587ba52012-01-26 16:25:10 -0800696 effect_descriptor_t *pDescriptor) const
Eric Laurentbe916aa2010-06-01 23:49:17 -0700697 {
698 if (pUuid == NULL || pDescriptor == NULL) {
699 return BAD_VALUE;
700 }
701 Parcel data, reply;
702 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
703 data.write(pUuid, sizeof(effect_uuid_t));
704 status_t status = remote()->transact(GET_EFFECT_DESCRIPTOR, data, &reply);
705 if (status != NO_ERROR) {
706 return status;
707 }
708 status = reply.readInt32();
709 if (status != NO_ERROR) {
710 return status;
711 }
712 reply.read(pDescriptor, sizeof(effect_descriptor_t));
713 return NO_ERROR;
714 }
715
Glenn Kasten8d6cc842012-02-03 11:06:53 -0800716 virtual sp<IEffect> createEffect(
Eric Laurentbe916aa2010-06-01 23:49:17 -0700717 effect_descriptor_t *pDesc,
718 const sp<IEffectClient>& client,
719 int32_t priority,
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800720 audio_io_handle_t output,
Glenn Kastend848eb42016-03-08 13:42:11 -0800721 audio_session_t sessionId,
Svet Ganovbe71aa22015-04-28 12:06:02 -0700722 const String16& opPackageName,
Eric Laurentb6436272016-12-07 19:24:50 -0800723 pid_t pid,
Eric Laurentbe916aa2010-06-01 23:49:17 -0700724 status_t *status,
725 int *id,
726 int *enabled)
727 {
728 Parcel data, reply;
729 sp<IEffect> effect;
730
731 if (pDesc == NULL) {
Glenn Kastene53b9ea2012-03-12 16:29:55 -0700732 return effect;
Glenn Kasten507b2862013-07-31 16:12:13 -0700733 if (status != NULL) {
Glenn Kastene53b9ea2012-03-12 16:29:55 -0700734 *status = BAD_VALUE;
735 }
736 }
Eric Laurentbe916aa2010-06-01 23:49:17 -0700737
738 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
Eric Laurentbe916aa2010-06-01 23:49:17 -0700739 data.write(pDesc, sizeof(effect_descriptor_t));
Marco Nelissen06b46062014-11-14 07:58:25 -0800740 data.writeStrongBinder(IInterface::asBinder(client));
Eric Laurentbe916aa2010-06-01 23:49:17 -0700741 data.writeInt32(priority);
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800742 data.writeInt32((int32_t) output);
Eric Laurentbe916aa2010-06-01 23:49:17 -0700743 data.writeInt32(sessionId);
Svet Ganovbe71aa22015-04-28 12:06:02 -0700744 data.writeString16(opPackageName);
Eric Laurentb6436272016-12-07 19:24:50 -0800745 data.writeInt32((int32_t) pid);
Eric Laurentbe916aa2010-06-01 23:49:17 -0700746
747 status_t lStatus = remote()->transact(CREATE_EFFECT, data, &reply);
748 if (lStatus != NO_ERROR) {
Steve Block29357bc2012-01-06 19:20:56 +0000749 ALOGE("createEffect error: %s", strerror(-lStatus));
Eric Laurentbe916aa2010-06-01 23:49:17 -0700750 } else {
751 lStatus = reply.readInt32();
752 int tmp = reply.readInt32();
Glenn Kasten507b2862013-07-31 16:12:13 -0700753 if (id != NULL) {
Eric Laurentbe916aa2010-06-01 23:49:17 -0700754 *id = tmp;
755 }
756 tmp = reply.readInt32();
Glenn Kastena0d68332012-01-27 16:47:15 -0800757 if (enabled != NULL) {
Eric Laurentbe916aa2010-06-01 23:49:17 -0700758 *enabled = tmp;
759 }
760 effect = interface_cast<IEffect>(reply.readStrongBinder());
761 reply.read(pDesc, sizeof(effect_descriptor_t));
762 }
Glenn Kasten507b2862013-07-31 16:12:13 -0700763 if (status != NULL) {
Eric Laurentbe916aa2010-06-01 23:49:17 -0700764 *status = lStatus;
765 }
766
767 return effect;
768 }
Eric Laurentde070132010-07-13 04:45:46 -0700769
Glenn Kastend848eb42016-03-08 13:42:11 -0800770 virtual status_t moveEffects(audio_session_t session, audio_io_handle_t srcOutput,
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800771 audio_io_handle_t dstOutput)
Eric Laurentde070132010-07-13 04:45:46 -0700772 {
773 Parcel data, reply;
774 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
775 data.writeInt32(session);
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800776 data.writeInt32((int32_t) srcOutput);
777 data.writeInt32((int32_t) dstOutput);
Eric Laurentde070132010-07-13 04:45:46 -0700778 remote()->transact(MOVE_EFFECTS, data, &reply);
779 return reply.readInt32();
780 }
Eric Laurenta4c5a552012-03-29 10:12:40 -0700781
782 virtual audio_module_handle_t loadHwModule(const char *name)
783 {
784 Parcel data, reply;
785 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
786 data.writeCString(name);
787 remote()->transact(LOAD_HW_MODULE, data, &reply);
788 return (audio_module_handle_t) reply.readInt32();
789 }
Glenn Kastencc0f1cf2012-09-24 11:27:18 -0700790
Glenn Kasten3b16c762012-11-14 08:44:39 -0800791 virtual uint32_t getPrimaryOutputSamplingRate()
Glenn Kastencc0f1cf2012-09-24 11:27:18 -0700792 {
793 Parcel data, reply;
794 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
795 remote()->transact(GET_PRIMARY_OUTPUT_SAMPLING_RATE, data, &reply);
796 return reply.readInt32();
797 }
798
Glenn Kastene33054e2012-11-14 12:54:39 -0800799 virtual size_t getPrimaryOutputFrameCount()
Glenn Kastencc0f1cf2012-09-24 11:27:18 -0700800 {
801 Parcel data, reply;
802 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
803 remote()->transact(GET_PRIMARY_OUTPUT_FRAME_COUNT, data, &reply);
Glenn Kastene03dd222014-01-28 11:04:39 -0800804 return reply.readInt64();
Glenn Kastencc0f1cf2012-09-24 11:27:18 -0700805 }
806
Glenn Kasten4182c4e2013-07-15 14:45:07 -0700807 virtual status_t setLowRamDevice(bool isLowRamDevice)
808 {
809 Parcel data, reply;
810 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
811 data.writeInt32((int) isLowRamDevice);
812 remote()->transact(SET_LOW_RAM_DEVICE, data, &reply);
813 return reply.readInt32();
814 }
Eric Laurent4b123402014-04-11 09:22:20 -0700815 virtual status_t listAudioPorts(unsigned int *num_ports,
816 struct audio_port *ports)
817 {
818 if (num_ports == NULL || *num_ports == 0 || ports == NULL) {
819 return BAD_VALUE;
820 }
821 Parcel data, reply;
822 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
823 data.writeInt32(*num_ports);
824 status_t status = remote()->transact(LIST_AUDIO_PORTS, data, &reply);
825 if (status != NO_ERROR ||
826 (status = (status_t)reply.readInt32()) != NO_ERROR) {
827 return status;
828 }
829 *num_ports = (unsigned int)reply.readInt32();
830 reply.read(ports, *num_ports * sizeof(struct audio_port));
831 return status;
832 }
833 virtual status_t getAudioPort(struct audio_port *port)
834 {
835 if (port == NULL) {
836 return BAD_VALUE;
837 }
838 Parcel data, reply;
839 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
840 data.write(port, sizeof(struct audio_port));
841 status_t status = remote()->transact(GET_AUDIO_PORT, data, &reply);
842 if (status != NO_ERROR ||
843 (status = (status_t)reply.readInt32()) != NO_ERROR) {
844 return status;
845 }
846 reply.read(port, sizeof(struct audio_port));
847 return status;
848 }
849 virtual status_t createAudioPatch(const struct audio_patch *patch,
850 audio_patch_handle_t *handle)
851 {
852 if (patch == NULL || handle == NULL) {
853 return BAD_VALUE;
854 }
855 Parcel data, reply;
856 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
857 data.write(patch, sizeof(struct audio_patch));
858 data.write(handle, sizeof(audio_patch_handle_t));
859 status_t status = remote()->transact(CREATE_AUDIO_PATCH, data, &reply);
860 if (status != NO_ERROR ||
861 (status = (status_t)reply.readInt32()) != NO_ERROR) {
862 return status;
863 }
864 reply.read(handle, sizeof(audio_patch_handle_t));
865 return status;
866 }
867 virtual status_t releaseAudioPatch(audio_patch_handle_t handle)
868 {
869 Parcel data, reply;
870 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
871 data.write(&handle, sizeof(audio_patch_handle_t));
872 status_t status = remote()->transact(RELEASE_AUDIO_PATCH, data, &reply);
873 if (status != NO_ERROR) {
874 status = (status_t)reply.readInt32();
875 }
876 return status;
877 }
878 virtual status_t listAudioPatches(unsigned int *num_patches,
879 struct audio_patch *patches)
880 {
881 if (num_patches == NULL || *num_patches == 0 || patches == NULL) {
882 return BAD_VALUE;
883 }
884 Parcel data, reply;
885 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
886 data.writeInt32(*num_patches);
887 status_t status = remote()->transact(LIST_AUDIO_PATCHES, data, &reply);
888 if (status != NO_ERROR ||
889 (status = (status_t)reply.readInt32()) != NO_ERROR) {
890 return status;
891 }
892 *num_patches = (unsigned int)reply.readInt32();
893 reply.read(patches, *num_patches * sizeof(struct audio_patch));
894 return status;
895 }
896 virtual status_t setAudioPortConfig(const struct audio_port_config *config)
897 {
898 if (config == NULL) {
899 return BAD_VALUE;
900 }
901 Parcel data, reply;
902 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
903 data.write(config, sizeof(struct audio_port_config));
904 status_t status = remote()->transact(SET_AUDIO_PORT_CONFIG, data, &reply);
905 if (status != NO_ERROR) {
906 status = (status_t)reply.readInt32();
907 }
908 return status;
909 }
Eric Laurent93c3d412014-08-01 14:48:35 -0700910 virtual audio_hw_sync_t getAudioHwSyncForSession(audio_session_t sessionId)
911 {
912 Parcel data, reply;
913 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
914 data.writeInt32(sessionId);
915 status_t status = remote()->transact(GET_AUDIO_HW_SYNC, data, &reply);
916 if (status != NO_ERROR) {
917 return AUDIO_HW_SYNC_INVALID;
918 }
919 return (audio_hw_sync_t)reply.readInt32();
920 }
Eric Laurent72e3f392015-05-20 14:43:50 -0700921 virtual status_t systemReady()
922 {
923 Parcel data, reply;
924 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
925 return remote()->transact(SYSTEM_READY, data, &reply, IBinder::FLAG_ONEWAY);
926 }
Glenn Kasten4a8308b2016-04-18 14:10:01 -0700927 virtual size_t frameCountHAL(audio_io_handle_t ioHandle) const
928 {
929 Parcel data, reply;
930 data.writeInterfaceToken(IAudioFlinger::getInterfaceDescriptor());
931 data.writeInt32((int32_t) ioHandle);
932 status_t status = remote()->transact(FRAME_COUNT_HAL, data, &reply);
933 if (status != NO_ERROR) {
934 return 0;
935 }
936 return reply.readInt64();
937 }
938
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800939};
940
941IMPLEMENT_META_INTERFACE(AudioFlinger, "android.media.IAudioFlinger");
942
943// ----------------------------------------------------------------------
944
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800945status_t BnAudioFlinger::onTransact(
946 uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
947{
Glenn Kastene53b9ea2012-03-12 16:29:55 -0700948 switch (code) {
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800949 case CREATE_TRACK: {
950 CHECK_INTERFACE(IAudioFlinger, data, reply);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800951 int streamType = data.readInt32();
952 uint32_t sampleRate = data.readInt32();
Glenn Kasten58f30212012-01-12 12:27:51 -0800953 audio_format_t format = (audio_format_t) data.readInt32();
Glenn Kastendd8104c2012-07-02 12:42:44 -0700954 audio_channel_mask_t channelMask = data.readInt32();
Glenn Kastene03dd222014-01-28 11:04:39 -0800955 size_t frameCount = data.readInt64();
Eric Laurent05067782016-06-01 18:27:28 -0700956 audio_output_flags_t flags = (audio_output_flags_t) data.readInt32();
Eric Laurent3d00aa62013-09-24 09:53:27 -0700957 bool haveSharedBuffer = data.readInt32() != 0;
958 sp<IMemory> buffer;
959 if (haveSharedBuffer) {
960 buffer = interface_cast<IMemory>(data.readStrongBinder());
961 }
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800962 audio_io_handle_t output = (audio_io_handle_t) data.readInt32();
Haynes Mathew George9ea77cd2016-04-06 17:07:48 -0700963 pid_t pid = (pid_t) data.readInt32();
Glenn Kasten3acbd052012-02-28 10:39:56 -0800964 pid_t tid = (pid_t) data.readInt32();
Glenn Kastend848eb42016-03-08 13:42:11 -0800965 audio_session_t sessionId = (audio_session_t) data.readInt32();
Marco Nelissen462fd2f2013-01-14 14:12:05 -0800966 int clientUid = data.readInt32();
Eric Laurent20b9ef02016-12-05 11:03:16 -0800967 audio_port_handle_t portId = (audio_port_handle_t) data.readInt32();
Wei Jia983dca32015-09-10 09:47:29 -0700968 status_t status = NO_ERROR;
Eric Laurent3d00aa62013-09-24 09:53:27 -0700969 sp<IAudioTrack> track;
970 if ((haveSharedBuffer && (buffer == 0)) ||
971 ((buffer != 0) && (buffer->pointer() == NULL))) {
972 ALOGW("CREATE_TRACK: cannot retrieve shared memory");
973 status = DEAD_OBJECT;
974 } else {
975 track = createTrack(
976 (audio_stream_type_t) streamType, sampleRate, format,
Haynes Mathew George9ea77cd2016-04-06 17:07:48 -0700977 channelMask, &frameCount, &flags, buffer, output, pid, tid,
Eric Laurent20b9ef02016-12-05 11:03:16 -0800978 &sessionId, clientUid, &status, portId);
Glenn Kasten0cde0762014-01-16 15:06:36 -0800979 LOG_ALWAYS_FATAL_IF((track != 0) != (status == NO_ERROR));
Eric Laurent3d00aa62013-09-24 09:53:27 -0700980 }
Glenn Kastenb53fc4e2014-05-02 08:03:58 -0700981 reply->writeInt64(frameCount);
Glenn Kastene0b07172012-11-06 15:03:34 -0800982 reply->writeInt32(flags);
Eric Laurentbe916aa2010-06-01 23:49:17 -0700983 reply->writeInt32(sessionId);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800984 reply->writeInt32(status);
Marco Nelissen06b46062014-11-14 07:58:25 -0800985 reply->writeStrongBinder(IInterface::asBinder(track));
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800986 return NO_ERROR;
987 } break;
988 case OPEN_RECORD: {
989 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasten72ef00d2012-01-17 11:09:42 -0800990 audio_io_handle_t input = (audio_io_handle_t) data.readInt32();
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -0800991 uint32_t sampleRate = data.readInt32();
Glenn Kasten58f30212012-01-12 12:27:51 -0800992 audio_format_t format = (audio_format_t) data.readInt32();
Glenn Kastendd8104c2012-07-02 12:42:44 -0700993 audio_channel_mask_t channelMask = data.readInt32();
Svet Ganovbe71aa22015-04-28 12:06:02 -0700994 const String16& opPackageName = data.readString16();
Glenn Kastene03dd222014-01-28 11:04:39 -0800995 size_t frameCount = data.readInt64();
Eric Laurent05067782016-06-01 18:27:28 -0700996 audio_input_flags_t flags = (audio_input_flags_t) data.readInt32();
Haynes Mathew George9ea77cd2016-04-06 17:07:48 -0700997 pid_t pid = (pid_t) data.readInt32();
Glenn Kasten1879fff2012-07-11 15:36:59 -0700998 pid_t tid = (pid_t) data.readInt32();
Jean-Michel Trivi4cb66832015-05-01 18:34:17 -0700999 int clientUid = data.readInt32();
Glenn Kastend848eb42016-03-08 13:42:11 -08001000 audio_session_t sessionId = (audio_session_t) data.readInt32();
Glenn Kasten74105912014-07-03 12:28:53 -07001001 size_t notificationFrames = data.readInt64();
Eric Laurent20b9ef02016-12-05 11:03:16 -08001002 audio_port_handle_t portId = (audio_port_handle_t) data.readInt32();
Glenn Kastend776ac62014-05-07 09:16:09 -07001003 sp<IMemory> cblk;
1004 sp<IMemory> buffers;
Wei Jia983dca32015-09-10 09:47:29 -07001005 status_t status = NO_ERROR;
Glenn Kasten8d6cc842012-02-03 11:06:53 -08001006 sp<IAudioRecord> record = openRecord(input,
Haynes Mathew George9ea77cd2016-04-06 17:07:48 -07001007 sampleRate, format, channelMask, opPackageName, &frameCount, &flags,
1008 pid, tid, clientUid, &sessionId, &notificationFrames, cblk, buffers,
Eric Laurent20b9ef02016-12-05 11:03:16 -08001009 &status, portId);
Glenn Kastene93cf2c2013-09-24 11:52:37 -07001010 LOG_ALWAYS_FATAL_IF((record != 0) != (status == NO_ERROR));
Glenn Kastenb53fc4e2014-05-02 08:03:58 -07001011 reply->writeInt64(frameCount);
Glenn Kasteneeca3262013-07-31 16:12:48 -07001012 reply->writeInt32(flags);
Eric Laurentbe916aa2010-06-01 23:49:17 -07001013 reply->writeInt32(sessionId);
Glenn Kasten7df8c0b2014-07-03 12:23:29 -07001014 reply->writeInt64(notificationFrames);
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001015 reply->writeInt32(status);
Marco Nelissen06b46062014-11-14 07:58:25 -08001016 reply->writeStrongBinder(IInterface::asBinder(record));
1017 reply->writeStrongBinder(IInterface::asBinder(cblk));
1018 reply->writeStrongBinder(IInterface::asBinder(buffers));
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001019 return NO_ERROR;
1020 } break;
1021 case SAMPLE_RATE: {
1022 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001023 reply->writeInt32( sampleRate((audio_io_handle_t) data.readInt32()) );
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001024 return NO_ERROR;
1025 } break;
Glenn Kasten4a8308b2016-04-18 14:10:01 -07001026
1027 // RESERVED for channelCount()
1028
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001029 case FORMAT: {
1030 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001031 reply->writeInt32( format((audio_io_handle_t) data.readInt32()) );
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001032 return NO_ERROR;
1033 } break;
1034 case FRAME_COUNT: {
1035 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kastene03dd222014-01-28 11:04:39 -08001036 reply->writeInt64( frameCount((audio_io_handle_t) data.readInt32()) );
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001037 return NO_ERROR;
1038 } break;
1039 case LATENCY: {
1040 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001041 reply->writeInt32( latency((audio_io_handle_t) data.readInt32()) );
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001042 return NO_ERROR;
1043 } break;
Glenn Kastene53b9ea2012-03-12 16:29:55 -07001044 case SET_MASTER_VOLUME: {
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001045 CHECK_INTERFACE(IAudioFlinger, data, reply);
1046 reply->writeInt32( setMasterVolume(data.readFloat()) );
1047 return NO_ERROR;
1048 } break;
1049 case SET_MASTER_MUTE: {
1050 CHECK_INTERFACE(IAudioFlinger, data, reply);
1051 reply->writeInt32( setMasterMute(data.readInt32()) );
1052 return NO_ERROR;
1053 } break;
1054 case MASTER_VOLUME: {
1055 CHECK_INTERFACE(IAudioFlinger, data, reply);
1056 reply->writeFloat( masterVolume() );
1057 return NO_ERROR;
1058 } break;
1059 case MASTER_MUTE: {
1060 CHECK_INTERFACE(IAudioFlinger, data, reply);
1061 reply->writeInt32( masterMute() );
1062 return NO_ERROR;
1063 } break;
1064 case SET_STREAM_VOLUME: {
1065 CHECK_INTERFACE(IAudioFlinger, data, reply);
1066 int stream = data.readInt32();
Eric Laurentc2f1f072009-07-17 12:17:14 -07001067 float volume = data.readFloat();
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001068 audio_io_handle_t output = (audio_io_handle_t) data.readInt32();
Glenn Kastenfff6d712012-01-12 16:38:12 -08001069 reply->writeInt32( setStreamVolume((audio_stream_type_t) stream, volume, output) );
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001070 return NO_ERROR;
1071 } break;
1072 case SET_STREAM_MUTE: {
1073 CHECK_INTERFACE(IAudioFlinger, data, reply);
1074 int stream = data.readInt32();
Glenn Kastenfff6d712012-01-12 16:38:12 -08001075 reply->writeInt32( setStreamMute((audio_stream_type_t) stream, data.readInt32()) );
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001076 return NO_ERROR;
1077 } break;
1078 case STREAM_VOLUME: {
1079 CHECK_INTERFACE(IAudioFlinger, data, reply);
1080 int stream = data.readInt32();
Eric Laurentfa2877b2009-07-28 08:44:33 -07001081 int output = data.readInt32();
Glenn Kastenfff6d712012-01-12 16:38:12 -08001082 reply->writeFloat( streamVolume((audio_stream_type_t) stream, output) );
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001083 return NO_ERROR;
1084 } break;
1085 case STREAM_MUTE: {
1086 CHECK_INTERFACE(IAudioFlinger, data, reply);
1087 int stream = data.readInt32();
Glenn Kastenfff6d712012-01-12 16:38:12 -08001088 reply->writeInt32( streamMute((audio_stream_type_t) stream) );
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001089 return NO_ERROR;
1090 } break;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001091 case SET_MODE: {
1092 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kastenf78aee72012-01-04 11:00:47 -08001093 audio_mode_t mode = (audio_mode_t) data.readInt32();
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001094 reply->writeInt32( setMode(mode) );
1095 return NO_ERROR;
1096 } break;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001097 case SET_MIC_MUTE: {
1098 CHECK_INTERFACE(IAudioFlinger, data, reply);
1099 int state = data.readInt32();
1100 reply->writeInt32( setMicMute(state) );
1101 return NO_ERROR;
1102 } break;
1103 case GET_MIC_MUTE: {
1104 CHECK_INTERFACE(IAudioFlinger, data, reply);
1105 reply->writeInt32( getMicMute() );
1106 return NO_ERROR;
1107 } break;
Eric Laurentc2f1f072009-07-17 12:17:14 -07001108 case SET_PARAMETERS: {
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001109 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001110 audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32();
Eric Laurentc2f1f072009-07-17 12:17:14 -07001111 String8 keyValuePairs(data.readString8());
1112 reply->writeInt32(setParameters(ioHandle, keyValuePairs));
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001113 return NO_ERROR;
Glenn Kastene53b9ea2012-03-12 16:29:55 -07001114 } break;
Eric Laurentc2f1f072009-07-17 12:17:14 -07001115 case GET_PARAMETERS: {
1116 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001117 audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32();
Eric Laurentc2f1f072009-07-17 12:17:14 -07001118 String8 keys(data.readString8());
1119 reply->writeString8(getParameters(ioHandle, keys));
1120 return NO_ERROR;
Glenn Kastene53b9ea2012-03-12 16:29:55 -07001121 } break;
Eric Laurentc2f1f072009-07-17 12:17:14 -07001122
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001123 case REGISTER_CLIENT: {
1124 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasten85ab62c2012-11-01 11:11:38 -07001125 sp<IAudioFlingerClient> client = interface_cast<IAudioFlingerClient>(
1126 data.readStrongBinder());
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001127 registerClient(client);
1128 return NO_ERROR;
1129 } break;
1130 case GET_INPUTBUFFERSIZE: {
1131 CHECK_INTERFACE(IAudioFlinger, data, reply);
1132 uint32_t sampleRate = data.readInt32();
Glenn Kasten58f30212012-01-12 12:27:51 -08001133 audio_format_t format = (audio_format_t) data.readInt32();
Glenn Kastendd8104c2012-07-02 12:42:44 -07001134 audio_channel_mask_t channelMask = data.readInt32();
Glenn Kastene03dd222014-01-28 11:04:39 -08001135 reply->writeInt64( getInputBufferSize(sampleRate, format, channelMask) );
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001136 return NO_ERROR;
1137 } break;
Eric Laurentc2f1f072009-07-17 12:17:14 -07001138 case OPEN_OUTPUT: {
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001139 CHECK_INTERFACE(IAudioFlinger, data, reply);
Eric Laurenta4c5a552012-03-29 10:12:40 -07001140 audio_module_handle_t module = (audio_module_handle_t)data.readInt32();
Wei Jiae995e472015-09-09 09:48:34 -07001141 audio_config_t config = {};
1142 if (data.read(&config, sizeof(audio_config_t)) != NO_ERROR) {
1143 ALOGE("b/23905951");
1144 }
Eric Laurenta4c5a552012-03-29 10:12:40 -07001145 audio_devices_t devices = (audio_devices_t)data.readInt32();
Eric Laurentcf2c0212014-07-25 16:20:43 -07001146 String8 address(data.readString8());
Eric Laurent0ca3cf92012-04-18 09:24:29 -07001147 audio_output_flags_t flags = (audio_output_flags_t) data.readInt32();
Wei Jia983dca32015-09-10 09:47:29 -07001148 uint32_t latencyMs = 0;
Wei Jia4cac44b2015-09-16 15:01:16 -07001149 audio_io_handle_t output = AUDIO_IO_HANDLE_NONE;
Eric Laurentcf2c0212014-07-25 16:20:43 -07001150 status_t status = openOutput(module, &output, &config,
1151 &devices, address, &latencyMs, flags);
Glenn Kasten70742962014-02-18 08:00:47 -08001152 ALOGV("OPEN_OUTPUT output, %d", output);
Eric Laurentcf2c0212014-07-25 16:20:43 -07001153 reply->writeInt32((int32_t)status);
1154 if (status == NO_ERROR) {
1155 reply->writeInt32((int32_t)output);
1156 reply->write(&config, sizeof(audio_config_t));
1157 reply->writeInt32(devices);
1158 reply->writeInt32(latencyMs);
1159 }
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001160 return NO_ERROR;
1161 } break;
Eric Laurentc2f1f072009-07-17 12:17:14 -07001162 case OPEN_DUPLICATE_OUTPUT: {
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001163 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001164 audio_io_handle_t output1 = (audio_io_handle_t) data.readInt32();
1165 audio_io_handle_t output2 = (audio_io_handle_t) data.readInt32();
1166 reply->writeInt32((int32_t) openDuplicateOutput(output1, output2));
Eric Laurentc2f1f072009-07-17 12:17:14 -07001167 return NO_ERROR;
1168 } break;
1169 case CLOSE_OUTPUT: {
1170 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001171 reply->writeInt32(closeOutput((audio_io_handle_t) data.readInt32()));
Eric Laurentc2f1f072009-07-17 12:17:14 -07001172 return NO_ERROR;
1173 } break;
1174 case SUSPEND_OUTPUT: {
1175 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001176 reply->writeInt32(suspendOutput((audio_io_handle_t) data.readInt32()));
Eric Laurentc2f1f072009-07-17 12:17:14 -07001177 return NO_ERROR;
1178 } break;
1179 case RESTORE_OUTPUT: {
1180 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001181 reply->writeInt32(restoreOutput((audio_io_handle_t) data.readInt32()));
Eric Laurentc2f1f072009-07-17 12:17:14 -07001182 return NO_ERROR;
1183 } break;
1184 case OPEN_INPUT: {
1185 CHECK_INTERFACE(IAudioFlinger, data, reply);
Eric Laurenta4c5a552012-03-29 10:12:40 -07001186 audio_module_handle_t module = (audio_module_handle_t)data.readInt32();
Eric Laurentcf2c0212014-07-25 16:20:43 -07001187 audio_io_handle_t input = (audio_io_handle_t)data.readInt32();
Wei Jiae995e472015-09-09 09:48:34 -07001188 audio_config_t config = {};
1189 if (data.read(&config, sizeof(audio_config_t)) != NO_ERROR) {
1190 ALOGE("b/23905951");
1191 }
Eric Laurentcf2c0212014-07-25 16:20:43 -07001192 audio_devices_t device = (audio_devices_t)data.readInt32();
1193 String8 address(data.readString8());
1194 audio_source_t source = (audio_source_t)data.readInt32();
Glenn Kastenec40d282014-07-15 15:31:26 -07001195 audio_input_flags_t flags = (audio_input_flags_t) data.readInt32();
Eric Laurentc2f1f072009-07-17 12:17:14 -07001196
Eric Laurentcf2c0212014-07-25 16:20:43 -07001197 status_t status = openInput(module, &input, &config,
1198 &device, address, source, flags);
1199 reply->writeInt32((int32_t) status);
1200 if (status == NO_ERROR) {
1201 reply->writeInt32((int32_t) input);
1202 reply->write(&config, sizeof(audio_config_t));
1203 reply->writeInt32(device);
1204 }
Eric Laurentc2f1f072009-07-17 12:17:14 -07001205 return NO_ERROR;
1206 } break;
1207 case CLOSE_INPUT: {
1208 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001209 reply->writeInt32(closeInput((audio_io_handle_t) data.readInt32()));
Eric Laurentc2f1f072009-07-17 12:17:14 -07001210 return NO_ERROR;
1211 } break;
Glenn Kastend2304db2014-02-03 07:40:31 -08001212 case INVALIDATE_STREAM: {
Eric Laurentc2f1f072009-07-17 12:17:14 -07001213 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kastend2304db2014-02-03 07:40:31 -08001214 audio_stream_type_t stream = (audio_stream_type_t) data.readInt32();
1215 reply->writeInt32(invalidateStream(stream));
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001216 return NO_ERROR;
1217 } break;
Eric Laurentf0ee6f42009-10-21 08:14:22 -07001218 case SET_VOICE_VOLUME: {
1219 CHECK_INTERFACE(IAudioFlinger, data, reply);
1220 float volume = data.readFloat();
1221 reply->writeInt32( setVoiceVolume(volume) );
1222 return NO_ERROR;
1223 } break;
Eric Laurent342e9cf2010-01-19 17:37:09 -08001224 case GET_RENDER_POSITION: {
1225 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001226 audio_io_handle_t output = (audio_io_handle_t) data.readInt32();
Wei Jia983dca32015-09-10 09:47:29 -07001227 uint32_t halFrames = 0;
1228 uint32_t dspFrames = 0;
Eric Laurent342e9cf2010-01-19 17:37:09 -08001229 status_t status = getRenderPosition(&halFrames, &dspFrames, output);
1230 reply->writeInt32(status);
1231 if (status == NO_ERROR) {
1232 reply->writeInt32(halFrames);
1233 reply->writeInt32(dspFrames);
1234 }
1235 return NO_ERROR;
1236 }
Eric Laurent05bca2f2010-02-26 02:47:27 -08001237 case GET_INPUT_FRAMES_LOST: {
1238 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001239 audio_io_handle_t ioHandle = (audio_io_handle_t) data.readInt32();
Glenn Kasten5f972c02014-01-13 09:59:31 -08001240 reply->writeInt32((int32_t) getInputFramesLost(ioHandle));
Eric Laurent05bca2f2010-02-26 02:47:27 -08001241 return NO_ERROR;
1242 } break;
Eric Laurentbe916aa2010-06-01 23:49:17 -07001243 case NEW_AUDIO_SESSION_ID: {
1244 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kasteneeecb982016-02-26 10:44:04 -08001245 reply->writeInt32(newAudioUniqueId((audio_unique_id_use_t) data.readInt32()));
Eric Laurentbe916aa2010-06-01 23:49:17 -07001246 return NO_ERROR;
1247 } break;
Marco Nelissen3a34bef2011-08-02 13:33:41 -07001248 case ACQUIRE_AUDIO_SESSION_ID: {
1249 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kastend848eb42016-03-08 13:42:11 -08001250 audio_session_t audioSession = (audio_session_t) data.readInt32();
Marco Nelissend457c972014-02-11 08:47:07 -08001251 int pid = data.readInt32();
1252 acquireAudioSessionId(audioSession, pid);
Marco Nelissen3a34bef2011-08-02 13:33:41 -07001253 return NO_ERROR;
1254 } break;
1255 case RELEASE_AUDIO_SESSION_ID: {
1256 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kastend848eb42016-03-08 13:42:11 -08001257 audio_session_t audioSession = (audio_session_t) data.readInt32();
Marco Nelissend457c972014-02-11 08:47:07 -08001258 int pid = data.readInt32();
1259 releaseAudioSessionId(audioSession, pid);
Marco Nelissen3a34bef2011-08-02 13:33:41 -07001260 return NO_ERROR;
1261 } break;
Eric Laurentbe916aa2010-06-01 23:49:17 -07001262 case QUERY_NUM_EFFECTS: {
1263 CHECK_INTERFACE(IAudioFlinger, data, reply);
Wei Jia983dca32015-09-10 09:47:29 -07001264 uint32_t numEffects = 0;
Eric Laurentbe916aa2010-06-01 23:49:17 -07001265 status_t status = queryNumberEffects(&numEffects);
1266 reply->writeInt32(status);
1267 if (status == NO_ERROR) {
1268 reply->writeInt32((int32_t)numEffects);
1269 }
1270 return NO_ERROR;
1271 }
Eric Laurentffe9c252010-06-23 17:38:20 -07001272 case QUERY_EFFECT: {
Eric Laurentbe916aa2010-06-01 23:49:17 -07001273 CHECK_INTERFACE(IAudioFlinger, data, reply);
Wei Jia983dca32015-09-10 09:47:29 -07001274 effect_descriptor_t desc = {};
Eric Laurentffe9c252010-06-23 17:38:20 -07001275 status_t status = queryEffect(data.readInt32(), &desc);
Eric Laurentbe916aa2010-06-01 23:49:17 -07001276 reply->writeInt32(status);
1277 if (status == NO_ERROR) {
1278 reply->write(&desc, sizeof(effect_descriptor_t));
1279 }
1280 return NO_ERROR;
1281 }
1282 case GET_EFFECT_DESCRIPTOR: {
1283 CHECK_INTERFACE(IAudioFlinger, data, reply);
1284 effect_uuid_t uuid;
1285 data.read(&uuid, sizeof(effect_uuid_t));
Wei Jia983dca32015-09-10 09:47:29 -07001286 effect_descriptor_t desc = {};
Eric Laurentbe916aa2010-06-01 23:49:17 -07001287 status_t status = getEffectDescriptor(&uuid, &desc);
1288 reply->writeInt32(status);
1289 if (status == NO_ERROR) {
1290 reply->write(&desc, sizeof(effect_descriptor_t));
1291 }
1292 return NO_ERROR;
1293 }
1294 case CREATE_EFFECT: {
1295 CHECK_INTERFACE(IAudioFlinger, data, reply);
Wei Jiae995e472015-09-09 09:48:34 -07001296 effect_descriptor_t desc = {};
1297 if (data.read(&desc, sizeof(effect_descriptor_t)) != NO_ERROR) {
1298 ALOGE("b/23905951");
1299 }
Eric Laurentbe916aa2010-06-01 23:49:17 -07001300 sp<IEffectClient> client = interface_cast<IEffectClient>(data.readStrongBinder());
1301 int32_t priority = data.readInt32();
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001302 audio_io_handle_t output = (audio_io_handle_t) data.readInt32();
Glenn Kastend848eb42016-03-08 13:42:11 -08001303 audio_session_t sessionId = (audio_session_t) data.readInt32();
Svet Ganovbe71aa22015-04-28 12:06:02 -07001304 const String16 opPackageName = data.readString16();
Eric Laurentb6436272016-12-07 19:24:50 -08001305 pid_t pid = (pid_t)data.readInt32();
1306
Wei Jia983dca32015-09-10 09:47:29 -07001307 status_t status = NO_ERROR;
1308 int id = 0;
1309 int enabled = 0;
Eric Laurent05bca2f2010-02-26 02:47:27 -08001310
Glenn Kasten8d6cc842012-02-03 11:06:53 -08001311 sp<IEffect> effect = createEffect(&desc, client, priority, output, sessionId,
Eric Laurentb6436272016-12-07 19:24:50 -08001312 opPackageName, pid, &status, &id, &enabled);
Eric Laurentbe916aa2010-06-01 23:49:17 -07001313 reply->writeInt32(status);
1314 reply->writeInt32(id);
1315 reply->writeInt32(enabled);
Marco Nelissen06b46062014-11-14 07:58:25 -08001316 reply->writeStrongBinder(IInterface::asBinder(effect));
Eric Laurentbe916aa2010-06-01 23:49:17 -07001317 reply->write(&desc, sizeof(effect_descriptor_t));
1318 return NO_ERROR;
1319 } break;
Eric Laurentde070132010-07-13 04:45:46 -07001320 case MOVE_EFFECTS: {
1321 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kastend848eb42016-03-08 13:42:11 -08001322 audio_session_t session = (audio_session_t) data.readInt32();
Glenn Kasten72ef00d2012-01-17 11:09:42 -08001323 audio_io_handle_t srcOutput = (audio_io_handle_t) data.readInt32();
1324 audio_io_handle_t dstOutput = (audio_io_handle_t) data.readInt32();
Eric Laurentde070132010-07-13 04:45:46 -07001325 reply->writeInt32(moveEffects(session, srcOutput, dstOutput));
1326 return NO_ERROR;
1327 } break;
Eric Laurenta4c5a552012-03-29 10:12:40 -07001328 case LOAD_HW_MODULE: {
1329 CHECK_INTERFACE(IAudioFlinger, data, reply);
1330 reply->writeInt32(loadHwModule(data.readCString()));
1331 return NO_ERROR;
1332 } break;
Glenn Kastencc0f1cf2012-09-24 11:27:18 -07001333 case GET_PRIMARY_OUTPUT_SAMPLING_RATE: {
1334 CHECK_INTERFACE(IAudioFlinger, data, reply);
1335 reply->writeInt32(getPrimaryOutputSamplingRate());
1336 return NO_ERROR;
1337 } break;
1338 case GET_PRIMARY_OUTPUT_FRAME_COUNT: {
1339 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kastene03dd222014-01-28 11:04:39 -08001340 reply->writeInt64(getPrimaryOutputFrameCount());
Glenn Kastencc0f1cf2012-09-24 11:27:18 -07001341 return NO_ERROR;
1342 } break;
Glenn Kasten4182c4e2013-07-15 14:45:07 -07001343 case SET_LOW_RAM_DEVICE: {
1344 CHECK_INTERFACE(IAudioFlinger, data, reply);
1345 bool isLowRamDevice = data.readInt32() != 0;
1346 reply->writeInt32(setLowRamDevice(isLowRamDevice));
1347 return NO_ERROR;
1348 } break;
Eric Laurent4b123402014-04-11 09:22:20 -07001349 case LIST_AUDIO_PORTS: {
1350 CHECK_INTERFACE(IAudioFlinger, data, reply);
Eric Laurentf75c2fe2015-04-02 13:49:15 -07001351 unsigned int numPortsReq = data.readInt32();
1352 if (numPortsReq > MAX_ITEMS_PER_LIST) {
1353 numPortsReq = MAX_ITEMS_PER_LIST;
1354 }
1355 unsigned int numPorts = numPortsReq;
Eric Laurent4b123402014-04-11 09:22:20 -07001356 struct audio_port *ports =
Eric Laurentf75c2fe2015-04-02 13:49:15 -07001357 (struct audio_port *)calloc(numPortsReq,
Eric Laurent4b123402014-04-11 09:22:20 -07001358 sizeof(struct audio_port));
Eric Laurentf75c2fe2015-04-02 13:49:15 -07001359 if (ports == NULL) {
1360 reply->writeInt32(NO_MEMORY);
1361 reply->writeInt32(0);
1362 return NO_ERROR;
1363 }
1364 status_t status = listAudioPorts(&numPorts, ports);
Eric Laurent4b123402014-04-11 09:22:20 -07001365 reply->writeInt32(status);
Eric Laurentf75c2fe2015-04-02 13:49:15 -07001366 reply->writeInt32(numPorts);
Eric Laurent4b123402014-04-11 09:22:20 -07001367 if (status == NO_ERROR) {
Eric Laurentf75c2fe2015-04-02 13:49:15 -07001368 if (numPortsReq > numPorts) {
1369 numPortsReq = numPorts;
1370 }
1371 reply->write(ports, numPortsReq * sizeof(struct audio_port));
Eric Laurent4b123402014-04-11 09:22:20 -07001372 }
1373 free(ports);
1374 return NO_ERROR;
1375 } break;
1376 case GET_AUDIO_PORT: {
1377 CHECK_INTERFACE(IAudioFlinger, data, reply);
Wei Jiae995e472015-09-09 09:48:34 -07001378 struct audio_port port = {};
1379 if (data.read(&port, sizeof(struct audio_port)) != NO_ERROR) {
1380 ALOGE("b/23905951");
1381 }
Eric Laurent4b123402014-04-11 09:22:20 -07001382 status_t status = getAudioPort(&port);
1383 reply->writeInt32(status);
1384 if (status == NO_ERROR) {
1385 reply->write(&port, sizeof(struct audio_port));
1386 }
1387 return NO_ERROR;
1388 } break;
1389 case CREATE_AUDIO_PATCH: {
1390 CHECK_INTERFACE(IAudioFlinger, data, reply);
1391 struct audio_patch patch;
1392 data.read(&patch, sizeof(struct audio_patch));
Glenn Kastena13cde92016-03-28 15:26:02 -07001393 audio_patch_handle_t handle = AUDIO_PATCH_HANDLE_NONE;
Wei Jiae995e472015-09-09 09:48:34 -07001394 if (data.read(&handle, sizeof(audio_patch_handle_t)) != NO_ERROR) {
1395 ALOGE("b/23905951");
1396 }
Eric Laurent4b123402014-04-11 09:22:20 -07001397 status_t status = createAudioPatch(&patch, &handle);
1398 reply->writeInt32(status);
1399 if (status == NO_ERROR) {
1400 reply->write(&handle, sizeof(audio_patch_handle_t));
1401 }
1402 return NO_ERROR;
1403 } break;
1404 case RELEASE_AUDIO_PATCH: {
1405 CHECK_INTERFACE(IAudioFlinger, data, reply);
1406 audio_patch_handle_t handle;
1407 data.read(&handle, sizeof(audio_patch_handle_t));
1408 status_t status = releaseAudioPatch(handle);
1409 reply->writeInt32(status);
1410 return NO_ERROR;
1411 } break;
1412 case LIST_AUDIO_PATCHES: {
1413 CHECK_INTERFACE(IAudioFlinger, data, reply);
Eric Laurentf75c2fe2015-04-02 13:49:15 -07001414 unsigned int numPatchesReq = data.readInt32();
1415 if (numPatchesReq > MAX_ITEMS_PER_LIST) {
1416 numPatchesReq = MAX_ITEMS_PER_LIST;
1417 }
1418 unsigned int numPatches = numPatchesReq;
Eric Laurent4b123402014-04-11 09:22:20 -07001419 struct audio_patch *patches =
Eric Laurentf75c2fe2015-04-02 13:49:15 -07001420 (struct audio_patch *)calloc(numPatchesReq,
Eric Laurent4b123402014-04-11 09:22:20 -07001421 sizeof(struct audio_patch));
Eric Laurentf75c2fe2015-04-02 13:49:15 -07001422 if (patches == NULL) {
1423 reply->writeInt32(NO_MEMORY);
1424 reply->writeInt32(0);
1425 return NO_ERROR;
1426 }
1427 status_t status = listAudioPatches(&numPatches, patches);
Eric Laurent4b123402014-04-11 09:22:20 -07001428 reply->writeInt32(status);
Eric Laurentf75c2fe2015-04-02 13:49:15 -07001429 reply->writeInt32(numPatches);
Eric Laurent4b123402014-04-11 09:22:20 -07001430 if (status == NO_ERROR) {
Eric Laurentf75c2fe2015-04-02 13:49:15 -07001431 if (numPatchesReq > numPatches) {
1432 numPatchesReq = numPatches;
1433 }
1434 reply->write(patches, numPatchesReq * sizeof(struct audio_patch));
Eric Laurent4b123402014-04-11 09:22:20 -07001435 }
1436 free(patches);
1437 return NO_ERROR;
1438 } break;
1439 case SET_AUDIO_PORT_CONFIG: {
1440 CHECK_INTERFACE(IAudioFlinger, data, reply);
1441 struct audio_port_config config;
1442 data.read(&config, sizeof(struct audio_port_config));
1443 status_t status = setAudioPortConfig(&config);
1444 reply->writeInt32(status);
1445 return NO_ERROR;
1446 } break;
Eric Laurent93c3d412014-08-01 14:48:35 -07001447 case GET_AUDIO_HW_SYNC: {
1448 CHECK_INTERFACE(IAudioFlinger, data, reply);
Glenn Kastend848eb42016-03-08 13:42:11 -08001449 reply->writeInt32(getAudioHwSyncForSession((audio_session_t) data.readInt32()));
Eric Laurent93c3d412014-08-01 14:48:35 -07001450 return NO_ERROR;
1451 } break;
Eric Laurent72e3f392015-05-20 14:43:50 -07001452 case SYSTEM_READY: {
1453 CHECK_INTERFACE(IAudioFlinger, data, reply);
1454 systemReady();
1455 return NO_ERROR;
1456 } break;
Glenn Kasten4a8308b2016-04-18 14:10:01 -07001457 case FRAME_COUNT_HAL: {
1458 CHECK_INTERFACE(IAudioFlinger, data, reply);
1459 reply->writeInt64( frameCountHAL((audio_io_handle_t) data.readInt32()) );
1460 return NO_ERROR;
1461 } break;
The Android Open Source Project89fa4ad2009-03-03 19:31:44 -08001462 default:
1463 return BBinder::onTransact(code, data, reply, flags);
1464 }
1465}
1466
1467// ----------------------------------------------------------------------------
1468
Glenn Kasten40bc9062015-03-20 09:09:33 -07001469} // namespace android