blob: 334844169a8671c6a4a2b4456148ae2c240127c8 [file] [log] [blame]
Eric Laurentc2f1f072009-07-17 12:17:14 -07001/*
2**
3** Copyright 2009, The Android Open Source Project
4**
5** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
8**
9** http://www.apache.org/licenses/LICENSE-2.0
10**
11** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
15** limitations under the License.
16*/
17
18#define LOG_TAG "IAudioPolicyService"
19#include <utils/Log.h>
20
21#include <stdint.h>
22#include <sys/types.h>
23
24#include <binder/Parcel.h>
25
Eric Laurent74adca92014-11-05 12:15:36 -080026#include <media/AudioEffect.h>
Eric Laurentc2f1f072009-07-17 12:17:14 -070027#include <media/IAudioPolicyService.h>
28
Dima Zavin64760242011-05-11 14:15:23 -070029#include <system/audio.h>
Dima Zavinfce7a472011-04-19 22:30:36 -070030
Eric Laurentc2f1f072009-07-17 12:17:14 -070031namespace android {
32
33enum {
34 SET_DEVICE_CONNECTION_STATE = IBinder::FIRST_CALL_TRANSACTION,
35 GET_DEVICE_CONNECTION_STATE,
36 SET_PHONE_STATE,
Glenn Kasten0b07b802012-01-18 14:56:06 -080037 SET_RINGER_MODE, // reserved, no longer used
Eric Laurentc2f1f072009-07-17 12:17:14 -070038 SET_FORCE_USE,
39 GET_FORCE_USE,
40 GET_OUTPUT,
41 START_OUTPUT,
42 STOP_OUTPUT,
43 RELEASE_OUTPUT,
Eric Laurentcaf7f482014-11-25 17:50:47 -080044 GET_INPUT_FOR_ATTR,
Eric Laurentc2f1f072009-07-17 12:17:14 -070045 START_INPUT,
46 STOP_INPUT,
47 RELEASE_INPUT,
48 INIT_STREAM_VOLUME,
49 SET_STREAM_VOLUME,
Eric Laurentde070132010-07-13 04:45:46 -070050 GET_STREAM_VOLUME,
51 GET_STRATEGY_FOR_STREAM,
52 GET_OUTPUT_FOR_EFFECT,
53 REGISTER_EFFECT,
Eric Laurenteda6c362011-02-02 09:33:30 -080054 UNREGISTER_EFFECT,
Glenn Kasten6b2718c2011-02-04 13:54:26 -080055 IS_STREAM_ACTIVE,
Jean-Michel Trivid7086032012-10-10 12:11:16 -070056 IS_SOURCE_ACTIVE,
Glenn Kasten6b2718c2011-02-04 13:54:26 -080057 GET_DEVICES_FOR_STREAM,
Eric Laurentdb7c0792011-08-10 10:37:50 -070058 QUERY_DEFAULT_PRE_PROCESSING,
Jean-Michel Trivi272ab542013-02-04 16:26:02 -080059 SET_EFFECT_ENABLED,
Richard Fitzgeraldad3af332013-03-25 16:54:37 +000060 IS_STREAM_ACTIVE_REMOTELY,
Eric Laurent203b1a12014-04-01 10:34:16 -070061 IS_OFFLOAD_SUPPORTED,
62 LIST_AUDIO_PORTS,
63 GET_AUDIO_PORT,
64 CREATE_AUDIO_PATCH,
65 RELEASE_AUDIO_PATCH,
66 LIST_AUDIO_PATCHES,
Eric Laurentb52c1522014-05-20 11:27:36 -070067 SET_AUDIO_PORT_CONFIG,
Jean-Michel Trivi5bd3f382014-06-13 16:06:54 -070068 REGISTER_CLIENT,
Eric Laurentdf3dc7e2014-07-27 18:39:40 -070069 GET_OUTPUT_FOR_ATTR,
70 ACQUIRE_SOUNDTRIGGER_SESSION,
Eric Laurentbb6c9a02014-09-25 14:11:47 -070071 RELEASE_SOUNDTRIGGER_SESSION,
Eric Laurentbaac1832014-12-01 17:52:59 -080072 GET_PHONE_STATE,
73 REGISTER_POLICY_MIXES,
Eric Laurent554a2772015-04-10 11:29:24 -070074 START_AUDIO_SOURCE,
Eric Laurente8726fe2015-06-26 09:39:24 -070075 STOP_AUDIO_SOURCE,
76 SET_AUDIO_PORT_CALLBACK_ENABLED,
Eric Laurentc2f1f072009-07-17 12:17:14 -070077};
78
Eric Laurent1d670b12015-02-06 10:44:24 -080079#define MAX_ITEMS_PER_LIST 1024
80
Eric Laurentc2f1f072009-07-17 12:17:14 -070081class BpAudioPolicyService : public BpInterface<IAudioPolicyService>
82{
83public:
84 BpAudioPolicyService(const sp<IBinder>& impl)
85 : BpInterface<IAudioPolicyService>(impl)
86 {
87 }
88
89 virtual status_t setDeviceConnectionState(
Dima Zavinfce7a472011-04-19 22:30:36 -070090 audio_devices_t device,
91 audio_policy_dev_state_t state,
Paul McLeane743a472015-01-28 11:07:31 -080092 const char *device_address,
93 const char *device_name)
Eric Laurentc2f1f072009-07-17 12:17:14 -070094 {
95 Parcel data, reply;
96 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
97 data.writeInt32(static_cast <uint32_t>(device));
98 data.writeInt32(static_cast <uint32_t>(state));
99 data.writeCString(device_address);
Paul McLeane743a472015-01-28 11:07:31 -0800100 data.writeCString(device_name);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700101 remote()->transact(SET_DEVICE_CONNECTION_STATE, data, &reply);
102 return static_cast <status_t> (reply.readInt32());
103 }
104
Dima Zavinfce7a472011-04-19 22:30:36 -0700105 virtual audio_policy_dev_state_t getDeviceConnectionState(
106 audio_devices_t device,
Eric Laurentc2f1f072009-07-17 12:17:14 -0700107 const char *device_address)
108 {
109 Parcel data, reply;
110 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
111 data.writeInt32(static_cast <uint32_t>(device));
112 data.writeCString(device_address);
113 remote()->transact(GET_DEVICE_CONNECTION_STATE, data, &reply);
Dima Zavinfce7a472011-04-19 22:30:36 -0700114 return static_cast <audio_policy_dev_state_t>(reply.readInt32());
Eric Laurentc2f1f072009-07-17 12:17:14 -0700115 }
116
Glenn Kastenf78aee72012-01-04 11:00:47 -0800117 virtual status_t setPhoneState(audio_mode_t state)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700118 {
119 Parcel data, reply;
120 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
121 data.writeInt32(state);
122 remote()->transact(SET_PHONE_STATE, data, &reply);
123 return static_cast <status_t> (reply.readInt32());
124 }
125
Dima Zavinfce7a472011-04-19 22:30:36 -0700126 virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700127 {
128 Parcel data, reply;
129 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
130 data.writeInt32(static_cast <uint32_t>(usage));
131 data.writeInt32(static_cast <uint32_t>(config));
132 remote()->transact(SET_FORCE_USE, data, &reply);
133 return static_cast <status_t> (reply.readInt32());
134 }
135
Dima Zavinfce7a472011-04-19 22:30:36 -0700136 virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700137 {
138 Parcel data, reply;
139 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
140 data.writeInt32(static_cast <uint32_t>(usage));
141 remote()->transact(GET_FORCE_USE, data, &reply);
Dima Zavinfce7a472011-04-19 22:30:36 -0700142 return static_cast <audio_policy_forced_cfg_t> (reply.readInt32());
Eric Laurentc2f1f072009-07-17 12:17:14 -0700143 }
144
145 virtual audio_io_handle_t getOutput(
Dima Zavinfce7a472011-04-19 22:30:36 -0700146 audio_stream_type_t stream,
Eric Laurentc2f1f072009-07-17 12:17:14 -0700147 uint32_t samplingRate,
Glenn Kasten58f30212012-01-12 12:27:51 -0800148 audio_format_t format,
Glenn Kasten254af182012-07-03 14:59:05 -0700149 audio_channel_mask_t channelMask,
Richard Fitzgeraldad3af332013-03-25 16:54:37 +0000150 audio_output_flags_t flags,
151 const audio_offload_info_t *offloadInfo)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700152 {
153 Parcel data, reply;
154 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
155 data.writeInt32(static_cast <uint32_t>(stream));
156 data.writeInt32(samplingRate);
157 data.writeInt32(static_cast <uint32_t>(format));
Glenn Kasten254af182012-07-03 14:59:05 -0700158 data.writeInt32(channelMask);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700159 data.writeInt32(static_cast <uint32_t>(flags));
Glenn Kasten2301acc2014-01-17 10:21:00 -0800160 // hasOffloadInfo
Richard Fitzgeraldb1a270d2013-05-14 12:12:21 +0100161 if (offloadInfo == NULL) {
162 data.writeInt32(0);
163 } else {
164 data.writeInt32(1);
165 data.write(offloadInfo, sizeof(audio_offload_info_t));
166 }
Eric Laurentc2f1f072009-07-17 12:17:14 -0700167 remote()->transact(GET_OUTPUT, data, &reply);
Eric Laurentfa2877b2009-07-28 08:44:33 -0700168 return static_cast <audio_io_handle_t> (reply.readInt32());
Eric Laurentc2f1f072009-07-17 12:17:14 -0700169 }
170
Eric Laurente83b55d2014-11-14 10:06:21 -0800171 virtual status_t getOutputForAttr(const audio_attributes_t *attr,
172 audio_io_handle_t *output,
173 audio_session_t session,
174 audio_stream_type_t *stream,
Eric Laurent8c7e6da2015-04-21 17:37:00 -0700175 uid_t uid,
Eric Laurente83b55d2014-11-14 10:06:21 -0800176 uint32_t samplingRate,
177 audio_format_t format,
178 audio_channel_mask_t channelMask,
179 audio_output_flags_t flags,
Paul McLeanaa981192015-03-21 09:55:15 -0700180 audio_port_handle_t selectedDeviceId,
Eric Laurente83b55d2014-11-14 10:06:21 -0800181 const audio_offload_info_t *offloadInfo)
Jean-Michel Trivi5bd3f382014-06-13 16:06:54 -0700182 {
183 Parcel data, reply;
184 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
185 if (attr == NULL) {
Eric Laurente83b55d2014-11-14 10:06:21 -0800186 if (stream == NULL) {
187 ALOGE("getOutputForAttr(): NULL audio attributes and stream type");
188 return BAD_VALUE;
189 }
190 if (*stream == AUDIO_STREAM_DEFAULT) {
191 ALOGE("getOutputForAttr unspecified stream type");
192 return BAD_VALUE;
193 }
Jean-Michel Trivi5bd3f382014-06-13 16:06:54 -0700194 }
Eric Laurente83b55d2014-11-14 10:06:21 -0800195 if (output == NULL) {
196 ALOGE("getOutputForAttr NULL output - shouldn't happen");
197 return BAD_VALUE;
198 }
199 if (attr == NULL) {
200 data.writeInt32(0);
201 } else {
202 data.writeInt32(1);
203 data.write(attr, sizeof(audio_attributes_t));
204 }
205 data.writeInt32(session);
206 if (stream == NULL) {
207 data.writeInt32(0);
208 } else {
209 data.writeInt32(1);
210 data.writeInt32(*stream);
211 }
Eric Laurent8c7e6da2015-04-21 17:37:00 -0700212 data.writeInt32(uid);
Jean-Michel Trivi5bd3f382014-06-13 16:06:54 -0700213 data.writeInt32(samplingRate);
214 data.writeInt32(static_cast <uint32_t>(format));
215 data.writeInt32(channelMask);
216 data.writeInt32(static_cast <uint32_t>(flags));
Paul McLeanaa981192015-03-21 09:55:15 -0700217 data.writeInt32(selectedDeviceId);
Jean-Michel Trivi5bd3f382014-06-13 16:06:54 -0700218 // hasOffloadInfo
219 if (offloadInfo == NULL) {
220 data.writeInt32(0);
221 } else {
222 data.writeInt32(1);
223 data.write(offloadInfo, sizeof(audio_offload_info_t));
224 }
Eric Laurente83b55d2014-11-14 10:06:21 -0800225 status_t status = remote()->transact(GET_OUTPUT_FOR_ATTR, data, &reply);
226 if (status != NO_ERROR) {
227 return status;
228 }
229 status = (status_t)reply.readInt32();
230 if (status != NO_ERROR) {
231 return status;
232 }
233 *output = (audio_io_handle_t)reply.readInt32();
234 if (stream != NULL) {
235 *stream = (audio_stream_type_t)reply.readInt32();
236 }
237 return status;
Jean-Michel Trivi5bd3f382014-06-13 16:06:54 -0700238 }
239
Eric Laurentde070132010-07-13 04:45:46 -0700240 virtual status_t startOutput(audio_io_handle_t output,
Dima Zavinfce7a472011-04-19 22:30:36 -0700241 audio_stream_type_t stream,
Eric Laurente83b55d2014-11-14 10:06:21 -0800242 audio_session_t session)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700243 {
244 Parcel data, reply;
245 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
Eric Laurentfa2877b2009-07-28 08:44:33 -0700246 data.writeInt32(output);
Glenn Kastenfff6d712012-01-12 16:38:12 -0800247 data.writeInt32((int32_t) stream);
Eric Laurente83b55d2014-11-14 10:06:21 -0800248 data.writeInt32((int32_t)session);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700249 remote()->transact(START_OUTPUT, data, &reply);
250 return static_cast <status_t> (reply.readInt32());
251 }
252
Eric Laurentde070132010-07-13 04:45:46 -0700253 virtual status_t stopOutput(audio_io_handle_t output,
Dima Zavinfce7a472011-04-19 22:30:36 -0700254 audio_stream_type_t stream,
Eric Laurente83b55d2014-11-14 10:06:21 -0800255 audio_session_t session)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700256 {
257 Parcel data, reply;
258 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
Eric Laurentfa2877b2009-07-28 08:44:33 -0700259 data.writeInt32(output);
Glenn Kastenfff6d712012-01-12 16:38:12 -0800260 data.writeInt32((int32_t) stream);
Eric Laurente83b55d2014-11-14 10:06:21 -0800261 data.writeInt32((int32_t)session);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700262 remote()->transact(STOP_OUTPUT, data, &reply);
263 return static_cast <status_t> (reply.readInt32());
264 }
265
Eric Laurente83b55d2014-11-14 10:06:21 -0800266 virtual void releaseOutput(audio_io_handle_t output,
267 audio_stream_type_t stream,
268 audio_session_t session)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700269 {
270 Parcel data, reply;
271 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
Eric Laurentfa2877b2009-07-28 08:44:33 -0700272 data.writeInt32(output);
Eric Laurente83b55d2014-11-14 10:06:21 -0800273 data.writeInt32((int32_t)stream);
274 data.writeInt32((int32_t)session);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700275 remote()->transact(RELEASE_OUTPUT, data, &reply);
276 }
277
Eric Laurentcaf7f482014-11-25 17:50:47 -0800278 virtual status_t getInputForAttr(const audio_attributes_t *attr,
279 audio_io_handle_t *input,
280 audio_session_t session,
Eric Laurent8c7e6da2015-04-21 17:37:00 -0700281 uid_t uid,
Eric Laurentcaf7f482014-11-25 17:50:47 -0800282 uint32_t samplingRate,
283 audio_format_t format,
284 audio_channel_mask_t channelMask,
Paul McLean466dc8e2015-04-17 13:15:36 -0600285 audio_input_flags_t flags,
286 audio_port_handle_t selectedDeviceId)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700287 {
288 Parcel data, reply;
289 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
Eric Laurentcaf7f482014-11-25 17:50:47 -0800290 if (attr == NULL) {
291 ALOGE("getInputForAttr NULL attr - shouldn't happen");
292 return BAD_VALUE;
293 }
294 if (input == NULL) {
295 ALOGE("getInputForAttr NULL input - shouldn't happen");
296 return BAD_VALUE;
297 }
298 data.write(attr, sizeof(audio_attributes_t));
299 data.writeInt32(session);
Eric Laurent8c7e6da2015-04-21 17:37:00 -0700300 data.writeInt32(uid);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700301 data.writeInt32(samplingRate);
302 data.writeInt32(static_cast <uint32_t>(format));
Glenn Kasten254af182012-07-03 14:59:05 -0700303 data.writeInt32(channelMask);
Glenn Kastenb3b16602014-07-16 08:36:31 -0700304 data.writeInt32(flags);
Paul McLean466dc8e2015-04-17 13:15:36 -0600305 data.writeInt32(selectedDeviceId);
Eric Laurentcaf7f482014-11-25 17:50:47 -0800306 status_t status = remote()->transact(GET_INPUT_FOR_ATTR, data, &reply);
307 if (status != NO_ERROR) {
308 return status;
309 }
310 status = reply.readInt32();
311 if (status != NO_ERROR) {
312 return status;
313 }
314 *input = (audio_io_handle_t)reply.readInt32();
315 return NO_ERROR;
Eric Laurentc2f1f072009-07-17 12:17:14 -0700316 }
317
Eric Laurent4dc68062014-07-28 17:26:49 -0700318 virtual status_t startInput(audio_io_handle_t input,
319 audio_session_t session)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700320 {
321 Parcel data, reply;
322 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
Eric Laurentfa2877b2009-07-28 08:44:33 -0700323 data.writeInt32(input);
Eric Laurent4dc68062014-07-28 17:26:49 -0700324 data.writeInt32(session);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700325 remote()->transact(START_INPUT, data, &reply);
326 return static_cast <status_t> (reply.readInt32());
327 }
328
Eric Laurent4dc68062014-07-28 17:26:49 -0700329 virtual status_t stopInput(audio_io_handle_t input,
330 audio_session_t session)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700331 {
332 Parcel data, reply;
333 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
Eric Laurentfa2877b2009-07-28 08:44:33 -0700334 data.writeInt32(input);
Eric Laurent4dc68062014-07-28 17:26:49 -0700335 data.writeInt32(session);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700336 remote()->transact(STOP_INPUT, data, &reply);
337 return static_cast <status_t> (reply.readInt32());
338 }
339
Eric Laurent4dc68062014-07-28 17:26:49 -0700340 virtual void releaseInput(audio_io_handle_t input,
341 audio_session_t session)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700342 {
343 Parcel data, reply;
344 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
Eric Laurentfa2877b2009-07-28 08:44:33 -0700345 data.writeInt32(input);
Eric Laurent4dc68062014-07-28 17:26:49 -0700346 data.writeInt32(session);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700347 remote()->transact(RELEASE_INPUT, data, &reply);
348 }
349
Dima Zavinfce7a472011-04-19 22:30:36 -0700350 virtual status_t initStreamVolume(audio_stream_type_t stream,
Eric Laurentc2f1f072009-07-17 12:17:14 -0700351 int indexMin,
352 int indexMax)
353 {
354 Parcel data, reply;
355 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
356 data.writeInt32(static_cast <uint32_t>(stream));
357 data.writeInt32(indexMin);
358 data.writeInt32(indexMax);
359 remote()->transact(INIT_STREAM_VOLUME, data, &reply);
360 return static_cast <status_t> (reply.readInt32());
361 }
362
Eric Laurent83844cc2011-11-18 16:43:31 -0800363 virtual status_t setStreamVolumeIndex(audio_stream_type_t stream,
364 int index,
365 audio_devices_t device)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700366 {
367 Parcel data, reply;
368 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
369 data.writeInt32(static_cast <uint32_t>(stream));
370 data.writeInt32(index);
Eric Laurent83844cc2011-11-18 16:43:31 -0800371 data.writeInt32(static_cast <uint32_t>(device));
Eric Laurentc2f1f072009-07-17 12:17:14 -0700372 remote()->transact(SET_STREAM_VOLUME, data, &reply);
373 return static_cast <status_t> (reply.readInt32());
374 }
375
Eric Laurent83844cc2011-11-18 16:43:31 -0800376 virtual status_t getStreamVolumeIndex(audio_stream_type_t stream,
377 int *index,
378 audio_devices_t device)
Eric Laurentc2f1f072009-07-17 12:17:14 -0700379 {
380 Parcel data, reply;
381 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
382 data.writeInt32(static_cast <uint32_t>(stream));
Eric Laurent83844cc2011-11-18 16:43:31 -0800383 data.writeInt32(static_cast <uint32_t>(device));
384
Eric Laurentc2f1f072009-07-17 12:17:14 -0700385 remote()->transact(GET_STREAM_VOLUME, data, &reply);
386 int lIndex = reply.readInt32();
387 if (index) *index = lIndex;
388 return static_cast <status_t> (reply.readInt32());
389 }
Eric Laurentde070132010-07-13 04:45:46 -0700390
Dima Zavinfce7a472011-04-19 22:30:36 -0700391 virtual uint32_t getStrategyForStream(audio_stream_type_t stream)
Eric Laurentde070132010-07-13 04:45:46 -0700392 {
393 Parcel data, reply;
394 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
395 data.writeInt32(static_cast <uint32_t>(stream));
396 remote()->transact(GET_STRATEGY_FOR_STREAM, data, &reply);
397 return reply.readInt32();
398 }
399
Eric Laurent63742522012-03-08 13:42:42 -0800400 virtual audio_devices_t getDevicesForStream(audio_stream_type_t stream)
Glenn Kasten6b2718c2011-02-04 13:54:26 -0800401 {
402 Parcel data, reply;
403 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
404 data.writeInt32(static_cast <uint32_t>(stream));
405 remote()->transact(GET_DEVICES_FOR_STREAM, data, &reply);
Eric Laurent63742522012-03-08 13:42:42 -0800406 return (audio_devices_t) reply.readInt32();
Glenn Kasten6b2718c2011-02-04 13:54:26 -0800407 }
408
Glenn Kasten58e5aa32012-06-20 14:08:14 -0700409 virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t *desc)
Eric Laurentde070132010-07-13 04:45:46 -0700410 {
411 Parcel data, reply;
412 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
413 data.write(desc, sizeof(effect_descriptor_t));
414 remote()->transact(GET_OUTPUT_FOR_EFFECT, data, &reply);
415 return static_cast <audio_io_handle_t> (reply.readInt32());
416 }
417
Glenn Kasten58e5aa32012-06-20 14:08:14 -0700418 virtual status_t registerEffect(const effect_descriptor_t *desc,
Eric Laurent7c7f10b2011-06-17 21:29:58 -0700419 audio_io_handle_t io,
Eric Laurentde070132010-07-13 04:45:46 -0700420 uint32_t strategy,
421 int session,
422 int id)
423 {
424 Parcel data, reply;
425 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
426 data.write(desc, sizeof(effect_descriptor_t));
Eric Laurent7c7f10b2011-06-17 21:29:58 -0700427 data.writeInt32(io);
Eric Laurentde070132010-07-13 04:45:46 -0700428 data.writeInt32(strategy);
429 data.writeInt32(session);
430 data.writeInt32(id);
431 remote()->transact(REGISTER_EFFECT, data, &reply);
432 return static_cast <status_t> (reply.readInt32());
433 }
434
435 virtual status_t unregisterEffect(int id)
436 {
437 Parcel data, reply;
438 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
439 data.writeInt32(id);
440 remote()->transact(UNREGISTER_EFFECT, data, &reply);
441 return static_cast <status_t> (reply.readInt32());
442 }
443
Eric Laurentdb7c0792011-08-10 10:37:50 -0700444 virtual status_t setEffectEnabled(int id, bool enabled)
445 {
446 Parcel data, reply;
447 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
448 data.writeInt32(id);
449 data.writeInt32(enabled);
450 remote()->transact(SET_EFFECT_ENABLED, data, &reply);
451 return static_cast <status_t> (reply.readInt32());
452 }
453
Glenn Kastenfff6d712012-01-12 16:38:12 -0800454 virtual bool isStreamActive(audio_stream_type_t stream, uint32_t inPastMs) const
Eric Laurenteda6c362011-02-02 09:33:30 -0800455 {
456 Parcel data, reply;
457 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
Glenn Kastenfff6d712012-01-12 16:38:12 -0800458 data.writeInt32((int32_t) stream);
Eric Laurenteda6c362011-02-02 09:33:30 -0800459 data.writeInt32(inPastMs);
460 remote()->transact(IS_STREAM_ACTIVE, data, &reply);
461 return reply.readInt32();
462 }
Eric Laurent57dae992011-07-24 13:36:09 -0700463
Jean-Michel Trivi272ab542013-02-04 16:26:02 -0800464 virtual bool isStreamActiveRemotely(audio_stream_type_t stream, uint32_t inPastMs) const
465 {
466 Parcel data, reply;
467 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
468 data.writeInt32((int32_t) stream);
469 data.writeInt32(inPastMs);
470 remote()->transact(IS_STREAM_ACTIVE_REMOTELY, data, &reply);
471 return reply.readInt32();
472 }
473
Jean-Michel Trivid7086032012-10-10 12:11:16 -0700474 virtual bool isSourceActive(audio_source_t source) const
475 {
476 Parcel data, reply;
477 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
478 data.writeInt32((int32_t) source);
479 remote()->transact(IS_SOURCE_ACTIVE, data, &reply);
480 return reply.readInt32();
481 }
482
Eric Laurent57dae992011-07-24 13:36:09 -0700483 virtual status_t queryDefaultPreProcessing(int audioSession,
484 effect_descriptor_t *descriptors,
485 uint32_t *count)
486 {
487 if (descriptors == NULL || count == NULL) {
488 return BAD_VALUE;
489 }
490 Parcel data, reply;
491 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
492 data.writeInt32(audioSession);
493 data.writeInt32(*count);
494 status_t status = remote()->transact(QUERY_DEFAULT_PRE_PROCESSING, data, &reply);
495 if (status != NO_ERROR) {
496 return status;
497 }
498 status = static_cast <status_t> (reply.readInt32());
499 uint32_t retCount = reply.readInt32();
500 if (retCount != 0) {
501 uint32_t numDesc = (retCount < *count) ? retCount : *count;
502 reply.read(descriptors, sizeof(effect_descriptor_t) * numDesc);
503 }
504 *count = retCount;
505 return status;
506 }
Richard Fitzgeraldad3af332013-03-25 16:54:37 +0000507
508 virtual bool isOffloadSupported(const audio_offload_info_t& info)
509 {
Richard Fitzgeraldb1a270d2013-05-14 12:12:21 +0100510 Parcel data, reply;
511 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
512 data.write(&info, sizeof(audio_offload_info_t));
513 remote()->transact(IS_OFFLOAD_SUPPORTED, data, &reply);
Eric Laurent203b1a12014-04-01 10:34:16 -0700514 return reply.readInt32();
515 }
516
517 virtual status_t listAudioPorts(audio_port_role_t role,
518 audio_port_type_t type,
519 unsigned int *num_ports,
520 struct audio_port *ports,
521 unsigned int *generation)
522 {
523 if (num_ports == NULL || (*num_ports != 0 && ports == NULL) ||
524 generation == NULL) {
525 return BAD_VALUE;
526 }
527 Parcel data, reply;
528 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
529 unsigned int numPortsReq = (ports == NULL) ? 0 : *num_ports;
530 data.writeInt32(role);
531 data.writeInt32(type);
532 data.writeInt32(numPortsReq);
533 status_t status = remote()->transact(LIST_AUDIO_PORTS, data, &reply);
534 if (status == NO_ERROR) {
535 status = (status_t)reply.readInt32();
536 *num_ports = (unsigned int)reply.readInt32();
537 }
Eric Laurent203b1a12014-04-01 10:34:16 -0700538 if (status == NO_ERROR) {
539 if (numPortsReq > *num_ports) {
540 numPortsReq = *num_ports;
541 }
542 if (numPortsReq > 0) {
543 reply.read(ports, numPortsReq * sizeof(struct audio_port));
544 }
545 *generation = reply.readInt32();
546 }
547 return status;
548 }
549
550 virtual status_t getAudioPort(struct audio_port *port)
551 {
552 if (port == NULL) {
553 return BAD_VALUE;
554 }
555 Parcel data, reply;
556 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
557 data.write(port, sizeof(struct audio_port));
558 status_t status = remote()->transact(GET_AUDIO_PORT, data, &reply);
559 if (status != NO_ERROR ||
560 (status = (status_t)reply.readInt32()) != NO_ERROR) {
561 return status;
562 }
563 reply.read(port, sizeof(struct audio_port));
564 return status;
565 }
566
567 virtual status_t createAudioPatch(const struct audio_patch *patch,
568 audio_patch_handle_t *handle)
569 {
570 if (patch == NULL || handle == NULL) {
571 return BAD_VALUE;
572 }
573 Parcel data, reply;
574 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
575 data.write(patch, sizeof(struct audio_patch));
576 data.write(handle, sizeof(audio_patch_handle_t));
577 status_t status = remote()->transact(CREATE_AUDIO_PATCH, data, &reply);
578 if (status != NO_ERROR ||
579 (status = (status_t)reply.readInt32()) != NO_ERROR) {
580 return status;
581 }
582 reply.read(handle, sizeof(audio_patch_handle_t));
583 return status;
584 }
585
586 virtual status_t releaseAudioPatch(audio_patch_handle_t handle)
587 {
588 Parcel data, reply;
589 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
590 data.write(&handle, sizeof(audio_patch_handle_t));
591 status_t status = remote()->transact(RELEASE_AUDIO_PATCH, data, &reply);
592 if (status != NO_ERROR) {
593 status = (status_t)reply.readInt32();
594 }
595 return status;
596 }
597
598 virtual status_t listAudioPatches(unsigned int *num_patches,
599 struct audio_patch *patches,
600 unsigned int *generation)
601 {
602 if (num_patches == NULL || (*num_patches != 0 && patches == NULL) ||
603 generation == NULL) {
604 return BAD_VALUE;
605 }
606 Parcel data, reply;
607 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
608 unsigned int numPatchesReq = (patches == NULL) ? 0 : *num_patches;
609 data.writeInt32(numPatchesReq);
610 status_t status = remote()->transact(LIST_AUDIO_PATCHES, data, &reply);
611 if (status == NO_ERROR) {
612 status = (status_t)reply.readInt32();
613 *num_patches = (unsigned int)reply.readInt32();
614 }
615 if (status == NO_ERROR) {
616 if (numPatchesReq > *num_patches) {
617 numPatchesReq = *num_patches;
618 }
619 if (numPatchesReq > 0) {
620 reply.read(patches, numPatchesReq * sizeof(struct audio_patch));
621 }
622 *generation = reply.readInt32();
623 }
624 return status;
625 }
626
627 virtual status_t setAudioPortConfig(const struct audio_port_config *config)
628 {
629 if (config == NULL) {
630 return BAD_VALUE;
631 }
632 Parcel data, reply;
633 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
634 data.write(config, sizeof(struct audio_port_config));
635 status_t status = remote()->transact(SET_AUDIO_PORT_CONFIG, data, &reply);
636 if (status != NO_ERROR) {
637 status = (status_t)reply.readInt32();
638 }
639 return status;
640 }
Eric Laurentdf3dc7e2014-07-27 18:39:40 -0700641
Eric Laurentb52c1522014-05-20 11:27:36 -0700642 virtual void registerClient(const sp<IAudioPolicyServiceClient>& client)
643 {
644 Parcel data, reply;
645 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
Marco Nelissenf8880202014-11-14 07:58:25 -0800646 data.writeStrongBinder(IInterface::asBinder(client));
Eric Laurentb52c1522014-05-20 11:27:36 -0700647 remote()->transact(REGISTER_CLIENT, data, &reply);
648 }
Eric Laurentdf3dc7e2014-07-27 18:39:40 -0700649
Eric Laurente8726fe2015-06-26 09:39:24 -0700650 virtual void setAudioPortCallbacksEnabled(bool enabled)
651 {
652 Parcel data, reply;
653 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
654 data.writeInt32(enabled ? 1 : 0);
655 remote()->transact(SET_AUDIO_PORT_CALLBACK_ENABLED, data, &reply);
656 }
657
Eric Laurentdf3dc7e2014-07-27 18:39:40 -0700658 virtual status_t acquireSoundTriggerSession(audio_session_t *session,
659 audio_io_handle_t *ioHandle,
660 audio_devices_t *device)
661 {
662 if (session == NULL || ioHandle == NULL || device == NULL) {
663 return BAD_VALUE;
664 }
665 Parcel data, reply;
666 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
667 status_t status = remote()->transact(ACQUIRE_SOUNDTRIGGER_SESSION, data, &reply);
668 if (status != NO_ERROR) {
669 return status;
670 }
671 status = (status_t)reply.readInt32();
672 if (status == NO_ERROR) {
673 *session = (audio_session_t)reply.readInt32();
674 *ioHandle = (audio_io_handle_t)reply.readInt32();
675 *device = (audio_devices_t)reply.readInt32();
676 }
677 return status;
678 }
679
680 virtual status_t releaseSoundTriggerSession(audio_session_t session)
681 {
682 Parcel data, reply;
683 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
684 data.writeInt32(session);
685 status_t status = remote()->transact(RELEASE_SOUNDTRIGGER_SESSION, data, &reply);
686 if (status != NO_ERROR) {
687 return status;
688 }
689 return (status_t)reply.readInt32();
690 }
Eric Laurentbb6c9a02014-09-25 14:11:47 -0700691
692 virtual audio_mode_t getPhoneState()
693 {
694 Parcel data, reply;
695 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
696 status_t status = remote()->transact(GET_PHONE_STATE, data, &reply);
697 if (status != NO_ERROR) {
698 return AUDIO_MODE_INVALID;
699 }
700 return (audio_mode_t)reply.readInt32();
701 }
Eric Laurentbaac1832014-12-01 17:52:59 -0800702
703 virtual status_t registerPolicyMixes(Vector<AudioMix> mixes, bool registration)
704 {
705 Parcel data, reply;
706 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
707 data.writeInt32(registration ? 1 : 0);
708 size_t size = mixes.size();
709 if (size > MAX_MIXES_PER_POLICY) {
710 size = MAX_MIXES_PER_POLICY;
711 }
712 size_t sizePosition = data.dataPosition();
713 data.writeInt32(size);
714 size_t finalSize = size;
715 for (size_t i = 0; i < size; i++) {
716 size_t position = data.dataPosition();
717 if (mixes[i].writeToParcel(&data) != NO_ERROR) {
718 data.setDataPosition(position);
719 finalSize--;
720 }
721 }
722 if (size != finalSize) {
723 size_t position = data.dataPosition();
724 data.setDataPosition(sizePosition);
725 data.writeInt32(finalSize);
726 data.setDataPosition(position);
727 }
728 status_t status = remote()->transact(REGISTER_POLICY_MIXES, data, &reply);
729 if (status == NO_ERROR) {
730 status = (status_t)reply.readInt32();
731 }
732 return status;
733 }
Eric Laurent554a2772015-04-10 11:29:24 -0700734
735 virtual status_t startAudioSource(const struct audio_port_config *source,
736 const audio_attributes_t *attributes,
737 audio_io_handle_t *handle)
738 {
739 Parcel data, reply;
740 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
741 if (source == NULL || attributes == NULL || handle == NULL) {
742 return BAD_VALUE;
743 }
744 data.write(source, sizeof(struct audio_port_config));
745 data.write(attributes, sizeof(audio_attributes_t));
746 status_t status = remote()->transact(START_AUDIO_SOURCE, data, &reply);
747 if (status != NO_ERROR) {
748 return status;
749 }
750 status = (status_t)reply.readInt32();
751 if (status != NO_ERROR) {
752 return status;
753 }
754 *handle = (audio_io_handle_t)reply.readInt32();
755 return status;
756 }
757
758 virtual status_t stopAudioSource(audio_io_handle_t handle)
759 {
760 Parcel data, reply;
761 data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor());
762 data.writeInt32(handle);
763 status_t status = remote()->transact(STOP_AUDIO_SOURCE, data, &reply);
764 if (status != NO_ERROR) {
765 return status;
766 }
767 status = (status_t)reply.readInt32();
768 return status;
769 }
Eric Laurentc2f1f072009-07-17 12:17:14 -0700770};
771
772IMPLEMENT_META_INTERFACE(AudioPolicyService, "android.media.IAudioPolicyService");
773
774// ----------------------------------------------------------------------
775
776
777status_t BnAudioPolicyService::onTransact(
778 uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
779{
Glenn Kastene53b9ea2012-03-12 16:29:55 -0700780 switch (code) {
Eric Laurentc2f1f072009-07-17 12:17:14 -0700781 case SET_DEVICE_CONNECTION_STATE: {
782 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Dima Zavinfce7a472011-04-19 22:30:36 -0700783 audio_devices_t device =
784 static_cast <audio_devices_t>(data.readInt32());
785 audio_policy_dev_state_t state =
786 static_cast <audio_policy_dev_state_t>(data.readInt32());
Eric Laurentc2f1f072009-07-17 12:17:14 -0700787 const char *device_address = data.readCString();
Paul McLeane743a472015-01-28 11:07:31 -0800788 const char *device_name = data.readCString();
Eric Laurentde070132010-07-13 04:45:46 -0700789 reply->writeInt32(static_cast<uint32_t> (setDeviceConnectionState(device,
790 state,
Paul McLeane743a472015-01-28 11:07:31 -0800791 device_address,
792 device_name)));
Eric Laurentc2f1f072009-07-17 12:17:14 -0700793 return NO_ERROR;
794 } break;
795
796 case GET_DEVICE_CONNECTION_STATE: {
797 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Dima Zavinfce7a472011-04-19 22:30:36 -0700798 audio_devices_t device =
799 static_cast<audio_devices_t> (data.readInt32());
Eric Laurentc2f1f072009-07-17 12:17:14 -0700800 const char *device_address = data.readCString();
Eric Laurentde070132010-07-13 04:45:46 -0700801 reply->writeInt32(static_cast<uint32_t> (getDeviceConnectionState(device,
802 device_address)));
Eric Laurentc2f1f072009-07-17 12:17:14 -0700803 return NO_ERROR;
804 } break;
805
806 case SET_PHONE_STATE: {
807 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Glenn Kasten85ab62c2012-11-01 11:11:38 -0700808 reply->writeInt32(static_cast <uint32_t>(setPhoneState(
809 (audio_mode_t) data.readInt32())));
Eric Laurentc2f1f072009-07-17 12:17:14 -0700810 return NO_ERROR;
811 } break;
812
Eric Laurentc2f1f072009-07-17 12:17:14 -0700813 case SET_FORCE_USE: {
814 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Glenn Kasten85ab62c2012-11-01 11:11:38 -0700815 audio_policy_force_use_t usage = static_cast <audio_policy_force_use_t>(
816 data.readInt32());
Dima Zavinfce7a472011-04-19 22:30:36 -0700817 audio_policy_forced_cfg_t config =
818 static_cast <audio_policy_forced_cfg_t>(data.readInt32());
Eric Laurentc2f1f072009-07-17 12:17:14 -0700819 reply->writeInt32(static_cast <uint32_t>(setForceUse(usage, config)));
820 return NO_ERROR;
821 } break;
822
823 case GET_FORCE_USE: {
824 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Glenn Kasten85ab62c2012-11-01 11:11:38 -0700825 audio_policy_force_use_t usage = static_cast <audio_policy_force_use_t>(
826 data.readInt32());
Eric Laurentc2f1f072009-07-17 12:17:14 -0700827 reply->writeInt32(static_cast <uint32_t>(getForceUse(usage)));
828 return NO_ERROR;
829 } break;
830
831 case GET_OUTPUT: {
832 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Dima Zavinfce7a472011-04-19 22:30:36 -0700833 audio_stream_type_t stream =
834 static_cast <audio_stream_type_t>(data.readInt32());
Eric Laurentc2f1f072009-07-17 12:17:14 -0700835 uint32_t samplingRate = data.readInt32();
Glenn Kasten58f30212012-01-12 12:27:51 -0800836 audio_format_t format = (audio_format_t) data.readInt32();
Glenn Kasten254af182012-07-03 14:59:05 -0700837 audio_channel_mask_t channelMask = data.readInt32();
Eric Laurent0ca3cf92012-04-18 09:24:29 -0700838 audio_output_flags_t flags =
839 static_cast <audio_output_flags_t>(data.readInt32());
Richard Fitzgeraldb1a270d2013-05-14 12:12:21 +0100840 bool hasOffloadInfo = data.readInt32() != 0;
841 audio_offload_info_t offloadInfo;
842 if (hasOffloadInfo) {
843 data.read(&offloadInfo, sizeof(audio_offload_info_t));
844 }
Eric Laurentc2f1f072009-07-17 12:17:14 -0700845 audio_io_handle_t output = getOutput(stream,
846 samplingRate,
847 format,
Glenn Kasten254af182012-07-03 14:59:05 -0700848 channelMask,
Richard Fitzgeraldb1a270d2013-05-14 12:12:21 +0100849 flags,
850 hasOffloadInfo ? &offloadInfo : NULL);
Eric Laurentfa2877b2009-07-28 08:44:33 -0700851 reply->writeInt32(static_cast <int>(output));
Eric Laurentc2f1f072009-07-17 12:17:14 -0700852 return NO_ERROR;
853 } break;
854
Jean-Michel Trivi5bd3f382014-06-13 16:06:54 -0700855 case GET_OUTPUT_FOR_ATTR: {
856 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Glenn Kasten85f480e2014-11-05 17:44:51 -0800857 audio_attributes_t attr;
Eric Laurente83b55d2014-11-14 10:06:21 -0800858 bool hasAttributes = data.readInt32() != 0;
859 if (hasAttributes) {
860 data.read(&attr, sizeof(audio_attributes_t));
861 }
862 audio_session_t session = (audio_session_t)data.readInt32();
863 audio_stream_type_t stream = AUDIO_STREAM_DEFAULT;
864 bool hasStream = data.readInt32() != 0;
865 if (hasStream) {
866 stream = (audio_stream_type_t)data.readInt32();
867 }
Eric Laurent8c7e6da2015-04-21 17:37:00 -0700868 uid_t uid = (uid_t)data.readInt32();
Jean-Michel Trivi5bd3f382014-06-13 16:06:54 -0700869 uint32_t samplingRate = data.readInt32();
870 audio_format_t format = (audio_format_t) data.readInt32();
871 audio_channel_mask_t channelMask = data.readInt32();
872 audio_output_flags_t flags =
873 static_cast <audio_output_flags_t>(data.readInt32());
Paul McLeanaa981192015-03-21 09:55:15 -0700874 audio_port_handle_t selectedDeviceId = data.readInt32();
Jean-Michel Trivi5bd3f382014-06-13 16:06:54 -0700875 bool hasOffloadInfo = data.readInt32() != 0;
876 audio_offload_info_t offloadInfo;
877 if (hasOffloadInfo) {
878 data.read(&offloadInfo, sizeof(audio_offload_info_t));
879 }
Eric Laurente83b55d2014-11-14 10:06:21 -0800880 audio_io_handle_t output;
881 status_t status = getOutputForAttr(hasAttributes ? &attr : NULL,
Eric Laurent8c7e6da2015-04-21 17:37:00 -0700882 &output, session, &stream, uid,
Eric Laurente83b55d2014-11-14 10:06:21 -0800883 samplingRate, format, channelMask,
Paul McLeanaa981192015-03-21 09:55:15 -0700884 flags, selectedDeviceId, hasOffloadInfo ? &offloadInfo : NULL);
Eric Laurente83b55d2014-11-14 10:06:21 -0800885 reply->writeInt32(status);
886 reply->writeInt32(output);
887 reply->writeInt32(stream);
Jean-Michel Trivi5bd3f382014-06-13 16:06:54 -0700888 return NO_ERROR;
889 } break;
890
Eric Laurentc2f1f072009-07-17 12:17:14 -0700891 case START_OUTPUT: {
892 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Eric Laurentfa2877b2009-07-28 08:44:33 -0700893 audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32());
Eric Laurentebcb2542014-03-05 18:30:08 -0800894 audio_stream_type_t stream =
895 static_cast <audio_stream_type_t>(data.readInt32());
Eric Laurente83b55d2014-11-14 10:06:21 -0800896 audio_session_t session = (audio_session_t)data.readInt32();
Eric Laurentde070132010-07-13 04:45:46 -0700897 reply->writeInt32(static_cast <uint32_t>(startOutput(output,
Eric Laurentebcb2542014-03-05 18:30:08 -0800898 stream,
Eric Laurentde070132010-07-13 04:45:46 -0700899 session)));
Eric Laurentc2f1f072009-07-17 12:17:14 -0700900 return NO_ERROR;
901 } break;
902
903 case STOP_OUTPUT: {
904 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Eric Laurentfa2877b2009-07-28 08:44:33 -0700905 audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32());
Eric Laurentebcb2542014-03-05 18:30:08 -0800906 audio_stream_type_t stream =
907 static_cast <audio_stream_type_t>(data.readInt32());
Eric Laurente83b55d2014-11-14 10:06:21 -0800908 audio_session_t session = (audio_session_t)data.readInt32();
Eric Laurentde070132010-07-13 04:45:46 -0700909 reply->writeInt32(static_cast <uint32_t>(stopOutput(output,
Eric Laurentebcb2542014-03-05 18:30:08 -0800910 stream,
Eric Laurentde070132010-07-13 04:45:46 -0700911 session)));
Eric Laurentc2f1f072009-07-17 12:17:14 -0700912 return NO_ERROR;
913 } break;
914
915 case RELEASE_OUTPUT: {
916 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Eric Laurentfa2877b2009-07-28 08:44:33 -0700917 audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32());
Eric Laurente83b55d2014-11-14 10:06:21 -0800918 audio_stream_type_t stream = (audio_stream_type_t)data.readInt32();
919 audio_session_t session = (audio_session_t)data.readInt32();
920 releaseOutput(output, stream, session);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700921 return NO_ERROR;
922 } break;
923
Eric Laurentcaf7f482014-11-25 17:50:47 -0800924 case GET_INPUT_FOR_ATTR: {
Eric Laurentc2f1f072009-07-17 12:17:14 -0700925 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Eric Laurentcaf7f482014-11-25 17:50:47 -0800926 audio_attributes_t attr;
927 data.read(&attr, sizeof(audio_attributes_t));
928 audio_session_t session = (audio_session_t)data.readInt32();
Eric Laurent8c7e6da2015-04-21 17:37:00 -0700929 uid_t uid = (uid_t)data.readInt32();
Eric Laurentc2f1f072009-07-17 12:17:14 -0700930 uint32_t samplingRate = data.readInt32();
Glenn Kasten58f30212012-01-12 12:27:51 -0800931 audio_format_t format = (audio_format_t) data.readInt32();
Glenn Kasten254af182012-07-03 14:59:05 -0700932 audio_channel_mask_t channelMask = data.readInt32();
Glenn Kastenb3b16602014-07-16 08:36:31 -0700933 audio_input_flags_t flags = (audio_input_flags_t) data.readInt32();
Paul McLean466dc8e2015-04-17 13:15:36 -0600934 audio_port_handle_t selectedDeviceId = (audio_port_handle_t) data.readInt32();
Eric Laurentcaf7f482014-11-25 17:50:47 -0800935 audio_io_handle_t input;
Eric Laurent8c7e6da2015-04-21 17:37:00 -0700936 status_t status = getInputForAttr(&attr, &input, session, uid,
Eric Laurentcaf7f482014-11-25 17:50:47 -0800937 samplingRate, format, channelMask,
Paul McLean466dc8e2015-04-17 13:15:36 -0600938 flags, selectedDeviceId);
Eric Laurentcaf7f482014-11-25 17:50:47 -0800939 reply->writeInt32(status);
940 if (status == NO_ERROR) {
941 reply->writeInt32(input);
942 }
Eric Laurentc2f1f072009-07-17 12:17:14 -0700943 return NO_ERROR;
944 } break;
945
946 case START_INPUT: {
947 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Eric Laurentfa2877b2009-07-28 08:44:33 -0700948 audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32());
Eric Laurent4dc68062014-07-28 17:26:49 -0700949 audio_session_t session = static_cast <audio_session_t>(data.readInt32());
950 reply->writeInt32(static_cast <uint32_t>(startInput(input, session)));
Eric Laurentc2f1f072009-07-17 12:17:14 -0700951 return NO_ERROR;
952 } break;
953
954 case STOP_INPUT: {
955 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Eric Laurentfa2877b2009-07-28 08:44:33 -0700956 audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32());
Eric Laurent4dc68062014-07-28 17:26:49 -0700957 audio_session_t session = static_cast <audio_session_t>(data.readInt32());
958 reply->writeInt32(static_cast <uint32_t>(stopInput(input, session)));
Eric Laurentc2f1f072009-07-17 12:17:14 -0700959 return NO_ERROR;
960 } break;
961
962 case RELEASE_INPUT: {
963 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Eric Laurentfa2877b2009-07-28 08:44:33 -0700964 audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32());
Eric Laurent4dc68062014-07-28 17:26:49 -0700965 audio_session_t session = static_cast <audio_session_t>(data.readInt32());
966 releaseInput(input, session);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700967 return NO_ERROR;
968 } break;
969
970 case INIT_STREAM_VOLUME: {
971 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Dima Zavinfce7a472011-04-19 22:30:36 -0700972 audio_stream_type_t stream =
973 static_cast <audio_stream_type_t>(data.readInt32());
Eric Laurentc2f1f072009-07-17 12:17:14 -0700974 int indexMin = data.readInt32();
975 int indexMax = data.readInt32();
976 reply->writeInt32(static_cast <uint32_t>(initStreamVolume(stream, indexMin,indexMax)));
977 return NO_ERROR;
978 } break;
979
980 case SET_STREAM_VOLUME: {
981 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Dima Zavinfce7a472011-04-19 22:30:36 -0700982 audio_stream_type_t stream =
983 static_cast <audio_stream_type_t>(data.readInt32());
Eric Laurentc2f1f072009-07-17 12:17:14 -0700984 int index = data.readInt32();
Eric Laurent83844cc2011-11-18 16:43:31 -0800985 audio_devices_t device = static_cast <audio_devices_t>(data.readInt32());
986 reply->writeInt32(static_cast <uint32_t>(setStreamVolumeIndex(stream,
987 index,
988 device)));
Eric Laurentc2f1f072009-07-17 12:17:14 -0700989 return NO_ERROR;
990 } break;
991
992 case GET_STREAM_VOLUME: {
993 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Dima Zavinfce7a472011-04-19 22:30:36 -0700994 audio_stream_type_t stream =
995 static_cast <audio_stream_type_t>(data.readInt32());
Eric Laurent83844cc2011-11-18 16:43:31 -0800996 audio_devices_t device = static_cast <audio_devices_t>(data.readInt32());
Eric Laurentc2f1f072009-07-17 12:17:14 -0700997 int index;
Eric Laurent83844cc2011-11-18 16:43:31 -0800998 status_t status = getStreamVolumeIndex(stream, &index, device);
Eric Laurentc2f1f072009-07-17 12:17:14 -0700999 reply->writeInt32(index);
1000 reply->writeInt32(static_cast <uint32_t>(status));
1001 return NO_ERROR;
1002 } break;
1003
Eric Laurentde070132010-07-13 04:45:46 -07001004 case GET_STRATEGY_FOR_STREAM: {
1005 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Dima Zavinfce7a472011-04-19 22:30:36 -07001006 audio_stream_type_t stream =
1007 static_cast <audio_stream_type_t>(data.readInt32());
Eric Laurentde070132010-07-13 04:45:46 -07001008 reply->writeInt32(getStrategyForStream(stream));
1009 return NO_ERROR;
1010 } break;
1011
Glenn Kasten6b2718c2011-02-04 13:54:26 -08001012 case GET_DEVICES_FOR_STREAM: {
1013 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Dima Zavinfce7a472011-04-19 22:30:36 -07001014 audio_stream_type_t stream =
1015 static_cast <audio_stream_type_t>(data.readInt32());
Glenn Kasten6b2718c2011-02-04 13:54:26 -08001016 reply->writeInt32(static_cast <int>(getDevicesForStream(stream)));
1017 return NO_ERROR;
1018 } break;
1019
Eric Laurentde070132010-07-13 04:45:46 -07001020 case GET_OUTPUT_FOR_EFFECT: {
1021 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1022 effect_descriptor_t desc;
1023 data.read(&desc, sizeof(effect_descriptor_t));
1024 audio_io_handle_t output = getOutputForEffect(&desc);
1025 reply->writeInt32(static_cast <int>(output));
1026 return NO_ERROR;
1027 } break;
1028
1029 case REGISTER_EFFECT: {
1030 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1031 effect_descriptor_t desc;
1032 data.read(&desc, sizeof(effect_descriptor_t));
Eric Laurent7c7f10b2011-06-17 21:29:58 -07001033 audio_io_handle_t io = data.readInt32();
Eric Laurentde070132010-07-13 04:45:46 -07001034 uint32_t strategy = data.readInt32();
1035 int session = data.readInt32();
1036 int id = data.readInt32();
1037 reply->writeInt32(static_cast <int32_t>(registerEffect(&desc,
Eric Laurent7c7f10b2011-06-17 21:29:58 -07001038 io,
Eric Laurentde070132010-07-13 04:45:46 -07001039 strategy,
1040 session,
1041 id)));
1042 return NO_ERROR;
1043 } break;
1044
1045 case UNREGISTER_EFFECT: {
1046 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1047 int id = data.readInt32();
1048 reply->writeInt32(static_cast <int32_t>(unregisterEffect(id)));
1049 return NO_ERROR;
1050 } break;
1051
Eric Laurentdb7c0792011-08-10 10:37:50 -07001052 case SET_EFFECT_ENABLED: {
1053 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1054 int id = data.readInt32();
1055 bool enabled = static_cast <bool>(data.readInt32());
1056 reply->writeInt32(static_cast <int32_t>(setEffectEnabled(id, enabled)));
1057 return NO_ERROR;
1058 } break;
1059
Eric Laurenteda6c362011-02-02 09:33:30 -08001060 case IS_STREAM_ACTIVE: {
1061 CHECK_INTERFACE(IAudioPolicyService, data, reply);
Glenn Kastenfff6d712012-01-12 16:38:12 -08001062 audio_stream_type_t stream = (audio_stream_type_t) data.readInt32();
Eric Laurenteda6c362011-02-02 09:33:30 -08001063 uint32_t inPastMs = (uint32_t)data.readInt32();
Eric Laurentebcb2542014-03-05 18:30:08 -08001064 reply->writeInt32( isStreamActive(stream, inPastMs) );
Eric Laurenteda6c362011-02-02 09:33:30 -08001065 return NO_ERROR;
1066 } break;
1067
Jean-Michel Trivi272ab542013-02-04 16:26:02 -08001068 case IS_STREAM_ACTIVE_REMOTELY: {
1069 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1070 audio_stream_type_t stream = (audio_stream_type_t) data.readInt32();
1071 uint32_t inPastMs = (uint32_t)data.readInt32();
Eric Laurentebcb2542014-03-05 18:30:08 -08001072 reply->writeInt32( isStreamActiveRemotely(stream, inPastMs) );
Jean-Michel Trivi272ab542013-02-04 16:26:02 -08001073 return NO_ERROR;
1074 } break;
1075
Jean-Michel Trivid7086032012-10-10 12:11:16 -07001076 case IS_SOURCE_ACTIVE: {
1077 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1078 audio_source_t source = (audio_source_t) data.readInt32();
1079 reply->writeInt32( isSourceActive(source));
1080 return NO_ERROR;
1081 }
1082
Eric Laurent57dae992011-07-24 13:36:09 -07001083 case QUERY_DEFAULT_PRE_PROCESSING: {
1084 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1085 int audioSession = data.readInt32();
1086 uint32_t count = data.readInt32();
Eric Laurent74adca92014-11-05 12:15:36 -08001087 if (count > AudioEffect::kMaxPreProcessing) {
1088 count = AudioEffect::kMaxPreProcessing;
1089 }
Eric Laurent57dae992011-07-24 13:36:09 -07001090 uint32_t retCount = count;
Eric Laurent74adca92014-11-05 12:15:36 -08001091 effect_descriptor_t *descriptors = new effect_descriptor_t[count];
Eric Laurent57dae992011-07-24 13:36:09 -07001092 status_t status = queryDefaultPreProcessing(audioSession, descriptors, &retCount);
1093 reply->writeInt32(status);
1094 if (status != NO_ERROR && status != NO_MEMORY) {
1095 retCount = 0;
1096 }
1097 reply->writeInt32(retCount);
Eric Laurent74adca92014-11-05 12:15:36 -08001098 if (retCount != 0) {
Eric Laurent57dae992011-07-24 13:36:09 -07001099 if (retCount < count) {
1100 count = retCount;
1101 }
1102 reply->write(descriptors, sizeof(effect_descriptor_t) * count);
1103 }
1104 delete[] descriptors;
1105 return status;
1106 }
1107
Richard Fitzgeraldb1a270d2013-05-14 12:12:21 +01001108 case IS_OFFLOAD_SUPPORTED: {
1109 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1110 audio_offload_info_t info;
1111 data.read(&info, sizeof(audio_offload_info_t));
1112 bool isSupported = isOffloadSupported(info);
1113 reply->writeInt32(isSupported);
1114 return NO_ERROR;
1115 }
1116
Eric Laurent203b1a12014-04-01 10:34:16 -07001117 case LIST_AUDIO_PORTS: {
1118 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1119 audio_port_role_t role = (audio_port_role_t)data.readInt32();
1120 audio_port_type_t type = (audio_port_type_t)data.readInt32();
1121 unsigned int numPortsReq = data.readInt32();
Eric Laurent1d670b12015-02-06 10:44:24 -08001122 if (numPortsReq > MAX_ITEMS_PER_LIST) {
1123 numPortsReq = MAX_ITEMS_PER_LIST;
1124 }
Eric Laurent203b1a12014-04-01 10:34:16 -07001125 unsigned int numPorts = numPortsReq;
Eric Laurent203b1a12014-04-01 10:34:16 -07001126 struct audio_port *ports =
1127 (struct audio_port *)calloc(numPortsReq, sizeof(struct audio_port));
Eric Laurent1d670b12015-02-06 10:44:24 -08001128 if (ports == NULL) {
1129 reply->writeInt32(NO_MEMORY);
1130 reply->writeInt32(0);
1131 return NO_ERROR;
1132 }
1133 unsigned int generation;
Eric Laurent203b1a12014-04-01 10:34:16 -07001134 status_t status = listAudioPorts(role, type, &numPorts, ports, &generation);
1135 reply->writeInt32(status);
1136 reply->writeInt32(numPorts);
Eric Laurent203b1a12014-04-01 10:34:16 -07001137
1138 if (status == NO_ERROR) {
1139 if (numPortsReq > numPorts) {
1140 numPortsReq = numPorts;
1141 }
1142 reply->write(ports, numPortsReq * sizeof(struct audio_port));
1143 reply->writeInt32(generation);
1144 }
1145 free(ports);
1146 return NO_ERROR;
1147 }
1148
1149 case GET_AUDIO_PORT: {
1150 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1151 struct audio_port port;
1152 data.read(&port, sizeof(struct audio_port));
1153 status_t status = getAudioPort(&port);
1154 reply->writeInt32(status);
1155 if (status == NO_ERROR) {
1156 reply->write(&port, sizeof(struct audio_port));
1157 }
1158 return NO_ERROR;
1159 }
1160
1161 case CREATE_AUDIO_PATCH: {
1162 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1163 struct audio_patch patch;
1164 data.read(&patch, sizeof(struct audio_patch));
1165 audio_patch_handle_t handle;
1166 data.read(&handle, sizeof(audio_patch_handle_t));
1167 status_t status = createAudioPatch(&patch, &handle);
1168 reply->writeInt32(status);
1169 if (status == NO_ERROR) {
1170 reply->write(&handle, sizeof(audio_patch_handle_t));
1171 }
1172 return NO_ERROR;
1173 }
1174
1175 case RELEASE_AUDIO_PATCH: {
1176 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1177 audio_patch_handle_t handle;
1178 data.read(&handle, sizeof(audio_patch_handle_t));
1179 status_t status = releaseAudioPatch(handle);
1180 reply->writeInt32(status);
1181 return NO_ERROR;
1182 }
1183
1184 case LIST_AUDIO_PATCHES: {
1185 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1186 unsigned int numPatchesReq = data.readInt32();
Eric Laurent1d670b12015-02-06 10:44:24 -08001187 if (numPatchesReq > MAX_ITEMS_PER_LIST) {
1188 numPatchesReq = MAX_ITEMS_PER_LIST;
1189 }
Eric Laurent203b1a12014-04-01 10:34:16 -07001190 unsigned int numPatches = numPatchesReq;
Eric Laurent203b1a12014-04-01 10:34:16 -07001191 struct audio_patch *patches =
1192 (struct audio_patch *)calloc(numPatchesReq,
1193 sizeof(struct audio_patch));
Eric Laurent1d670b12015-02-06 10:44:24 -08001194 if (patches == NULL) {
1195 reply->writeInt32(NO_MEMORY);
1196 reply->writeInt32(0);
1197 return NO_ERROR;
1198 }
1199 unsigned int generation;
Eric Laurent203b1a12014-04-01 10:34:16 -07001200 status_t status = listAudioPatches(&numPatches, patches, &generation);
1201 reply->writeInt32(status);
1202 reply->writeInt32(numPatches);
1203 if (status == NO_ERROR) {
1204 if (numPatchesReq > numPatches) {
1205 numPatchesReq = numPatches;
1206 }
1207 reply->write(patches, numPatchesReq * sizeof(struct audio_patch));
1208 reply->writeInt32(generation);
1209 }
1210 free(patches);
1211 return NO_ERROR;
1212 }
1213
1214 case SET_AUDIO_PORT_CONFIG: {
1215 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1216 struct audio_port_config config;
1217 data.read(&config, sizeof(struct audio_port_config));
1218 status_t status = setAudioPortConfig(&config);
1219 reply->writeInt32(status);
1220 return NO_ERROR;
1221 }
Eric Laurentdf3dc7e2014-07-27 18:39:40 -07001222
Eric Laurentb52c1522014-05-20 11:27:36 -07001223 case REGISTER_CLIENT: {
1224 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1225 sp<IAudioPolicyServiceClient> client = interface_cast<IAudioPolicyServiceClient>(
1226 data.readStrongBinder());
1227 registerClient(client);
1228 return NO_ERROR;
1229 } break;
Eric Laurent203b1a12014-04-01 10:34:16 -07001230
Eric Laurente8726fe2015-06-26 09:39:24 -07001231 case SET_AUDIO_PORT_CALLBACK_ENABLED: {
1232 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1233 setAudioPortCallbacksEnabled(data.readInt32() == 1);
1234 return NO_ERROR;
1235 } break;
1236
Eric Laurentdf3dc7e2014-07-27 18:39:40 -07001237 case ACQUIRE_SOUNDTRIGGER_SESSION: {
1238 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1239 sp<IAudioPolicyServiceClient> client = interface_cast<IAudioPolicyServiceClient>(
1240 data.readStrongBinder());
1241 audio_session_t session;
1242 audio_io_handle_t ioHandle;
1243 audio_devices_t device;
1244 status_t status = acquireSoundTriggerSession(&session, &ioHandle, &device);
1245 reply->writeInt32(status);
1246 if (status == NO_ERROR) {
1247 reply->writeInt32(session);
1248 reply->writeInt32(ioHandle);
1249 reply->writeInt32(device);
1250 }
1251 return NO_ERROR;
1252 } break;
1253
1254 case RELEASE_SOUNDTRIGGER_SESSION: {
1255 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1256 sp<IAudioPolicyServiceClient> client = interface_cast<IAudioPolicyServiceClient>(
1257 data.readStrongBinder());
1258 audio_session_t session = (audio_session_t)data.readInt32();
1259 status_t status = releaseSoundTriggerSession(session);
1260 reply->writeInt32(status);
1261 return NO_ERROR;
1262 } break;
1263
Eric Laurentbb6c9a02014-09-25 14:11:47 -07001264 case GET_PHONE_STATE: {
1265 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1266 reply->writeInt32((int32_t)getPhoneState());
1267 return NO_ERROR;
1268 } break;
1269
Eric Laurentbaac1832014-12-01 17:52:59 -08001270 case REGISTER_POLICY_MIXES: {
1271 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1272 bool registration = data.readInt32() == 1;
1273 Vector<AudioMix> mixes;
1274 size_t size = (size_t)data.readInt32();
1275 if (size > MAX_MIXES_PER_POLICY) {
1276 size = MAX_MIXES_PER_POLICY;
1277 }
1278 for (size_t i = 0; i < size; i++) {
1279 AudioMix mix;
1280 if (mix.readFromParcel((Parcel*)&data) == NO_ERROR) {
1281 mixes.add(mix);
1282 }
1283 }
1284 status_t status = registerPolicyMixes(mixes, registration);
1285 reply->writeInt32(status);
1286 return NO_ERROR;
1287 } break;
1288
Eric Laurent554a2772015-04-10 11:29:24 -07001289 case START_AUDIO_SOURCE: {
1290 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1291 struct audio_port_config source;
1292 data.read(&source, sizeof(struct audio_port_config));
1293 audio_attributes_t attributes;
1294 data.read(&attributes, sizeof(audio_attributes_t));
1295 audio_io_handle_t handle;
1296 status_t status = startAudioSource(&source, &attributes, &handle);
1297 reply->writeInt32(status);
1298 reply->writeInt32(handle);
1299 return NO_ERROR;
1300 } break;
1301
1302 case STOP_AUDIO_SOURCE: {
1303 CHECK_INTERFACE(IAudioPolicyService, data, reply);
1304 audio_io_handle_t handle = (audio_io_handle_t)data.readInt32();
1305 status_t status = stopAudioSource(handle);
1306 reply->writeInt32(status);
1307 return NO_ERROR;
1308 } break;
1309
Eric Laurentc2f1f072009-07-17 12:17:14 -07001310 default:
1311 return BBinder::onTransact(code, data, reply, flags);
1312 }
1313}
1314
1315// ----------------------------------------------------------------------------
1316
Glenn Kasten40bc9062015-03-20 09:09:33 -07001317} // namespace android