blob: 3d122fe34f4edf9d162328850e5f11cf4472415c [file] [log] [blame]
Eric Laurent801a1182010-06-09 00:17:29 -07001/*
2**
3** Copyright 2010, 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
19//#define LOG_NDEBUG 0
20#define LOG_TAG "AudioEffect"
21
22#include <stdint.h>
23#include <sys/types.h>
24#include <limits.h>
25
Ytai Ben-Tsvi0a4904a2021-01-06 12:57:05 -080026#include <android/media/IAudioPolicyService.h>
Eric Laurent801a1182010-06-09 00:17:29 -070027#include <binder/IPCThreadState.h>
Ytai Ben-Tsvi0a4904a2021-01-06 12:57:05 -080028#include <media/AidlConversion.h>
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -070029#include <media/AudioEffect.h>
Ytai Ben-Tsvi0a4904a2021-01-06 12:57:05 -080030#include <media/PolicyAidlConversion.h>
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -070031#include <media/ShmemCompat.h>
32#include <private/media/AudioEffectShared.h>
33#include <utils/Log.h>
Eric Laurent801a1182010-06-09 00:17:29 -070034
35namespace android {
Andy Hung1131b6e2020-12-08 20:47:45 -080036using aidl_utils::statusTFromBinderStatus;
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -070037using binder::Status;
Ytai Ben-Tsvi0a4904a2021-01-06 12:57:05 -080038using media::IAudioPolicyService;
Mikhail Naganovddceecc2021-09-03 13:58:56 -070039using media::audio::common::AudioSource;
40using media::audio::common::AudioUuid;
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -070041
42namespace {
43
44// Copy from a raw pointer + size into a vector of bytes.
45void appendToBuffer(const void* data,
46 size_t size,
47 std::vector<uint8_t>* buffer) {
48 const uint8_t* p = reinterpret_cast<const uint8_t*>(data);
49 buffer->insert(buffer->end(), p, p + size);
50}
51
52} // namespace
53
Eric Laurent801a1182010-06-09 00:17:29 -070054// ---------------------------------------------------------------------------
55
Svet Ganov33761132021-05-13 22:51:08 +000056AudioEffect::AudioEffect(const android::content::AttributionSourceState& attributionSource)
57 : mClientAttributionSource(attributionSource)
Eric Laurent801a1182010-06-09 00:17:29 -070058{
59}
60
Eric Laurent801a1182010-06-09 00:17:29 -070061status_t AudioEffect::set(const effect_uuid_t *type,
62 const effect_uuid_t *uuid,
63 int32_t priority,
Atneya Nair47156072021-12-02 19:05:52 -050064 const wp<IAudioEffectCallback>& callback,
Glenn Kastend848eb42016-03-08 13:42:11 -080065 audio_session_t sessionId,
Eric Laurent94876032019-11-13 12:45:28 -080066 audio_io_handle_t io,
Eric Laurent2fe0acd2020-03-13 14:30:46 -070067 const AudioDeviceTypeAddr& device,
Eric Laurentde8caf42021-08-11 17:19:25 +020068 bool probe,
69 bool notifyFramesProcessed)
Eric Laurent801a1182010-06-09 00:17:29 -070070{
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -070071 sp<media::IEffect> iEffect;
Eric Laurent801a1182010-06-09 00:17:29 -070072 sp<IMemory> cblk;
73 int enabled;
74
Atneya Nair47156072021-12-02 19:05:52 -050075 ALOGV("set %p uuid: %p timeLow %08x", this, type, type ? type->timeLow : 0);
Eric Laurent801a1182010-06-09 00:17:29 -070076
77 if (mIEffect != 0) {
Steve Block5ff1dd52012-01-05 23:22:43 +000078 ALOGW("Effect already in use");
Eric Laurent801a1182010-06-09 00:17:29 -070079 return INVALID_OPERATION;
80 }
81
Eric Laurent94876032019-11-13 12:45:28 -080082 if (sessionId == AUDIO_SESSION_DEVICE && io != AUDIO_IO_HANDLE_NONE) {
83 ALOGW("IO handle should not be specified for device effect");
84 return BAD_VALUE;
85 }
Eric Laurent801a1182010-06-09 00:17:29 -070086 const sp<IAudioFlinger>& audioFlinger = AudioSystem::get_audio_flinger();
87 if (audioFlinger == 0) {
Steve Block29357bc2012-01-06 19:20:56 +000088 ALOGE("set(): Could not get audioflinger");
Eric Laurent801a1182010-06-09 00:17:29 -070089 return NO_INIT;
90 }
91
92 if (type == NULL && uuid == NULL) {
Steve Block5ff1dd52012-01-05 23:22:43 +000093 ALOGW("Must specify at least type or uuid");
Eric Laurent801a1182010-06-09 00:17:29 -070094 return BAD_VALUE;
95 }
Eric Laurent2fe0acd2020-03-13 14:30:46 -070096 mProbe = probe;
Eric Laurent801a1182010-06-09 00:17:29 -070097 mPriority = priority;
Eric Laurent801a1182010-06-09 00:17:29 -070098 mSessionId = sessionId;
Atneya Nair47156072021-12-02 19:05:52 -050099 mCallback = callback;
Eric Laurent801a1182010-06-09 00:17:29 -0700100
101 memset(&mDescriptor, 0, sizeof(effect_descriptor_t));
Glenn Kastena189a682012-02-20 12:16:30 -0800102 mDescriptor.type = *(type != NULL ? type : EFFECT_UUID_NULL);
103 mDescriptor.uuid = *(uuid != NULL ? uuid : EFFECT_UUID_NULL);
Eric Laurent801a1182010-06-09 00:17:29 -0700104
Svet Ganov33761132021-05-13 22:51:08 +0000105 // TODO b/182392769: use attribution source util
Eric Laurent801a1182010-06-09 00:17:29 -0700106 mIEffectClient = new EffectClient(this);
Philip P. Moltmannbda45752020-07-17 16:41:18 -0700107 pid_t pid = IPCThreadState::self()->getCallingPid();
Svet Ganov33761132021-05-13 22:51:08 +0000108 mClientAttributionSource.pid = VALUE_OR_RETURN_STATUS(legacy2aidl_pid_t_int32_t(pid));
Philip P. Moltmannbda45752020-07-17 16:41:18 -0700109 pid_t uid = IPCThreadState::self()->getCallingUid();
Svet Ganov33761132021-05-13 22:51:08 +0000110 mClientAttributionSource.uid = VALUE_OR_RETURN_STATUS(legacy2aidl_uid_t_int32_t(uid));
Eric Laurent801a1182010-06-09 00:17:29 -0700111
Ytai Ben-Tsvice182942020-11-04 14:48:01 -0800112 media::CreateEffectRequest request;
113 request.desc = VALUE_OR_RETURN_STATUS(
114 legacy2aidl_effect_descriptor_t_EffectDescriptor(mDescriptor));
115 request.client = mIEffectClient;
116 request.priority = priority;
117 request.output = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_io_handle_t_int32_t(io));
118 request.sessionId = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_session_t_int32_t(mSessionId));
119 request.device = VALUE_OR_RETURN_STATUS(legacy2aidl_AudioDeviceTypeAddress(device));
Svet Ganov33761132021-05-13 22:51:08 +0000120 request.attributionSource = mClientAttributionSource;
Ytai Ben-Tsvice182942020-11-04 14:48:01 -0800121 request.probe = probe;
Eric Laurentde8caf42021-08-11 17:19:25 +0200122 request.notifyFramesProcessed = notifyFramesProcessed;
Ytai Ben-Tsvice182942020-11-04 14:48:01 -0800123
124 media::CreateEffectResponse response;
125
126 mStatus = audioFlinger->createEffect(request, &response);
127
128 if (mStatus == OK) {
Eric Laurent4f1d4e92022-02-01 14:37:16 +0100129 if (response.alreadyExists) {
130 mStatus = ALREADY_EXISTS;
131 }
Ytai Ben-Tsvice182942020-11-04 14:48:01 -0800132 mId = response.id;
133 enabled = response.enabled;
134 iEffect = response.effect;
135 mDescriptor = VALUE_OR_RETURN_STATUS(
136 aidl2legacy_EffectDescriptor_effect_descriptor_t(response.desc));
137 }
Eric Laurent801a1182010-06-09 00:17:29 -0700138
Eric Laurent2fe0acd2020-03-13 14:30:46 -0700139 // In probe mode, we stop here and return the status: the IEffect interface to
140 // audio flinger will not be retained. initCheck() will return the creation status
141 // but all other APIs will return invalid operation.
142 if (probe || iEffect == 0 || (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS)) {
Mikhail Naganovabd6e9d2020-03-23 22:25:56 +0000143 char typeBuffer[64] = {}, uuidBuffer[64] = {};
Mikhail Naganov424c4f52017-07-19 17:54:29 -0700144 guidToString(type, typeBuffer, sizeof(typeBuffer));
145 guidToString(uuid, uuidBuffer, sizeof(uuidBuffer));
Eric Laurent2fe0acd2020-03-13 14:30:46 -0700146 ALOGE_IF(!probe, "set(): AudioFlinger could not create effect %s / %s, status: %d",
Mikhail Naganovabd6e9d2020-03-23 22:25:56 +0000147 type != nullptr ? typeBuffer : "NULL",
148 uuid != nullptr ? uuidBuffer : "NULL",
149 mStatus);
Eric Laurent2fe0acd2020-03-13 14:30:46 -0700150 if (!probe && iEffect == 0) {
Eric Laurenteecd7652015-06-04 16:20:16 -0700151 mStatus = NO_INIT;
152 }
Eric Laurent801a1182010-06-09 00:17:29 -0700153 return mStatus;
154 }
155
156 mEnabled = (volatile int32_t)enabled;
157
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700158 if (media::SharedFileRegion shmem;
159 !iEffect->getCblk(&shmem).isOk()
160 || !convertSharedFileRegionToIMemory(shmem, &cblk)
161 || cblk == 0) {
Eric Laurent801a1182010-06-09 00:17:29 -0700162 mStatus = NO_INIT;
Steve Block29357bc2012-01-06 19:20:56 +0000163 ALOGE("Could not get control block");
Eric Laurent801a1182010-06-09 00:17:29 -0700164 return mStatus;
165 }
166
Eric Laurenteecd7652015-06-04 16:20:16 -0700167 mIEffect = iEffect;
Eric Laurent801a1182010-06-09 00:17:29 -0700168 mCblkMemory = cblk;
Ytai Ben-Tsvi7dd39722019-09-05 15:14:30 -0700169 // TODO: Using unsecurePointer() has some associated security pitfalls
170 // (see declaration for details).
171 // Either document why it is safe in this case or address the
172 // issue (e.g. by copying).
173 mCblk = static_cast<effect_param_cblk_t*>(cblk->unsecurePointer());
Eric Laurent801a1182010-06-09 00:17:29 -0700174 int bufOffset = ((sizeof(effect_param_cblk_t) - 1) / sizeof(int) + 1) * sizeof(int);
175 mCblk->buffer = (uint8_t *)mCblk + bufOffset;
176
Marco Nelissen06b46062014-11-14 07:58:25 -0800177 IInterface::asBinder(iEffect)->linkToDeath(mIEffectClient);
Jean-Michel Trivia0fd9ca2014-09-18 14:07:18 -0700178 ALOGV("set() %p OK effect: %s id: %d status %d enabled %d pid %d", this, mDescriptor.name, mId,
Svet Ganov33761132021-05-13 22:51:08 +0000179 mStatus, mEnabled, mClientAttributionSource.pid);
Jean-Michel Trivia0fd9ca2014-09-18 14:07:18 -0700180
Eric Laurent3f75a5b2019-11-12 15:55:51 -0800181 if (!audio_is_global_session(mSessionId)) {
Philip P. Moltmannbda45752020-07-17 16:41:18 -0700182 AudioSystem::acquireAudioSessionId(mSessionId, pid, uid);
Jean-Michel Trivia0fd9ca2014-09-18 14:07:18 -0700183 }
Eric Laurent801a1182010-06-09 00:17:29 -0700184
185 return mStatus;
186}
187
Atneya Nair47156072021-12-02 19:05:52 -0500188namespace {
189class LegacyCallbackWrapper : public AudioEffect::IAudioEffectCallback {
190 public:
191 LegacyCallbackWrapper(AudioEffect::legacy_callback_t callback, void* user):
192 mCallback(callback), mUser(user) {}
193 private:
194 void onControlStatusChanged(bool isGranted) override {
195 mCallback(AudioEffect::EVENT_CONTROL_STATUS_CHANGED, mUser, &isGranted);
196 }
197
198 void onEnableStatusChanged(bool isEnabled) override {
199 mCallback(AudioEffect::EVENT_ENABLE_STATUS_CHANGED, mUser, &isEnabled);
200 }
201
202 void onParameterChanged(std::vector<uint8_t> param) override {
203 mCallback(AudioEffect::EVENT_PARAMETER_CHANGED, mUser, param.data());
204 }
205
206 void onError(status_t errorCode) override {
207 mCallback(AudioEffect::EVENT_ERROR, mUser, &errorCode);
208 }
209
210 void onFramesProcessed(int32_t framesProcessed) override {
211 mCallback(AudioEffect::EVENT_FRAMES_PROCESSED, mUser, &framesProcessed);
212 }
213
214 const AudioEffect::legacy_callback_t mCallback;
215 void* const mUser;
216};
217} // namespace
218
219status_t AudioEffect::set(const effect_uuid_t *type,
220 const effect_uuid_t *uuid,
221 int32_t priority,
222 legacy_callback_t cbf,
223 void* user,
224 audio_session_t sessionId,
225 audio_io_handle_t io,
226 const AudioDeviceTypeAddr& device,
227 bool probe,
228 bool notifyFramesProcessed)
229{
230 if (cbf != nullptr) {
231 mLegacyWrapper = sp<LegacyCallbackWrapper>::make(cbf, user);
232 } else if (user != nullptr) {
233 LOG_ALWAYS_FATAL("%s: User provided without callback", __func__);
234 }
235 return set(type, uuid, priority, mLegacyWrapper, sessionId, io, device, probe,
236 notifyFramesProcessed);
237}
Mikhail Naganov416fffe2020-07-31 17:36:08 -0700238status_t AudioEffect::set(const char *typeStr,
239 const char *uuidStr,
240 int32_t priority,
Atneya Nair47156072021-12-02 19:05:52 -0500241 const wp<IAudioEffectCallback>& callback,
Mikhail Naganov416fffe2020-07-31 17:36:08 -0700242 audio_session_t sessionId,
243 audio_io_handle_t io,
244 const AudioDeviceTypeAddr& device,
Eric Laurentde8caf42021-08-11 17:19:25 +0200245 bool probe,
246 bool notifyFramesProcessed)
Mikhail Naganov416fffe2020-07-31 17:36:08 -0700247{
248 effect_uuid_t type;
249 effect_uuid_t *pType = nullptr;
250 effect_uuid_t uuid;
251 effect_uuid_t *pUuid = nullptr;
252
253 ALOGV("AudioEffect::set string\n - type: %s\n - uuid: %s",
254 typeStr ? typeStr : "nullptr", uuidStr ? uuidStr : "nullptr");
255
256 if (stringToGuid(typeStr, &type) == NO_ERROR) {
257 pType = &type;
258 }
259 if (stringToGuid(uuidStr, &uuid) == NO_ERROR) {
260 pUuid = &uuid;
261 }
262
Atneya Nair47156072021-12-02 19:05:52 -0500263 return set(pType, pUuid, priority, callback, sessionId, io,
Eric Laurentde8caf42021-08-11 17:19:25 +0200264 device, probe, notifyFramesProcessed);
Mikhail Naganov416fffe2020-07-31 17:36:08 -0700265}
266
Atneya Nair47156072021-12-02 19:05:52 -0500267status_t AudioEffect::set(const char *typeStr,
268 const char *uuidStr,
269 int32_t priority,
270 legacy_callback_t cbf,
271 void* user,
272 audio_session_t sessionId,
273 audio_io_handle_t io,
274 const AudioDeviceTypeAddr& device,
275 bool probe,
276 bool notifyFramesProcessed)
277{
278 if (cbf != nullptr) {
279 mLegacyWrapper = sp<LegacyCallbackWrapper>::make(cbf, user);
280 } else if (user != nullptr) {
281 LOG_ALWAYS_FATAL("%s: User provided without callback", __func__);
282 }
283 return set(typeStr, uuidStr, priority, mLegacyWrapper, sessionId, io, device, probe,
284 notifyFramesProcessed);
285}
Eric Laurent801a1182010-06-09 00:17:29 -0700286AudioEffect::~AudioEffect()
287{
Steve Block3856b092011-10-20 11:56:00 +0100288 ALOGV("Destructor %p", this);
Eric Laurent801a1182010-06-09 00:17:29 -0700289
Eric Laurent2fe0acd2020-03-13 14:30:46 -0700290 if (!mProbe && (mStatus == NO_ERROR || mStatus == ALREADY_EXISTS)) {
Eric Laurent3f75a5b2019-11-12 15:55:51 -0800291 if (!audio_is_global_session(mSessionId)) {
Philip P. Moltmannbda45752020-07-17 16:41:18 -0700292 AudioSystem::releaseAudioSessionId(mSessionId,
Svet Ganov33761132021-05-13 22:51:08 +0000293 VALUE_OR_FATAL(aidl2legacy_int32_t_pid_t(mClientAttributionSource.pid)));
Jean-Michel Trivia0fd9ca2014-09-18 14:07:18 -0700294 }
Eric Laurent801a1182010-06-09 00:17:29 -0700295 if (mIEffect != NULL) {
296 mIEffect->disconnect();
Marco Nelissen06b46062014-11-14 07:58:25 -0800297 IInterface::asBinder(mIEffect)->unlinkToDeath(mIEffectClient);
Eric Laurent801a1182010-06-09 00:17:29 -0700298 }
Eric Laurenteecd7652015-06-04 16:20:16 -0700299 mIEffect.clear();
300 mCblkMemory.clear();
Eric Laurent801a1182010-06-09 00:17:29 -0700301 }
Eric Laurent2fe0acd2020-03-13 14:30:46 -0700302 mIEffectClient.clear();
303 IPCThreadState::self()->flushCommands();
Eric Laurent801a1182010-06-09 00:17:29 -0700304}
305
306
307status_t AudioEffect::initCheck() const
308{
309 return mStatus;
310}
311
312// -------------------------------------------------------------------------
313
314effect_descriptor_t AudioEffect::descriptor() const
315{
316 return mDescriptor;
317}
318
Eric Laurentda7581b2010-07-02 08:12:41 -0700319bool AudioEffect::getEnabled() const
Eric Laurent801a1182010-06-09 00:17:29 -0700320{
321 return (mEnabled != 0);
322}
323
Eric Laurentda7581b2010-07-02 08:12:41 -0700324status_t AudioEffect::setEnabled(bool enabled)
Eric Laurent801a1182010-06-09 00:17:29 -0700325{
Eric Laurent2fe0acd2020-03-13 14:30:46 -0700326 if (mProbe) {
327 return INVALID_OPERATION;
328 }
Eric Laurent801a1182010-06-09 00:17:29 -0700329 if (mStatus != NO_ERROR) {
Glenn Kastenf063b492012-02-17 16:24:10 -0800330 return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus;
Eric Laurent801a1182010-06-09 00:17:29 -0700331 }
Eric Laurent801a1182010-06-09 00:17:29 -0700332
Eric Laurentf5aafb22010-11-18 08:40:16 -0800333 status_t status = NO_ERROR;
Eric Laurentf5aafb22010-11-18 08:40:16 -0800334 AutoMutex lock(mLock);
335 if (enabled != mEnabled) {
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700336 Status bs;
337
Eric Laurentf5aafb22010-11-18 08:40:16 -0800338 if (enabled) {
Steve Block3856b092011-10-20 11:56:00 +0100339 ALOGV("enable %p", this);
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700340 bs = mIEffect->enable(&status);
Eric Laurentf5aafb22010-11-18 08:40:16 -0800341 } else {
Steve Block3856b092011-10-20 11:56:00 +0100342 ALOGV("disable %p", this);
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700343 bs = mIEffect->disable(&status);
344 }
345 if (!bs.isOk()) {
Andy Hung1131b6e2020-12-08 20:47:45 -0800346 status = statusTFromBinderStatus(bs);
Eric Laurentda7581b2010-07-02 08:12:41 -0700347 }
Eric Laurentf5aafb22010-11-18 08:40:16 -0800348 if (status == NO_ERROR) {
349 mEnabled = enabled;
Eric Laurentda7581b2010-07-02 08:12:41 -0700350 }
Eric Laurent801a1182010-06-09 00:17:29 -0700351 }
Eric Laurentf5aafb22010-11-18 08:40:16 -0800352 return status;
Eric Laurent801a1182010-06-09 00:17:29 -0700353}
354
Eric Laurent25f43952010-07-28 05:40:18 -0700355status_t AudioEffect::command(uint32_t cmdCode,
356 uint32_t cmdSize,
357 void *cmdData,
358 uint32_t *replySize,
359 void *replyData)
Eric Laurent801a1182010-06-09 00:17:29 -0700360{
Eric Laurent2fe0acd2020-03-13 14:30:46 -0700361 if (mProbe) {
362 return INVALID_OPERATION;
363 }
Eric Laurent801a1182010-06-09 00:17:29 -0700364 if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) {
Steve Block3856b092011-10-20 11:56:00 +0100365 ALOGV("command() bad status %d", mStatus);
John Grossmanaf7d8182012-01-11 12:23:42 -0800366 return mStatus;
Eric Laurent801a1182010-06-09 00:17:29 -0700367 }
368
Eric Laurentf5aafb22010-11-18 08:40:16 -0800369 if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) {
370 if (mEnabled == (cmdCode == EFFECT_CMD_ENABLE)) {
371 return NO_ERROR;
372 }
373 if (replySize == NULL || *replySize != sizeof(status_t) || replyData == NULL) {
374 return BAD_VALUE;
375 }
376 mLock.lock();
Eric Laurent0fa449c2010-09-24 11:52:04 -0700377 }
378
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700379 std::vector<uint8_t> data;
380 appendToBuffer(cmdData, cmdSize, &data);
381
382 status_t status;
383 std::vector<uint8_t> response;
384
385 Status bs = mIEffect->command(cmdCode, data, *replySize, &response, &status);
386 if (!bs.isOk()) {
Andy Hung1131b6e2020-12-08 20:47:45 -0800387 status = statusTFromBinderStatus(bs);
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700388 }
389 if (status == NO_ERROR) {
390 memcpy(replyData, response.data(), response.size());
391 *replySize = response.size();
392 }
Eric Laurent0fa449c2010-09-24 11:52:04 -0700393
394 if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) {
Eric Laurentf5aafb22010-11-18 08:40:16 -0800395 if (status == NO_ERROR) {
396 status = *(status_t *)replyData;
Eric Laurent0fa449c2010-09-24 11:52:04 -0700397 }
Eric Laurentf5aafb22010-11-18 08:40:16 -0800398 if (status == NO_ERROR) {
399 mEnabled = (cmdCode == EFFECT_CMD_ENABLE);
Eric Laurent0fa449c2010-09-24 11:52:04 -0700400 }
Eric Laurentf5aafb22010-11-18 08:40:16 -0800401 mLock.unlock();
Eric Laurent8569f0d2010-07-29 23:43:43 -0700402 }
403
Eric Laurent8569f0d2010-07-29 23:43:43 -0700404 return status;
Eric Laurent801a1182010-06-09 00:17:29 -0700405}
406
Eric Laurent801a1182010-06-09 00:17:29 -0700407status_t AudioEffect::setParameter(effect_param_t *param)
408{
Eric Laurent2fe0acd2020-03-13 14:30:46 -0700409 if (mProbe) {
410 return INVALID_OPERATION;
411 }
Eric Laurent801a1182010-06-09 00:17:29 -0700412 if (mStatus != NO_ERROR) {
Glenn Kastenf063b492012-02-17 16:24:10 -0800413 return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus;
Eric Laurent801a1182010-06-09 00:17:29 -0700414 }
415
416 if (param == NULL || param->psize == 0 || param->vsize == 0) {
417 return BAD_VALUE;
418 }
419
Eric Laurent25f43952010-07-28 05:40:18 -0700420 uint32_t psize = ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize;
Eric Laurent801a1182010-06-09 00:17:29 -0700421
Glenn Kasten85ab62c2012-11-01 11:11:38 -0700422 ALOGV("setParameter: param: %d, param2: %d", *(int *)param->data,
423 (param->psize == 8) ? *((int *)param->data + 1): -1);
Eric Laurent801a1182010-06-09 00:17:29 -0700424
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700425 std::vector<uint8_t> cmd;
426 appendToBuffer(param, sizeof(effect_param_t) + psize, &cmd);
427 std::vector<uint8_t> response;
428 status_t status;
429 Status bs = mIEffect->command(EFFECT_CMD_SET_PARAM,
430 cmd,
431 sizeof(int),
432 &response,
433 &status);
434 if (!bs.isOk()) {
Andy Hung1131b6e2020-12-08 20:47:45 -0800435 status = statusTFromBinderStatus(bs);
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700436 return status;
437 }
438 assert(response.size() == sizeof(int));
439 memcpy(&param->status, response.data(), response.size());
440 return status;
Eric Laurent801a1182010-06-09 00:17:29 -0700441}
442
443status_t AudioEffect::setParameterDeferred(effect_param_t *param)
444{
Eric Laurent2fe0acd2020-03-13 14:30:46 -0700445 if (mProbe) {
446 return INVALID_OPERATION;
447 }
Eric Laurent801a1182010-06-09 00:17:29 -0700448 if (mStatus != NO_ERROR) {
Glenn Kastenf063b492012-02-17 16:24:10 -0800449 return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus;
Eric Laurent801a1182010-06-09 00:17:29 -0700450 }
451
452 if (param == NULL || param->psize == 0 || param->vsize == 0) {
453 return BAD_VALUE;
454 }
455
456 Mutex::Autolock _l(mCblk->lock);
457
458 int psize = ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize;
459 int size = ((sizeof(effect_param_t) + psize - 1) / sizeof(int) + 1) * sizeof(int);
460
461 if (mCblk->clientIndex + size > EFFECT_PARAM_BUFFER_SIZE) {
462 return NO_MEMORY;
463 }
464 int *p = (int *)(mCblk->buffer + mCblk->clientIndex);
465 *p++ = size;
466 memcpy(p, param, sizeof(effect_param_t) + psize);
467 mCblk->clientIndex += size;
468
469 return NO_ERROR;
470}
471
472status_t AudioEffect::setParameterCommit()
473{
Eric Laurent2fe0acd2020-03-13 14:30:46 -0700474 if (mProbe) {
475 return INVALID_OPERATION;
476 }
Eric Laurent801a1182010-06-09 00:17:29 -0700477 if (mStatus != NO_ERROR) {
Glenn Kastenf063b492012-02-17 16:24:10 -0800478 return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus;
Eric Laurent801a1182010-06-09 00:17:29 -0700479 }
480
481 Mutex::Autolock _l(mCblk->lock);
482 if (mCblk->clientIndex == 0) {
483 return INVALID_OPERATION;
484 }
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700485 std::vector<uint8_t> cmd;
486 std::vector<uint8_t> response;
487 status_t status;
488 Status bs = mIEffect->command(EFFECT_CMD_SET_PARAM_COMMIT,
489 cmd,
490 0,
491 &response,
492 &status);
493 if (!bs.isOk()) {
Andy Hung1131b6e2020-12-08 20:47:45 -0800494 status = statusTFromBinderStatus(bs);
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700495 }
496 return status;
Eric Laurent801a1182010-06-09 00:17:29 -0700497}
498
499status_t AudioEffect::getParameter(effect_param_t *param)
500{
Eric Laurent2fe0acd2020-03-13 14:30:46 -0700501 if (mProbe) {
502 return INVALID_OPERATION;
503 }
Eric Laurent801a1182010-06-09 00:17:29 -0700504 if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) {
John Grossmanaf7d8182012-01-11 12:23:42 -0800505 return mStatus;
Eric Laurent801a1182010-06-09 00:17:29 -0700506 }
507
508 if (param == NULL || param->psize == 0 || param->vsize == 0) {
509 return BAD_VALUE;
510 }
511
Glenn Kasten85ab62c2012-11-01 11:11:38 -0700512 ALOGV("getParameter: param: %d, param2: %d", *(int *)param->data,
513 (param->psize == 8) ? *((int *)param->data + 1): -1);
Eric Laurent801a1182010-06-09 00:17:29 -0700514
Glenn Kasten85ab62c2012-11-01 11:11:38 -0700515 uint32_t psize = sizeof(effect_param_t) + ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) +
516 param->vsize;
Eric Laurent801a1182010-06-09 00:17:29 -0700517
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700518 status_t status;
519 std::vector<uint8_t> cmd;
520 std::vector<uint8_t> response;
521 appendToBuffer(param, sizeof(effect_param_t) + param->psize, &cmd);
522
523 Status bs = mIEffect->command(EFFECT_CMD_GET_PARAM, cmd, psize, &response, &status);
524 if (!bs.isOk()) {
Andy Hung1131b6e2020-12-08 20:47:45 -0800525 status = statusTFromBinderStatus(bs);
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700526 return status;
527 }
528 memcpy(param, response.data(), response.size());
529 return status;
Eric Laurent801a1182010-06-09 00:17:29 -0700530}
531
Mikhail Naganov8d7da002022-04-19 21:21:23 +0000532status_t AudioEffect::getConfigs(
533 audio_config_base_t *inputCfg, audio_config_base_t *outputCfg)
534{
535 if (mProbe) {
536 return INVALID_OPERATION;
537 }
538 if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) {
539 return mStatus;
540 }
541 if (inputCfg == NULL || outputCfg == NULL) {
542 return BAD_VALUE;
543 }
544 status_t status;
545 media::EffectConfig cfg;
546 Status bs = mIEffect->getConfig(&cfg, &status);
547 if (!bs.isOk()) {
548 status = statusTFromBinderStatus(bs);
549 ALOGW("%s received status %d from binder transaction", __func__, status);
550 return status;
551 }
552 if (status == NO_ERROR) {
553 *inputCfg = VALUE_OR_RETURN_STATUS(aidl2legacy_AudioConfigBase_audio_config_base_t(
554 cfg.inputCfg, cfg.isOnInputStream));
555 *outputCfg = VALUE_OR_RETURN_STATUS(aidl2legacy_AudioConfigBase_audio_config_base_t(
556 cfg.outputCfg, cfg.isOnInputStream));
557 } else {
558 ALOGW("%s received status %d from the effect", __func__, status);
559 }
560 return status;
561}
Eric Laurent801a1182010-06-09 00:17:29 -0700562
563// -------------------------------------------------------------------------
564
565void AudioEffect::binderDied()
566{
Steve Block5ff1dd52012-01-05 23:22:43 +0000567 ALOGW("IEffect died");
John Grossmanaf7d8182012-01-11 12:23:42 -0800568 mStatus = DEAD_OBJECT;
Atneya Nair47156072021-12-02 19:05:52 -0500569 auto cb = mCallback.promote();
570 if (cb != nullptr) {
571 cb->onError(mStatus);
Eric Laurent801a1182010-06-09 00:17:29 -0700572 }
573 mIEffect.clear();
574}
575
576// -------------------------------------------------------------------------
577
578void AudioEffect::controlStatusChanged(bool controlGranted)
579{
Atneya Nair47156072021-12-02 19:05:52 -0500580 auto cb = mCallback.promote();
581 ALOGV("controlStatusChanged %p control %d callback %p", this, controlGranted, cb.get());
Eric Laurent801a1182010-06-09 00:17:29 -0700582 if (controlGranted) {
583 if (mStatus == ALREADY_EXISTS) {
584 mStatus = NO_ERROR;
585 }
586 } else {
587 if (mStatus == NO_ERROR) {
588 mStatus = ALREADY_EXISTS;
589 }
590 }
Atneya Nair47156072021-12-02 19:05:52 -0500591 if (cb != nullptr) {
592 cb->onControlStatusChanged(controlGranted);
Eric Laurent801a1182010-06-09 00:17:29 -0700593 }
594}
595
596void AudioEffect::enableStatusChanged(bool enabled)
597{
Atneya Nair47156072021-12-02 19:05:52 -0500598 auto cb = mCallback.promote();
599 ALOGV("enableStatusChanged %p enabled %d mCallback %p", this, enabled, cb.get());
Eric Laurent801a1182010-06-09 00:17:29 -0700600 if (mStatus == ALREADY_EXISTS) {
Eric Laurentf5aafb22010-11-18 08:40:16 -0800601 mEnabled = enabled;
Atneya Nair47156072021-12-02 19:05:52 -0500602 if (cb != nullptr) {
603 cb->onEnableStatusChanged(enabled);
Eric Laurent801a1182010-06-09 00:17:29 -0700604 }
605 }
606}
607
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700608void AudioEffect::commandExecuted(int32_t cmdCode,
609 const std::vector<uint8_t>& cmdData,
610 const std::vector<uint8_t>& replyData)
Eric Laurent801a1182010-06-09 00:17:29 -0700611{
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700612 if (cmdData.empty() || replyData.empty()) {
Eric Laurent801a1182010-06-09 00:17:29 -0700613 return;
614 }
Atneya Nair47156072021-12-02 19:05:52 -0500615 auto cb = mCallback.promote();
616 if (cb != nullptr && cmdCode == EFFECT_CMD_SET_PARAM) {
Ytai Ben-Tsvi9cd89812020-07-01 17:12:06 -0700617 std::vector<uint8_t> cmdDataCopy(cmdData);
618 effect_param_t* cmd = reinterpret_cast<effect_param_t *>(cmdDataCopy.data());
619 cmd->status = *reinterpret_cast<const int32_t *>(replyData.data());
Atneya Nair47156072021-12-02 19:05:52 -0500620 cb->onParameterChanged(std::move(cmdDataCopy));
Eric Laurent801a1182010-06-09 00:17:29 -0700621 }
622}
623
Eric Laurentde8caf42021-08-11 17:19:25 +0200624void AudioEffect::framesProcessed(int32_t frames)
625{
Atneya Nair47156072021-12-02 19:05:52 -0500626 auto cb = mCallback.promote();
627 if (cb != nullptr) {
628 cb->onFramesProcessed(frames);
Eric Laurentde8caf42021-08-11 17:19:25 +0200629 }
630}
631
Eric Laurent801a1182010-06-09 00:17:29 -0700632// -------------------------------------------------------------------------
633
Eric Laurent801a1182010-06-09 00:17:29 -0700634status_t AudioEffect::queryNumberEffects(uint32_t *numEffects)
635{
636 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
637 if (af == 0) return PERMISSION_DENIED;
638 return af->queryNumberEffects(numEffects);
639}
640
Eric Laurentffe9c252010-06-23 17:38:20 -0700641status_t AudioEffect::queryEffect(uint32_t index, effect_descriptor_t *descriptor)
Eric Laurent801a1182010-06-09 00:17:29 -0700642{
643 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
644 if (af == 0) return PERMISSION_DENIED;
Eric Laurentffe9c252010-06-23 17:38:20 -0700645 return af->queryEffect(index, descriptor);
Eric Laurent801a1182010-06-09 00:17:29 -0700646}
647
Glenn Kasten5e92a782012-01-30 07:40:52 -0800648status_t AudioEffect::getEffectDescriptor(const effect_uuid_t *uuid,
Ari Hausman-Cohen2046ec72018-04-24 14:00:55 -0700649 const effect_uuid_t *type,
650 uint32_t preferredTypeFlag,
651 effect_descriptor_t *descriptor)
Eric Laurent801a1182010-06-09 00:17:29 -0700652{
653 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
654 if (af == 0) return PERMISSION_DENIED;
Ari Hausman-Cohen2046ec72018-04-24 14:00:55 -0700655 return af->getEffectDescriptor(uuid, type, preferredTypeFlag, descriptor);
Eric Laurent801a1182010-06-09 00:17:29 -0700656}
657
Glenn Kastend848eb42016-03-08 13:42:11 -0800658status_t AudioEffect::queryDefaultPreProcessing(audio_session_t audioSession,
Eric Laurent57dae992011-07-24 13:36:09 -0700659 effect_descriptor_t *descriptors,
660 uint32_t *count)
661{
Ytai Ben-Tsvi0a4904a2021-01-06 12:57:05 -0800662 if (descriptors == nullptr || count == nullptr) {
663 return BAD_VALUE;
664 }
Eric Laurent57dae992011-07-24 13:36:09 -0700665 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
666 if (aps == 0) return PERMISSION_DENIED;
Ytai Ben-Tsvi0a4904a2021-01-06 12:57:05 -0800667
668 int32_t audioSessionAidl = VALUE_OR_RETURN_STATUS(
669 legacy2aidl_audio_session_t_int32_t(audioSession));
Mikhail Naganov0078ee52021-09-30 23:06:20 +0000670 media::audio::common::Int countAidl;
Ytai Ben-Tsvi0a4904a2021-01-06 12:57:05 -0800671 countAidl.value = VALUE_OR_RETURN_STATUS(convertIntegral<int32_t>(*count));
672 std::vector<media::EffectDescriptor> retAidl;
673 RETURN_STATUS_IF_ERROR(statusTFromBinderStatus(
674 aps->queryDefaultPreProcessing(audioSessionAidl, &countAidl, &retAidl)));
675 *count = VALUE_OR_RETURN_STATUS(convertIntegral<uint32_t>(countAidl.value));
676 RETURN_STATUS_IF_ERROR(convertRange(retAidl.begin(), retAidl.end(), descriptors,
677 aidl2legacy_EffectDescriptor_effect_descriptor_t));
678 return OK;
Eric Laurent57dae992011-07-24 13:36:09 -0700679}
Ari Hausman-Cohen433722e2018-04-24 14:25:22 -0700680
681status_t AudioEffect::newEffectUniqueId(audio_unique_id_t* id)
682{
683 const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger();
684 if (af == 0) return PERMISSION_DENIED;
685 *id = af->newAudioUniqueId(AUDIO_UNIQUE_ID_USE_EFFECT);
686 return NO_ERROR;
687}
688
Ari Hausman-Cohen24628312018-08-13 15:01:09 -0700689status_t AudioEffect::addSourceDefaultEffect(const char *typeStr,
690 const String16& opPackageName,
691 const char *uuidStr,
692 int32_t priority,
693 audio_source_t source,
694 audio_unique_id_t *id)
695{
696 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
697 if (aps == 0) return PERMISSION_DENIED;
698
699 if (typeStr == NULL && uuidStr == NULL) return BAD_VALUE;
700
701 // Convert type & uuid from string to effect_uuid_t.
702 effect_uuid_t type;
703 if (typeStr != NULL) {
704 status_t res = stringToGuid(typeStr, &type);
705 if (res != OK) return res;
706 } else {
707 type = *EFFECT_UUID_NULL;
708 }
709
710 effect_uuid_t uuid;
711 if (uuidStr != NULL) {
712 status_t res = stringToGuid(uuidStr, &uuid);
713 if (res != OK) return res;
714 } else {
715 uuid = *EFFECT_UUID_NULL;
716 }
717
Mikhail Naganovddceecc2021-09-03 13:58:56 -0700718 AudioUuid typeAidl = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_uuid_t_AudioUuid(type));
719 AudioUuid uuidAidl = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_uuid_t_AudioUuid(uuid));
Ytai Ben-Tsvi0a4904a2021-01-06 12:57:05 -0800720 std::string opPackageNameAidl = VALUE_OR_RETURN_STATUS(
721 legacy2aidl_String16_string(opPackageName));
Mikhail Naganovddceecc2021-09-03 13:58:56 -0700722 AudioSource sourceAidl = VALUE_OR_RETURN_STATUS(
723 legacy2aidl_audio_source_t_AudioSource(source));
Ytai Ben-Tsvi0a4904a2021-01-06 12:57:05 -0800724 int32_t retAidl;
725 RETURN_STATUS_IF_ERROR(statusTFromBinderStatus(
726 aps->addSourceDefaultEffect(typeAidl, opPackageNameAidl, uuidAidl, priority, sourceAidl,
727 &retAidl)));
728 *id = VALUE_OR_RETURN_STATUS(aidl2legacy_int32_t_audio_unique_id_t(retAidl));
729 return OK;
Ari Hausman-Cohen24628312018-08-13 15:01:09 -0700730}
731
Ari Hausman-Cohen433722e2018-04-24 14:25:22 -0700732status_t AudioEffect::addStreamDefaultEffect(const char *typeStr,
733 const String16& opPackageName,
734 const char *uuidStr,
735 int32_t priority,
736 audio_usage_t usage,
737 audio_unique_id_t *id)
738{
739 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
740 if (aps == 0) return PERMISSION_DENIED;
741
742 if (typeStr == NULL && uuidStr == NULL) return BAD_VALUE;
743
744 // Convert type & uuid from string to effect_uuid_t.
745 effect_uuid_t type;
746 if (typeStr != NULL) {
747 status_t res = stringToGuid(typeStr, &type);
748 if (res != OK) return res;
749 } else {
750 type = *EFFECT_UUID_NULL;
751 }
752
753 effect_uuid_t uuid;
754 if (uuidStr != NULL) {
755 status_t res = stringToGuid(uuidStr, &uuid);
756 if (res != OK) return res;
757 } else {
758 uuid = *EFFECT_UUID_NULL;
759 }
760
Mikhail Naganovddceecc2021-09-03 13:58:56 -0700761 AudioUuid typeAidl = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_uuid_t_AudioUuid(type));
762 AudioUuid uuidAidl = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_uuid_t_AudioUuid(uuid));
Ytai Ben-Tsvi0a4904a2021-01-06 12:57:05 -0800763 std::string opPackageNameAidl = VALUE_OR_RETURN_STATUS(
764 legacy2aidl_String16_string(opPackageName));
Mikhail Naganovdbf03642021-08-25 18:15:32 -0700765 media::audio::common::AudioUsage usageAidl = VALUE_OR_RETURN_STATUS(
Ytai Ben-Tsvi0a4904a2021-01-06 12:57:05 -0800766 legacy2aidl_audio_usage_t_AudioUsage(usage));
767 int32_t retAidl;
768 RETURN_STATUS_IF_ERROR(statusTFromBinderStatus(
769 aps->addStreamDefaultEffect(typeAidl, opPackageNameAidl, uuidAidl, priority, usageAidl,
770 &retAidl)));
771 *id = VALUE_OR_RETURN_STATUS(aidl2legacy_int32_t_audio_unique_id_t(retAidl));
772 return OK;
Ari Hausman-Cohen433722e2018-04-24 14:25:22 -0700773}
774
Ari Hausman-Cohen24628312018-08-13 15:01:09 -0700775status_t AudioEffect::removeSourceDefaultEffect(audio_unique_id_t id)
776{
777 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
778 if (aps == 0) return PERMISSION_DENIED;
779
Ytai Ben-Tsvi0a4904a2021-01-06 12:57:05 -0800780 int32_t idAidl = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_unique_id_t_int32_t(id));
781 return statusTFromBinderStatus(aps->removeSourceDefaultEffect(idAidl));
Ari Hausman-Cohen24628312018-08-13 15:01:09 -0700782}
783
Ari Hausman-Cohen433722e2018-04-24 14:25:22 -0700784status_t AudioEffect::removeStreamDefaultEffect(audio_unique_id_t id)
785{
786 const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service();
787 if (aps == 0) return PERMISSION_DENIED;
788
Ytai Ben-Tsvi0a4904a2021-01-06 12:57:05 -0800789 int32_t idAidl = VALUE_OR_RETURN_STATUS(legacy2aidl_audio_unique_id_t_int32_t(id));
790 return statusTFromBinderStatus(aps->removeStreamDefaultEffect(idAidl));
Ari Hausman-Cohen433722e2018-04-24 14:25:22 -0700791}
792
Eric Laurent801a1182010-06-09 00:17:29 -0700793// -------------------------------------------------------------------------
794
795status_t AudioEffect::stringToGuid(const char *str, effect_uuid_t *guid)
796{
797 if (str == NULL || guid == NULL) {
798 return BAD_VALUE;
799 }
800
801 int tmp[10];
802
803 if (sscanf(str, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",
804 tmp, tmp+1, tmp+2, tmp+3, tmp+4, tmp+5, tmp+6, tmp+7, tmp+8, tmp+9) < 10) {
805 return BAD_VALUE;
806 }
807 guid->timeLow = (uint32_t)tmp[0];
808 guid->timeMid = (uint16_t)tmp[1];
809 guid->timeHiAndVersion = (uint16_t)tmp[2];
810 guid->clockSeq = (uint16_t)tmp[3];
811 guid->node[0] = (uint8_t)tmp[4];
812 guid->node[1] = (uint8_t)tmp[5];
813 guid->node[2] = (uint8_t)tmp[6];
814 guid->node[3] = (uint8_t)tmp[7];
815 guid->node[4] = (uint8_t)tmp[8];
816 guid->node[5] = (uint8_t)tmp[9];
817
818 return NO_ERROR;
819}
820
821status_t AudioEffect::guidToString(const effect_uuid_t *guid, char *str, size_t maxLen)
822{
823 if (guid == NULL || str == NULL) {
824 return BAD_VALUE;
825 }
826
827 snprintf(str, maxLen, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x",
828 guid->timeLow,
829 guid->timeMid,
830 guid->timeHiAndVersion,
831 guid->clockSeq,
832 guid->node[0],
833 guid->node[1],
834 guid->node[2],
835 guid->node[3],
836 guid->node[4],
837 guid->node[5]);
838
839 return NO_ERROR;
840}
841
842
Glenn Kasten40bc9062015-03-20 09:09:33 -0700843} // namespace android