Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 26 | #include <binder/IPCThreadState.h> |
Ytai Ben-Tsvi | 9cd8981 | 2020-07-01 17:12:06 -0700 | [diff] [blame] | 27 | #include <media/AudioEffect.h> |
| 28 | #include <media/ShmemCompat.h> |
| 29 | #include <private/media/AudioEffectShared.h> |
| 30 | #include <utils/Log.h> |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 31 | |
| 32 | namespace android { |
| 33 | |
Ytai Ben-Tsvi | 9cd8981 | 2020-07-01 17:12:06 -0700 | [diff] [blame] | 34 | using binder::Status; |
| 35 | |
| 36 | namespace { |
| 37 | |
| 38 | // Copy from a raw pointer + size into a vector of bytes. |
| 39 | void appendToBuffer(const void* data, |
| 40 | size_t size, |
| 41 | std::vector<uint8_t>* buffer) { |
| 42 | const uint8_t* p = reinterpret_cast<const uint8_t*>(data); |
| 43 | buffer->insert(buffer->end(), p, p + size); |
| 44 | } |
| 45 | |
| 46 | } // namespace |
| 47 | |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 48 | // --------------------------------------------------------------------------- |
| 49 | |
Svet Ganov | be71aa2 | 2015-04-28 12:06:02 -0700 | [diff] [blame] | 50 | AudioEffect::AudioEffect(const String16& opPackageName) |
Mikhail Naganov | 416fffe | 2020-07-31 17:36:08 -0700 | [diff] [blame] | 51 | : mOpPackageName(opPackageName) |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 52 | { |
| 53 | } |
| 54 | |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 55 | status_t AudioEffect::set(const effect_uuid_t *type, |
| 56 | const effect_uuid_t *uuid, |
| 57 | int32_t priority, |
| 58 | effect_callback_t cbf, |
| 59 | void* user, |
Glenn Kasten | d848eb4 | 2016-03-08 13:42:11 -0800 | [diff] [blame] | 60 | audio_session_t sessionId, |
Eric Laurent | 9487603 | 2019-11-13 12:45:28 -0800 | [diff] [blame] | 61 | audio_io_handle_t io, |
Eric Laurent | 2fe0acd | 2020-03-13 14:30:46 -0700 | [diff] [blame] | 62 | const AudioDeviceTypeAddr& device, |
| 63 | bool probe) |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 64 | { |
Ytai Ben-Tsvi | 9cd8981 | 2020-07-01 17:12:06 -0700 | [diff] [blame] | 65 | sp<media::IEffect> iEffect; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 66 | sp<IMemory> cblk; |
| 67 | int enabled; |
| 68 | |
Steve Block | 3856b09 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 69 | ALOGV("set %p mUserData: %p uuid: %p timeLow %08x", this, user, type, type ? type->timeLow : 0); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 70 | |
| 71 | if (mIEffect != 0) { |
Steve Block | 5ff1dd5 | 2012-01-05 23:22:43 +0000 | [diff] [blame] | 72 | ALOGW("Effect already in use"); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 73 | return INVALID_OPERATION; |
| 74 | } |
| 75 | |
Eric Laurent | 9487603 | 2019-11-13 12:45:28 -0800 | [diff] [blame] | 76 | if (sessionId == AUDIO_SESSION_DEVICE && io != AUDIO_IO_HANDLE_NONE) { |
| 77 | ALOGW("IO handle should not be specified for device effect"); |
| 78 | return BAD_VALUE; |
| 79 | } |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 80 | const sp<IAudioFlinger>& audioFlinger = AudioSystem::get_audio_flinger(); |
| 81 | if (audioFlinger == 0) { |
Steve Block | 29357bc | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 82 | ALOGE("set(): Could not get audioflinger"); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 83 | return NO_INIT; |
| 84 | } |
| 85 | |
| 86 | if (type == NULL && uuid == NULL) { |
Steve Block | 5ff1dd5 | 2012-01-05 23:22:43 +0000 | [diff] [blame] | 87 | ALOGW("Must specify at least type or uuid"); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 88 | return BAD_VALUE; |
| 89 | } |
Eric Laurent | 2fe0acd | 2020-03-13 14:30:46 -0700 | [diff] [blame] | 90 | mProbe = probe; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 91 | mPriority = priority; |
| 92 | mCbf = cbf; |
| 93 | mUserData = user; |
| 94 | mSessionId = sessionId; |
| 95 | |
| 96 | memset(&mDescriptor, 0, sizeof(effect_descriptor_t)); |
Glenn Kasten | a189a68 | 2012-02-20 12:16:30 -0800 | [diff] [blame] | 97 | mDescriptor.type = *(type != NULL ? type : EFFECT_UUID_NULL); |
| 98 | mDescriptor.uuid = *(uuid != NULL ? uuid : EFFECT_UUID_NULL); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 99 | |
| 100 | mIEffectClient = new EffectClient(this); |
Eric Laurent | b643627 | 2016-12-07 19:24:50 -0800 | [diff] [blame] | 101 | mClientPid = IPCThreadState::self()->getCallingPid(); |
Andy Hung | 8b0bfd9 | 2019-12-23 13:11:11 -0800 | [diff] [blame] | 102 | mClientUid = IPCThreadState::self()->getCallingUid(); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 103 | |
Glenn Kasten | 8d6cc84 | 2012-02-03 11:06:53 -0800 | [diff] [blame] | 104 | iEffect = audioFlinger->createEffect((effect_descriptor_t *)&mDescriptor, |
Eric Laurent | 9487603 | 2019-11-13 12:45:28 -0800 | [diff] [blame] | 105 | mIEffectClient, priority, io, mSessionId, device, mOpPackageName, mClientPid, |
Eric Laurent | 2fe0acd | 2020-03-13 14:30:46 -0700 | [diff] [blame] | 106 | probe, &mStatus, &mId, &enabled); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 107 | |
Eric Laurent | 2fe0acd | 2020-03-13 14:30:46 -0700 | [diff] [blame] | 108 | // In probe mode, we stop here and return the status: the IEffect interface to |
| 109 | // audio flinger will not be retained. initCheck() will return the creation status |
| 110 | // but all other APIs will return invalid operation. |
| 111 | if (probe || iEffect == 0 || (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS)) { |
Mikhail Naganov | abd6e9d | 2020-03-23 22:25:56 +0000 | [diff] [blame] | 112 | char typeBuffer[64] = {}, uuidBuffer[64] = {}; |
Mikhail Naganov | 424c4f5 | 2017-07-19 17:54:29 -0700 | [diff] [blame] | 113 | guidToString(type, typeBuffer, sizeof(typeBuffer)); |
| 114 | guidToString(uuid, uuidBuffer, sizeof(uuidBuffer)); |
Eric Laurent | 2fe0acd | 2020-03-13 14:30:46 -0700 | [diff] [blame] | 115 | ALOGE_IF(!probe, "set(): AudioFlinger could not create effect %s / %s, status: %d", |
Mikhail Naganov | abd6e9d | 2020-03-23 22:25:56 +0000 | [diff] [blame] | 116 | type != nullptr ? typeBuffer : "NULL", |
| 117 | uuid != nullptr ? uuidBuffer : "NULL", |
| 118 | mStatus); |
Eric Laurent | 2fe0acd | 2020-03-13 14:30:46 -0700 | [diff] [blame] | 119 | if (!probe && iEffect == 0) { |
Eric Laurent | eecd765 | 2015-06-04 16:20:16 -0700 | [diff] [blame] | 120 | mStatus = NO_INIT; |
| 121 | } |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 122 | return mStatus; |
| 123 | } |
| 124 | |
| 125 | mEnabled = (volatile int32_t)enabled; |
| 126 | |
Ytai Ben-Tsvi | 9cd8981 | 2020-07-01 17:12:06 -0700 | [diff] [blame] | 127 | if (media::SharedFileRegion shmem; |
| 128 | !iEffect->getCblk(&shmem).isOk() |
| 129 | || !convertSharedFileRegionToIMemory(shmem, &cblk) |
| 130 | || cblk == 0) { |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 131 | mStatus = NO_INIT; |
Steve Block | 29357bc | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 132 | ALOGE("Could not get control block"); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 133 | return mStatus; |
| 134 | } |
| 135 | |
Eric Laurent | eecd765 | 2015-06-04 16:20:16 -0700 | [diff] [blame] | 136 | mIEffect = iEffect; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 137 | mCblkMemory = cblk; |
Ytai Ben-Tsvi | 7dd3972 | 2019-09-05 15:14:30 -0700 | [diff] [blame] | 138 | // TODO: Using unsecurePointer() has some associated security pitfalls |
| 139 | // (see declaration for details). |
| 140 | // Either document why it is safe in this case or address the |
| 141 | // issue (e.g. by copying). |
| 142 | mCblk = static_cast<effect_param_cblk_t*>(cblk->unsecurePointer()); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 143 | int bufOffset = ((sizeof(effect_param_cblk_t) - 1) / sizeof(int) + 1) * sizeof(int); |
| 144 | mCblk->buffer = (uint8_t *)mCblk + bufOffset; |
| 145 | |
Marco Nelissen | 06b4606 | 2014-11-14 07:58:25 -0800 | [diff] [blame] | 146 | IInterface::asBinder(iEffect)->linkToDeath(mIEffectClient); |
Jean-Michel Trivi | a0fd9ca | 2014-09-18 14:07:18 -0700 | [diff] [blame] | 147 | ALOGV("set() %p OK effect: %s id: %d status %d enabled %d pid %d", this, mDescriptor.name, mId, |
| 148 | mStatus, mEnabled, mClientPid); |
| 149 | |
Eric Laurent | 3f75a5b | 2019-11-12 15:55:51 -0800 | [diff] [blame] | 150 | if (!audio_is_global_session(mSessionId)) { |
Andy Hung | 8b0bfd9 | 2019-12-23 13:11:11 -0800 | [diff] [blame] | 151 | AudioSystem::acquireAudioSessionId(mSessionId, mClientPid, mClientUid); |
Jean-Michel Trivi | a0fd9ca | 2014-09-18 14:07:18 -0700 | [diff] [blame] | 152 | } |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 153 | |
| 154 | return mStatus; |
| 155 | } |
| 156 | |
Mikhail Naganov | 416fffe | 2020-07-31 17:36:08 -0700 | [diff] [blame] | 157 | status_t AudioEffect::set(const char *typeStr, |
| 158 | const char *uuidStr, |
| 159 | int32_t priority, |
| 160 | effect_callback_t cbf, |
| 161 | void* user, |
| 162 | audio_session_t sessionId, |
| 163 | audio_io_handle_t io, |
| 164 | const AudioDeviceTypeAddr& device, |
| 165 | bool probe) |
| 166 | { |
| 167 | effect_uuid_t type; |
| 168 | effect_uuid_t *pType = nullptr; |
| 169 | effect_uuid_t uuid; |
| 170 | effect_uuid_t *pUuid = nullptr; |
| 171 | |
| 172 | ALOGV("AudioEffect::set string\n - type: %s\n - uuid: %s", |
| 173 | typeStr ? typeStr : "nullptr", uuidStr ? uuidStr : "nullptr"); |
| 174 | |
| 175 | if (stringToGuid(typeStr, &type) == NO_ERROR) { |
| 176 | pType = &type; |
| 177 | } |
| 178 | if (stringToGuid(uuidStr, &uuid) == NO_ERROR) { |
| 179 | pUuid = &uuid; |
| 180 | } |
| 181 | |
| 182 | return set(pType, pUuid, priority, cbf, user, sessionId, io, device, probe); |
| 183 | } |
| 184 | |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 185 | |
| 186 | AudioEffect::~AudioEffect() |
| 187 | { |
Steve Block | 3856b09 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 188 | ALOGV("Destructor %p", this); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 189 | |
Eric Laurent | 2fe0acd | 2020-03-13 14:30:46 -0700 | [diff] [blame] | 190 | if (!mProbe && (mStatus == NO_ERROR || mStatus == ALREADY_EXISTS)) { |
Eric Laurent | 3f75a5b | 2019-11-12 15:55:51 -0800 | [diff] [blame] | 191 | if (!audio_is_global_session(mSessionId)) { |
Jean-Michel Trivi | a0fd9ca | 2014-09-18 14:07:18 -0700 | [diff] [blame] | 192 | AudioSystem::releaseAudioSessionId(mSessionId, mClientPid); |
| 193 | } |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 194 | if (mIEffect != NULL) { |
| 195 | mIEffect->disconnect(); |
Marco Nelissen | 06b4606 | 2014-11-14 07:58:25 -0800 | [diff] [blame] | 196 | IInterface::asBinder(mIEffect)->unlinkToDeath(mIEffectClient); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 197 | } |
Eric Laurent | eecd765 | 2015-06-04 16:20:16 -0700 | [diff] [blame] | 198 | mIEffect.clear(); |
| 199 | mCblkMemory.clear(); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 200 | } |
Eric Laurent | 2fe0acd | 2020-03-13 14:30:46 -0700 | [diff] [blame] | 201 | mIEffectClient.clear(); |
| 202 | IPCThreadState::self()->flushCommands(); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | |
| 206 | status_t AudioEffect::initCheck() const |
| 207 | { |
| 208 | return mStatus; |
| 209 | } |
| 210 | |
| 211 | // ------------------------------------------------------------------------- |
| 212 | |
| 213 | effect_descriptor_t AudioEffect::descriptor() const |
| 214 | { |
| 215 | return mDescriptor; |
| 216 | } |
| 217 | |
Eric Laurent | da7581b | 2010-07-02 08:12:41 -0700 | [diff] [blame] | 218 | bool AudioEffect::getEnabled() const |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 219 | { |
| 220 | return (mEnabled != 0); |
| 221 | } |
| 222 | |
Eric Laurent | da7581b | 2010-07-02 08:12:41 -0700 | [diff] [blame] | 223 | status_t AudioEffect::setEnabled(bool enabled) |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 224 | { |
Eric Laurent | 2fe0acd | 2020-03-13 14:30:46 -0700 | [diff] [blame] | 225 | if (mProbe) { |
| 226 | return INVALID_OPERATION; |
| 227 | } |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 228 | if (mStatus != NO_ERROR) { |
Glenn Kasten | f063b49 | 2012-02-17 16:24:10 -0800 | [diff] [blame] | 229 | return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 230 | } |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 231 | |
Eric Laurent | f5aafb2 | 2010-11-18 08:40:16 -0800 | [diff] [blame] | 232 | status_t status = NO_ERROR; |
Eric Laurent | f5aafb2 | 2010-11-18 08:40:16 -0800 | [diff] [blame] | 233 | AutoMutex lock(mLock); |
| 234 | if (enabled != mEnabled) { |
Ytai Ben-Tsvi | 9cd8981 | 2020-07-01 17:12:06 -0700 | [diff] [blame] | 235 | Status bs; |
| 236 | |
Eric Laurent | f5aafb2 | 2010-11-18 08:40:16 -0800 | [diff] [blame] | 237 | if (enabled) { |
Steve Block | 3856b09 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 238 | ALOGV("enable %p", this); |
Ytai Ben-Tsvi | 9cd8981 | 2020-07-01 17:12:06 -0700 | [diff] [blame] | 239 | bs = mIEffect->enable(&status); |
Eric Laurent | f5aafb2 | 2010-11-18 08:40:16 -0800 | [diff] [blame] | 240 | } else { |
Steve Block | 3856b09 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 241 | ALOGV("disable %p", this); |
Ytai Ben-Tsvi | 9cd8981 | 2020-07-01 17:12:06 -0700 | [diff] [blame] | 242 | bs = mIEffect->disable(&status); |
| 243 | } |
| 244 | if (!bs.isOk()) { |
| 245 | status = bs.transactionError(); |
Eric Laurent | da7581b | 2010-07-02 08:12:41 -0700 | [diff] [blame] | 246 | } |
Eric Laurent | f5aafb2 | 2010-11-18 08:40:16 -0800 | [diff] [blame] | 247 | if (status == NO_ERROR) { |
| 248 | mEnabled = enabled; |
Eric Laurent | da7581b | 2010-07-02 08:12:41 -0700 | [diff] [blame] | 249 | } |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 250 | } |
Eric Laurent | f5aafb2 | 2010-11-18 08:40:16 -0800 | [diff] [blame] | 251 | return status; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 252 | } |
| 253 | |
Eric Laurent | 25f4395 | 2010-07-28 05:40:18 -0700 | [diff] [blame] | 254 | status_t AudioEffect::command(uint32_t cmdCode, |
| 255 | uint32_t cmdSize, |
| 256 | void *cmdData, |
| 257 | uint32_t *replySize, |
| 258 | void *replyData) |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 259 | { |
Eric Laurent | 2fe0acd | 2020-03-13 14:30:46 -0700 | [diff] [blame] | 260 | if (mProbe) { |
| 261 | return INVALID_OPERATION; |
| 262 | } |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 263 | if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) { |
Steve Block | 3856b09 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 264 | ALOGV("command() bad status %d", mStatus); |
John Grossman | af7d818 | 2012-01-11 12:23:42 -0800 | [diff] [blame] | 265 | return mStatus; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 266 | } |
| 267 | |
Eric Laurent | f5aafb2 | 2010-11-18 08:40:16 -0800 | [diff] [blame] | 268 | if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) { |
| 269 | if (mEnabled == (cmdCode == EFFECT_CMD_ENABLE)) { |
| 270 | return NO_ERROR; |
| 271 | } |
| 272 | if (replySize == NULL || *replySize != sizeof(status_t) || replyData == NULL) { |
| 273 | return BAD_VALUE; |
| 274 | } |
| 275 | mLock.lock(); |
Eric Laurent | 0fa449c | 2010-09-24 11:52:04 -0700 | [diff] [blame] | 276 | } |
| 277 | |
Ytai Ben-Tsvi | 9cd8981 | 2020-07-01 17:12:06 -0700 | [diff] [blame] | 278 | std::vector<uint8_t> data; |
| 279 | appendToBuffer(cmdData, cmdSize, &data); |
| 280 | |
| 281 | status_t status; |
| 282 | std::vector<uint8_t> response; |
| 283 | |
| 284 | Status bs = mIEffect->command(cmdCode, data, *replySize, &response, &status); |
| 285 | if (!bs.isOk()) { |
| 286 | status = bs.transactionError(); |
| 287 | } |
| 288 | if (status == NO_ERROR) { |
| 289 | memcpy(replyData, response.data(), response.size()); |
| 290 | *replySize = response.size(); |
| 291 | } |
Eric Laurent | 0fa449c | 2010-09-24 11:52:04 -0700 | [diff] [blame] | 292 | |
| 293 | if (cmdCode == EFFECT_CMD_ENABLE || cmdCode == EFFECT_CMD_DISABLE) { |
Eric Laurent | f5aafb2 | 2010-11-18 08:40:16 -0800 | [diff] [blame] | 294 | if (status == NO_ERROR) { |
| 295 | status = *(status_t *)replyData; |
Eric Laurent | 0fa449c | 2010-09-24 11:52:04 -0700 | [diff] [blame] | 296 | } |
Eric Laurent | f5aafb2 | 2010-11-18 08:40:16 -0800 | [diff] [blame] | 297 | if (status == NO_ERROR) { |
| 298 | mEnabled = (cmdCode == EFFECT_CMD_ENABLE); |
Eric Laurent | 0fa449c | 2010-09-24 11:52:04 -0700 | [diff] [blame] | 299 | } |
Eric Laurent | f5aafb2 | 2010-11-18 08:40:16 -0800 | [diff] [blame] | 300 | mLock.unlock(); |
Eric Laurent | 8569f0d | 2010-07-29 23:43:43 -0700 | [diff] [blame] | 301 | } |
| 302 | |
Eric Laurent | 8569f0d | 2010-07-29 23:43:43 -0700 | [diff] [blame] | 303 | return status; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 304 | } |
| 305 | |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 306 | status_t AudioEffect::setParameter(effect_param_t *param) |
| 307 | { |
Eric Laurent | 2fe0acd | 2020-03-13 14:30:46 -0700 | [diff] [blame] | 308 | if (mProbe) { |
| 309 | return INVALID_OPERATION; |
| 310 | } |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 311 | if (mStatus != NO_ERROR) { |
Glenn Kasten | f063b49 | 2012-02-17 16:24:10 -0800 | [diff] [blame] | 312 | return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 313 | } |
| 314 | |
| 315 | if (param == NULL || param->psize == 0 || param->vsize == 0) { |
| 316 | return BAD_VALUE; |
| 317 | } |
| 318 | |
Eric Laurent | 25f4395 | 2010-07-28 05:40:18 -0700 | [diff] [blame] | 319 | uint32_t psize = ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 320 | |
Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 321 | ALOGV("setParameter: param: %d, param2: %d", *(int *)param->data, |
| 322 | (param->psize == 8) ? *((int *)param->data + 1): -1); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 323 | |
Ytai Ben-Tsvi | 9cd8981 | 2020-07-01 17:12:06 -0700 | [diff] [blame] | 324 | std::vector<uint8_t> cmd; |
| 325 | appendToBuffer(param, sizeof(effect_param_t) + psize, &cmd); |
| 326 | std::vector<uint8_t> response; |
| 327 | status_t status; |
| 328 | Status bs = mIEffect->command(EFFECT_CMD_SET_PARAM, |
| 329 | cmd, |
| 330 | sizeof(int), |
| 331 | &response, |
| 332 | &status); |
| 333 | if (!bs.isOk()) { |
| 334 | status = bs.transactionError(); |
| 335 | return status; |
| 336 | } |
| 337 | assert(response.size() == sizeof(int)); |
| 338 | memcpy(¶m->status, response.data(), response.size()); |
| 339 | return status; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 340 | } |
| 341 | |
| 342 | status_t AudioEffect::setParameterDeferred(effect_param_t *param) |
| 343 | { |
Eric Laurent | 2fe0acd | 2020-03-13 14:30:46 -0700 | [diff] [blame] | 344 | if (mProbe) { |
| 345 | return INVALID_OPERATION; |
| 346 | } |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 347 | if (mStatus != NO_ERROR) { |
Glenn Kasten | f063b49 | 2012-02-17 16:24:10 -0800 | [diff] [blame] | 348 | return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 349 | } |
| 350 | |
| 351 | if (param == NULL || param->psize == 0 || param->vsize == 0) { |
| 352 | return BAD_VALUE; |
| 353 | } |
| 354 | |
| 355 | Mutex::Autolock _l(mCblk->lock); |
| 356 | |
| 357 | int psize = ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + param->vsize; |
| 358 | int size = ((sizeof(effect_param_t) + psize - 1) / sizeof(int) + 1) * sizeof(int); |
| 359 | |
| 360 | if (mCblk->clientIndex + size > EFFECT_PARAM_BUFFER_SIZE) { |
| 361 | return NO_MEMORY; |
| 362 | } |
| 363 | int *p = (int *)(mCblk->buffer + mCblk->clientIndex); |
| 364 | *p++ = size; |
| 365 | memcpy(p, param, sizeof(effect_param_t) + psize); |
| 366 | mCblk->clientIndex += size; |
| 367 | |
| 368 | return NO_ERROR; |
| 369 | } |
| 370 | |
| 371 | status_t AudioEffect::setParameterCommit() |
| 372 | { |
Eric Laurent | 2fe0acd | 2020-03-13 14:30:46 -0700 | [diff] [blame] | 373 | if (mProbe) { |
| 374 | return INVALID_OPERATION; |
| 375 | } |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 376 | if (mStatus != NO_ERROR) { |
Glenn Kasten | f063b49 | 2012-02-17 16:24:10 -0800 | [diff] [blame] | 377 | return (mStatus == ALREADY_EXISTS) ? (status_t) INVALID_OPERATION : mStatus; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 378 | } |
| 379 | |
| 380 | Mutex::Autolock _l(mCblk->lock); |
| 381 | if (mCblk->clientIndex == 0) { |
| 382 | return INVALID_OPERATION; |
| 383 | } |
Ytai Ben-Tsvi | 9cd8981 | 2020-07-01 17:12:06 -0700 | [diff] [blame] | 384 | std::vector<uint8_t> cmd; |
| 385 | std::vector<uint8_t> response; |
| 386 | status_t status; |
| 387 | Status bs = mIEffect->command(EFFECT_CMD_SET_PARAM_COMMIT, |
| 388 | cmd, |
| 389 | 0, |
| 390 | &response, |
| 391 | &status); |
| 392 | if (!bs.isOk()) { |
| 393 | status = bs.transactionError(); |
| 394 | } |
| 395 | return status; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 396 | } |
| 397 | |
| 398 | status_t AudioEffect::getParameter(effect_param_t *param) |
| 399 | { |
Eric Laurent | 2fe0acd | 2020-03-13 14:30:46 -0700 | [diff] [blame] | 400 | if (mProbe) { |
| 401 | return INVALID_OPERATION; |
| 402 | } |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 403 | if (mStatus != NO_ERROR && mStatus != ALREADY_EXISTS) { |
John Grossman | af7d818 | 2012-01-11 12:23:42 -0800 | [diff] [blame] | 404 | return mStatus; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 405 | } |
| 406 | |
| 407 | if (param == NULL || param->psize == 0 || param->vsize == 0) { |
| 408 | return BAD_VALUE; |
| 409 | } |
| 410 | |
Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 411 | ALOGV("getParameter: param: %d, param2: %d", *(int *)param->data, |
| 412 | (param->psize == 8) ? *((int *)param->data + 1): -1); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 413 | |
Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 414 | uint32_t psize = sizeof(effect_param_t) + ((param->psize - 1) / sizeof(int) + 1) * sizeof(int) + |
| 415 | param->vsize; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 416 | |
Ytai Ben-Tsvi | 9cd8981 | 2020-07-01 17:12:06 -0700 | [diff] [blame] | 417 | status_t status; |
| 418 | std::vector<uint8_t> cmd; |
| 419 | std::vector<uint8_t> response; |
| 420 | appendToBuffer(param, sizeof(effect_param_t) + param->psize, &cmd); |
| 421 | |
| 422 | Status bs = mIEffect->command(EFFECT_CMD_GET_PARAM, cmd, psize, &response, &status); |
| 423 | if (!bs.isOk()) { |
| 424 | status = bs.transactionError(); |
| 425 | return status; |
| 426 | } |
| 427 | memcpy(param, response.data(), response.size()); |
| 428 | return status; |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 429 | } |
| 430 | |
| 431 | |
| 432 | // ------------------------------------------------------------------------- |
| 433 | |
| 434 | void AudioEffect::binderDied() |
| 435 | { |
Steve Block | 5ff1dd5 | 2012-01-05 23:22:43 +0000 | [diff] [blame] | 436 | ALOGW("IEffect died"); |
John Grossman | af7d818 | 2012-01-11 12:23:42 -0800 | [diff] [blame] | 437 | mStatus = DEAD_OBJECT; |
Glenn Kasten | a0d6833 | 2012-01-27 16:47:15 -0800 | [diff] [blame] | 438 | if (mCbf != NULL) { |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 439 | status_t status = DEAD_OBJECT; |
| 440 | mCbf(EVENT_ERROR, mUserData, &status); |
| 441 | } |
| 442 | mIEffect.clear(); |
| 443 | } |
| 444 | |
| 445 | // ------------------------------------------------------------------------- |
| 446 | |
| 447 | void AudioEffect::controlStatusChanged(bool controlGranted) |
| 448 | { |
Glenn Kasten | 85ab62c | 2012-11-01 11:11:38 -0700 | [diff] [blame] | 449 | ALOGV("controlStatusChanged %p control %d callback %p mUserData %p", this, controlGranted, mCbf, |
| 450 | mUserData); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 451 | if (controlGranted) { |
| 452 | if (mStatus == ALREADY_EXISTS) { |
| 453 | mStatus = NO_ERROR; |
| 454 | } |
| 455 | } else { |
| 456 | if (mStatus == NO_ERROR) { |
| 457 | mStatus = ALREADY_EXISTS; |
| 458 | } |
| 459 | } |
Glenn Kasten | a0d6833 | 2012-01-27 16:47:15 -0800 | [diff] [blame] | 460 | if (mCbf != NULL) { |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 461 | mCbf(EVENT_CONTROL_STATUS_CHANGED, mUserData, &controlGranted); |
| 462 | } |
| 463 | } |
| 464 | |
| 465 | void AudioEffect::enableStatusChanged(bool enabled) |
| 466 | { |
Steve Block | 3856b09 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 467 | ALOGV("enableStatusChanged %p enabled %d mCbf %p", this, enabled, mCbf); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 468 | if (mStatus == ALREADY_EXISTS) { |
Eric Laurent | f5aafb2 | 2010-11-18 08:40:16 -0800 | [diff] [blame] | 469 | mEnabled = enabled; |
Glenn Kasten | a0d6833 | 2012-01-27 16:47:15 -0800 | [diff] [blame] | 470 | if (mCbf != NULL) { |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 471 | mCbf(EVENT_ENABLE_STATUS_CHANGED, mUserData, &enabled); |
| 472 | } |
| 473 | } |
| 474 | } |
| 475 | |
Ytai Ben-Tsvi | 9cd8981 | 2020-07-01 17:12:06 -0700 | [diff] [blame] | 476 | void AudioEffect::commandExecuted(int32_t cmdCode, |
| 477 | const std::vector<uint8_t>& cmdData, |
| 478 | const std::vector<uint8_t>& replyData) |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 479 | { |
Ytai Ben-Tsvi | 9cd8981 | 2020-07-01 17:12:06 -0700 | [diff] [blame] | 480 | if (cmdData.empty() || replyData.empty()) { |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 481 | return; |
| 482 | } |
| 483 | |
Glenn Kasten | a0d6833 | 2012-01-27 16:47:15 -0800 | [diff] [blame] | 484 | if (mCbf != NULL && cmdCode == EFFECT_CMD_SET_PARAM) { |
Ytai Ben-Tsvi | 9cd8981 | 2020-07-01 17:12:06 -0700 | [diff] [blame] | 485 | std::vector<uint8_t> cmdDataCopy(cmdData); |
| 486 | effect_param_t* cmd = reinterpret_cast<effect_param_t *>(cmdDataCopy.data()); |
| 487 | cmd->status = *reinterpret_cast<const int32_t *>(replyData.data()); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 488 | mCbf(EVENT_PARAMETER_CHANGED, mUserData, cmd); |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | // ------------------------------------------------------------------------- |
| 493 | |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 494 | status_t AudioEffect::queryNumberEffects(uint32_t *numEffects) |
| 495 | { |
| 496 | const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger(); |
| 497 | if (af == 0) return PERMISSION_DENIED; |
| 498 | return af->queryNumberEffects(numEffects); |
| 499 | } |
| 500 | |
Eric Laurent | ffe9c25 | 2010-06-23 17:38:20 -0700 | [diff] [blame] | 501 | status_t AudioEffect::queryEffect(uint32_t index, effect_descriptor_t *descriptor) |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 502 | { |
| 503 | const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger(); |
| 504 | if (af == 0) return PERMISSION_DENIED; |
Eric Laurent | ffe9c25 | 2010-06-23 17:38:20 -0700 | [diff] [blame] | 505 | return af->queryEffect(index, descriptor); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 506 | } |
| 507 | |
Glenn Kasten | 5e92a78 | 2012-01-30 07:40:52 -0800 | [diff] [blame] | 508 | status_t AudioEffect::getEffectDescriptor(const effect_uuid_t *uuid, |
Ari Hausman-Cohen | 2046ec7 | 2018-04-24 14:00:55 -0700 | [diff] [blame] | 509 | const effect_uuid_t *type, |
| 510 | uint32_t preferredTypeFlag, |
| 511 | effect_descriptor_t *descriptor) |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 512 | { |
| 513 | const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger(); |
| 514 | if (af == 0) return PERMISSION_DENIED; |
Ari Hausman-Cohen | 2046ec7 | 2018-04-24 14:00:55 -0700 | [diff] [blame] | 515 | return af->getEffectDescriptor(uuid, type, preferredTypeFlag, descriptor); |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 516 | } |
| 517 | |
Glenn Kasten | d848eb4 | 2016-03-08 13:42:11 -0800 | [diff] [blame] | 518 | status_t AudioEffect::queryDefaultPreProcessing(audio_session_t audioSession, |
Eric Laurent | 57dae99 | 2011-07-24 13:36:09 -0700 | [diff] [blame] | 519 | effect_descriptor_t *descriptors, |
| 520 | uint32_t *count) |
| 521 | { |
| 522 | const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service(); |
| 523 | if (aps == 0) return PERMISSION_DENIED; |
| 524 | return aps->queryDefaultPreProcessing(audioSession, descriptors, count); |
| 525 | } |
Ari Hausman-Cohen | 433722e | 2018-04-24 14:25:22 -0700 | [diff] [blame] | 526 | |
| 527 | status_t AudioEffect::newEffectUniqueId(audio_unique_id_t* id) |
| 528 | { |
| 529 | const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger(); |
| 530 | if (af == 0) return PERMISSION_DENIED; |
| 531 | *id = af->newAudioUniqueId(AUDIO_UNIQUE_ID_USE_EFFECT); |
| 532 | return NO_ERROR; |
| 533 | } |
| 534 | |
Ari Hausman-Cohen | 2462831 | 2018-08-13 15:01:09 -0700 | [diff] [blame] | 535 | status_t AudioEffect::addSourceDefaultEffect(const char *typeStr, |
| 536 | const String16& opPackageName, |
| 537 | const char *uuidStr, |
| 538 | int32_t priority, |
| 539 | audio_source_t source, |
| 540 | audio_unique_id_t *id) |
| 541 | { |
| 542 | const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service(); |
| 543 | if (aps == 0) return PERMISSION_DENIED; |
| 544 | |
| 545 | if (typeStr == NULL && uuidStr == NULL) return BAD_VALUE; |
| 546 | |
| 547 | // Convert type & uuid from string to effect_uuid_t. |
| 548 | effect_uuid_t type; |
| 549 | if (typeStr != NULL) { |
| 550 | status_t res = stringToGuid(typeStr, &type); |
| 551 | if (res != OK) return res; |
| 552 | } else { |
| 553 | type = *EFFECT_UUID_NULL; |
| 554 | } |
| 555 | |
| 556 | effect_uuid_t uuid; |
| 557 | if (uuidStr != NULL) { |
| 558 | status_t res = stringToGuid(uuidStr, &uuid); |
| 559 | if (res != OK) return res; |
| 560 | } else { |
| 561 | uuid = *EFFECT_UUID_NULL; |
| 562 | } |
| 563 | |
| 564 | return aps->addSourceDefaultEffect(&type, opPackageName, &uuid, priority, source, id); |
| 565 | } |
| 566 | |
Ari Hausman-Cohen | 433722e | 2018-04-24 14:25:22 -0700 | [diff] [blame] | 567 | status_t AudioEffect::addStreamDefaultEffect(const char *typeStr, |
| 568 | const String16& opPackageName, |
| 569 | const char *uuidStr, |
| 570 | int32_t priority, |
| 571 | audio_usage_t usage, |
| 572 | audio_unique_id_t *id) |
| 573 | { |
| 574 | const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service(); |
| 575 | if (aps == 0) return PERMISSION_DENIED; |
| 576 | |
| 577 | if (typeStr == NULL && uuidStr == NULL) return BAD_VALUE; |
| 578 | |
| 579 | // Convert type & uuid from string to effect_uuid_t. |
| 580 | effect_uuid_t type; |
| 581 | if (typeStr != NULL) { |
| 582 | status_t res = stringToGuid(typeStr, &type); |
| 583 | if (res != OK) return res; |
| 584 | } else { |
| 585 | type = *EFFECT_UUID_NULL; |
| 586 | } |
| 587 | |
| 588 | effect_uuid_t uuid; |
| 589 | if (uuidStr != NULL) { |
| 590 | status_t res = stringToGuid(uuidStr, &uuid); |
| 591 | if (res != OK) return res; |
| 592 | } else { |
| 593 | uuid = *EFFECT_UUID_NULL; |
| 594 | } |
| 595 | |
| 596 | return aps->addStreamDefaultEffect(&type, opPackageName, &uuid, priority, usage, id); |
| 597 | } |
| 598 | |
Ari Hausman-Cohen | 2462831 | 2018-08-13 15:01:09 -0700 | [diff] [blame] | 599 | status_t AudioEffect::removeSourceDefaultEffect(audio_unique_id_t id) |
| 600 | { |
| 601 | const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service(); |
| 602 | if (aps == 0) return PERMISSION_DENIED; |
| 603 | |
| 604 | return aps->removeSourceDefaultEffect(id); |
| 605 | } |
| 606 | |
Ari Hausman-Cohen | 433722e | 2018-04-24 14:25:22 -0700 | [diff] [blame] | 607 | status_t AudioEffect::removeStreamDefaultEffect(audio_unique_id_t id) |
| 608 | { |
| 609 | const sp<IAudioPolicyService>& aps = AudioSystem::get_audio_policy_service(); |
| 610 | if (aps == 0) return PERMISSION_DENIED; |
| 611 | |
| 612 | return aps->removeStreamDefaultEffect(id); |
| 613 | } |
| 614 | |
Eric Laurent | 801a118 | 2010-06-09 00:17:29 -0700 | [diff] [blame] | 615 | // ------------------------------------------------------------------------- |
| 616 | |
| 617 | status_t AudioEffect::stringToGuid(const char *str, effect_uuid_t *guid) |
| 618 | { |
| 619 | if (str == NULL || guid == NULL) { |
| 620 | return BAD_VALUE; |
| 621 | } |
| 622 | |
| 623 | int tmp[10]; |
| 624 | |
| 625 | if (sscanf(str, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x", |
| 626 | tmp, tmp+1, tmp+2, tmp+3, tmp+4, tmp+5, tmp+6, tmp+7, tmp+8, tmp+9) < 10) { |
| 627 | return BAD_VALUE; |
| 628 | } |
| 629 | guid->timeLow = (uint32_t)tmp[0]; |
| 630 | guid->timeMid = (uint16_t)tmp[1]; |
| 631 | guid->timeHiAndVersion = (uint16_t)tmp[2]; |
| 632 | guid->clockSeq = (uint16_t)tmp[3]; |
| 633 | guid->node[0] = (uint8_t)tmp[4]; |
| 634 | guid->node[1] = (uint8_t)tmp[5]; |
| 635 | guid->node[2] = (uint8_t)tmp[6]; |
| 636 | guid->node[3] = (uint8_t)tmp[7]; |
| 637 | guid->node[4] = (uint8_t)tmp[8]; |
| 638 | guid->node[5] = (uint8_t)tmp[9]; |
| 639 | |
| 640 | return NO_ERROR; |
| 641 | } |
| 642 | |
| 643 | status_t AudioEffect::guidToString(const effect_uuid_t *guid, char *str, size_t maxLen) |
| 644 | { |
| 645 | if (guid == NULL || str == NULL) { |
| 646 | return BAD_VALUE; |
| 647 | } |
| 648 | |
| 649 | snprintf(str, maxLen, "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x", |
| 650 | guid->timeLow, |
| 651 | guid->timeMid, |
| 652 | guid->timeHiAndVersion, |
| 653 | guid->clockSeq, |
| 654 | guid->node[0], |
| 655 | guid->node[1], |
| 656 | guid->node[2], |
| 657 | guid->node[3], |
| 658 | guid->node[4], |
| 659 | guid->node[5]); |
| 660 | |
| 661 | return NO_ERROR; |
| 662 | } |
| 663 | |
| 664 | |
Glenn Kasten | 40bc906 | 2015-03-20 09:09:33 -0700 | [diff] [blame] | 665 | } // namespace android |