Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2023 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <algorithm> |
Shunkai Yao | 849ba4c | 2023-07-11 18:10:18 +0000 | [diff] [blame] | 18 | #include <cstddef> |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 19 | #include <iterator> |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 20 | #include <memory> |
| 21 | #define LOG_TAG "EffectProxy" |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 22 | // #define LOG_NDEBUG 0 |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 23 | |
| 24 | #include <fmq/AidlMessageQueue.h> |
Shunkai Yao | 007caf0 | 2023-05-17 00:52:54 +0000 | [diff] [blame] | 25 | #include <system/audio_aidl_utils.h> |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 26 | #include <utils/Log.h> |
| 27 | |
| 28 | #include "EffectProxy.h" |
| 29 | |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 30 | using ::aidl::android::hardware::audio::effect::Capability; |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 31 | using ::aidl::android::hardware::audio::effect::CommandId; |
| 32 | using ::aidl::android::hardware::audio::effect::Descriptor; |
| 33 | using ::aidl::android::hardware::audio::effect::Flags; |
| 34 | using ::aidl::android::hardware::audio::effect::IEffect; |
| 35 | using ::aidl::android::hardware::audio::effect::IFactory; |
| 36 | using ::aidl::android::hardware::audio::effect::Parameter; |
| 37 | using ::aidl::android::hardware::audio::effect::State; |
| 38 | using ::aidl::android::media::audio::common::AudioUuid; |
| 39 | |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 40 | namespace android::effect { |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 41 | |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 42 | EffectProxy::EffectProxy(const AudioUuid& uuid, const std::vector<Descriptor>& descriptors, |
| 43 | const std::shared_ptr<IFactory>& factory) |
| 44 | : mDescriptorCommon(buildDescriptorCommon(uuid, descriptors)), |
| 45 | mSubEffects( |
| 46 | [](const std::vector<Descriptor>& descs, const std::shared_ptr<IFactory>& factory) { |
| 47 | std::vector<SubEffect> subEffects; |
| 48 | ALOG_ASSERT(factory, "invalid EffectFactory handle"); |
| 49 | ndk::ScopedAStatus status = ndk::ScopedAStatus::ok(); |
| 50 | for (const auto& desc : descs) { |
| 51 | SubEffect sub({.descriptor = desc}); |
| 52 | status = factory->createEffect(desc.common.id.uuid, &sub.handle); |
| 53 | if (!status.isOk() || !sub.handle) { |
| 54 | sub.handle = nullptr; |
| 55 | ALOGW("%s create sub-effect %s failed", __func__, |
| 56 | ::android::audio::utils::toString(desc.common.id.uuid).c_str()); |
| 57 | } |
| 58 | subEffects.emplace_back(sub); |
| 59 | } |
| 60 | return subEffects; |
| 61 | }(descriptors, factory)), |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 62 | mFactory(factory) {} |
| 63 | |
| 64 | EffectProxy::~EffectProxy() { |
| 65 | close(); |
| 66 | destroy(); |
| 67 | mSubEffects.clear(); |
| 68 | } |
| 69 | |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 70 | ndk::ScopedAStatus EffectProxy::destroy() { |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 71 | ALOGV("%s: %s", __func__, |
| 72 | ::android::audio::utils::toString(mDescriptorCommon.id.type).c_str()); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 73 | return runWithAllSubEffects([&](std::shared_ptr<IEffect>& effect) { |
| 74 | ndk::ScopedAStatus status = mFactory->destroyEffect(effect); |
| 75 | if (status.isOk()) { |
| 76 | effect.reset(); |
| 77 | } |
| 78 | return status; |
| 79 | }); |
| 80 | } |
| 81 | |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 82 | ndk::ScopedAStatus EffectProxy::setOffloadParam(const effect_offload_param_t* offload) { |
| 83 | const auto& itor = std::find_if(mSubEffects.begin(), mSubEffects.end(), [&](const auto& sub) { |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 84 | const auto& desc = sub.descriptor; |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 85 | return offload->isOffload == |
| 86 | (desc.common.flags.hwAcceleratorMode == Flags::HardwareAccelerator::TUNNEL); |
| 87 | }); |
| 88 | if (itor == mSubEffects.end()) { |
| 89 | ALOGE("%s no %soffload sub-effect found", __func__, offload->isOffload ? "" : "non-"); |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 90 | mActiveSubIdx = 0; |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 91 | return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_NULL_POINTER, |
| 92 | "noActiveEffctFound"); |
| 93 | } |
| 94 | |
Shunkai Yao | 4fe6644 | 2023-07-25 21:51:24 +0000 | [diff] [blame] | 95 | mActiveSubIdx = std::distance(mSubEffects.begin(), itor); |
Shunkai Yao | 849ba4c | 2023-07-11 18:10:18 +0000 | [diff] [blame] | 96 | ALOGI("%s: active %soffload sub-effect %zu descriptor: %s", __func__, |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 97 | offload->isOffload ? "" : "non-", mActiveSubIdx, |
| 98 | ::android::audio::utils::toString(mSubEffects[mActiveSubIdx].descriptor.common.id.uuid) |
| 99 | .c_str()); |
Shunkai Yao | 849ba4c | 2023-07-11 18:10:18 +0000 | [diff] [blame] | 100 | return runWithAllSubEffects([&](std::shared_ptr<IEffect>& effect) { |
| 101 | return effect->setParameter(Parameter::make<Parameter::offload>(offload->isOffload)); |
| 102 | }); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | // EffectProxy go over sub-effects and call IEffect interfaces |
| 106 | ndk::ScopedAStatus EffectProxy::open(const Parameter::Common& common, |
| 107 | const std::optional<Parameter::Specific>& specific, |
| 108 | IEffect::OpenEffectReturn* ret __unused) { |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 109 | ndk::ScopedAStatus status = ndk::ScopedAStatus::fromExceptionCodeWithMessage( |
| 110 | EX_ILLEGAL_ARGUMENT, "nullEffectHandle"); |
| 111 | for (auto& sub : mSubEffects) { |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 112 | IEffect::OpenEffectReturn openReturn; |
| 113 | if (!sub.handle || !(status = sub.handle->open(common, specific, &openReturn)).isOk()) { |
| 114 | ALOGE("%s: failed to open %p UUID %s", __func__, sub.handle.get(), |
| 115 | ::android::audio::utils::toString(sub.descriptor.common.id.uuid).c_str()); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 116 | break; |
| 117 | } |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 118 | sub.effectMq.statusQ = std::make_shared<StatusMQ>(openReturn.statusMQ); |
| 119 | sub.effectMq.inputQ = std::make_shared<DataMQ>(openReturn.inputDataMQ); |
| 120 | sub.effectMq.outputQ = std::make_shared<DataMQ>(openReturn.outputDataMQ); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | // close all opened effects if failure |
| 124 | if (!status.isOk()) { |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 125 | ALOGE("%s: closing all sub-effects with error %s", __func__, |
| 126 | status.getDescription().c_str()); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 127 | close(); |
| 128 | } |
| 129 | |
| 130 | return status; |
| 131 | } |
| 132 | |
| 133 | ndk::ScopedAStatus EffectProxy::close() { |
David Li | 0a05c59 | 2023-12-14 15:16:56 +0800 | [diff] [blame^] | 134 | command(CommandId::STOP); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 135 | return runWithAllSubEffects([&](std::shared_ptr<IEffect>& effect) { |
| 136 | return effect->close(); |
| 137 | }); |
| 138 | } |
| 139 | |
| 140 | ndk::ScopedAStatus EffectProxy::getDescriptor(Descriptor* desc) { |
Shunkai Yao | df7bd8b | 2023-07-13 23:25:38 +0000 | [diff] [blame] | 141 | *desc = mSubEffects[mActiveSubIdx].descriptor; |
| 142 | desc->common.id.uuid = desc->common.id.proxy.value(); |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 143 | return ndk::ScopedAStatus::ok(); |
| 144 | } |
| 145 | |
| 146 | ndk::ScopedAStatus EffectProxy::buildDescriptor(const AudioUuid& uuid, |
| 147 | const std::vector<Descriptor>& subEffectDescs, |
| 148 | Descriptor* desc) { |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 149 | if (!desc) { |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 150 | ALOGE("%s: null descriptor pointer", __func__); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 151 | return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_NULL_POINTER, "nullptr"); |
| 152 | } |
| 153 | |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 154 | if (subEffectDescs.size() < 2) { |
| 155 | ALOGE("%s: proxy need at least 2 sub-effects, got %zu", __func__, subEffectDescs.size()); |
| 156 | return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, |
| 157 | "needMoreSubEffects"); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 158 | } |
| 159 | |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 160 | desc->common = buildDescriptorCommon(uuid, subEffectDescs); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 161 | return ndk::ScopedAStatus::ok(); |
| 162 | } |
| 163 | |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 164 | Descriptor::Common EffectProxy::buildDescriptorCommon( |
| 165 | const AudioUuid& uuid, const std::vector<Descriptor>& subEffectDescs) { |
Shunkai Yao | ff5eb3c | 2023-11-10 23:50:57 +0000 | [diff] [blame] | 166 | // initial flag values before we know which sub-effect to active (with setOffloadParam) |
| 167 | // align to HIDL EffectProxy flags |
| 168 | Descriptor::Common common = {.flags = {.type = Flags::Type::INSERT, |
| 169 | .insert = Flags::Insert::LAST, |
| 170 | .volume = Flags::Volume::CTRL}}; |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 171 | |
| 172 | for (const auto& desc : subEffectDescs) { |
| 173 | if (desc.common.flags.hwAcceleratorMode == Flags::HardwareAccelerator::TUNNEL) { |
| 174 | common.flags.hwAcceleratorMode = Flags::HardwareAccelerator::TUNNEL; |
| 175 | } |
| 176 | |
| 177 | // set indication if any sub-effect indication was set |
| 178 | common.flags.offloadIndication |= desc.common.flags.offloadIndication; |
| 179 | common.flags.deviceIndication |= desc.common.flags.deviceIndication; |
| 180 | common.flags.audioModeIndication |= desc.common.flags.audioModeIndication; |
| 181 | common.flags.audioSourceIndication |= desc.common.flags.audioSourceIndication; |
Shunkai Yao | ff5eb3c | 2023-11-10 23:50:57 +0000 | [diff] [blame] | 182 | // Set to NONE if any sub-effect not supporting any Volume command |
| 183 | if (desc.common.flags.volume == Flags::Volume::NONE) { |
| 184 | common.flags.volume = Flags::Volume::NONE; |
| 185 | } |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 186 | } |
| 187 | |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 188 | // copy type UUID from any of sub-effects, all sub-effects should have same type |
| 189 | common.id.type = subEffectDescs[0].common.id.type; |
| 190 | // replace implementation UUID with proxy UUID. |
| 191 | common.id.uuid = uuid; |
| 192 | common.id.proxy = std::nullopt; |
| 193 | common.name = "Proxy"; |
| 194 | common.implementor = "AOSP"; |
| 195 | return common; |
| 196 | } |
| 197 | |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 198 | // Handle with active sub-effect first, only send to other sub-effects when success |
| 199 | ndk::ScopedAStatus EffectProxy::command(CommandId id) { |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 200 | return runWithActiveSubEffectThenOthers( |
| 201 | [&](const std::shared_ptr<IEffect>& effect) -> ndk::ScopedAStatus { |
| 202 | return effect->command(id); |
| 203 | }); |
| 204 | } |
| 205 | |
| 206 | // Return the active sub-effect state |
| 207 | ndk::ScopedAStatus EffectProxy::getState(State* state) { |
| 208 | return runWithActiveSubEffect( |
| 209 | [&](const std::shared_ptr<IEffect>& effect) -> ndk::ScopedAStatus { |
| 210 | return effect->getState(state); |
| 211 | }); |
| 212 | } |
| 213 | |
| 214 | // Handle with active sub-effect first, only send to other sub-effects when success |
| 215 | ndk::ScopedAStatus EffectProxy::setParameter(const Parameter& param) { |
| 216 | return runWithActiveSubEffectThenOthers( |
| 217 | [&](const std::shared_ptr<IEffect>& effect) -> ndk::ScopedAStatus { |
| 218 | return effect->setParameter(param); |
| 219 | }); |
| 220 | } |
| 221 | |
| 222 | // Return the active sub-effect parameter |
| 223 | ndk::ScopedAStatus EffectProxy::getParameter(const Parameter::Id& id, Parameter* param) { |
| 224 | return runWithActiveSubEffect( |
| 225 | [&](const std::shared_ptr<IEffect>& effect) -> ndk::ScopedAStatus { |
| 226 | return effect->getParameter(id, param); |
| 227 | }); |
| 228 | } |
| 229 | |
| 230 | ndk::ScopedAStatus EffectProxy::runWithActiveSubEffectThenOthers( |
| 231 | std::function<ndk::ScopedAStatus(const std::shared_ptr<IEffect>&)> const& func) { |
| 232 | ndk::ScopedAStatus status = runWithActiveSubEffect(func); |
| 233 | if (!status.isOk()) { |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 234 | ALOGE("%s active sub-effect return error %s", __func__, status.getDescription().c_str()); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 235 | } |
| 236 | |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 237 | // proceed with others |
Jaideep Sharma | d823104 | 2023-08-14 13:03:18 +0530 | [diff] [blame] | 238 | for (size_t i = 0; i < mSubEffects.size(); i++) { |
| 239 | if (i == mActiveSubIdx) { |
| 240 | continue; |
| 241 | } |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 242 | if (!mSubEffects[i].handle) { |
| 243 | ALOGE("%s null sub-effect interface for %s", __func__, |
| 244 | mSubEffects[i].descriptor.common.id.uuid.toString().c_str()); |
| 245 | continue; |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 246 | } |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 247 | func(mSubEffects[i].handle); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 248 | } |
| 249 | return status; |
| 250 | } |
| 251 | |
| 252 | ndk::ScopedAStatus EffectProxy::runWithActiveSubEffect( |
| 253 | std::function<ndk::ScopedAStatus(const std::shared_ptr<IEffect>&)> const& func) { |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 254 | if (!mSubEffects[mActiveSubIdx].handle) { |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 255 | ALOGE("%s null active sub-effect interface, active %s", __func__, |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 256 | mSubEffects[mActiveSubIdx].descriptor.toString().c_str()); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 257 | return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_NULL_POINTER, |
| 258 | "activeSubEffectNull"); |
| 259 | } |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 260 | return func(mSubEffects[mActiveSubIdx].handle); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 261 | } |
| 262 | |
| 263 | ndk::ScopedAStatus EffectProxy::runWithAllSubEffects( |
| 264 | std::function<ndk::ScopedAStatus(std::shared_ptr<IEffect>&)> const& func) { |
| 265 | ndk::ScopedAStatus status = ndk::ScopedAStatus::ok(); |
| 266 | // proceed with others if active sub-effect success |
| 267 | for (auto& sub : mSubEffects) { |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 268 | if (!sub.handle) { |
| 269 | ALOGW("%s null sub-effect interface %s", __func__, sub.descriptor.toString().c_str()); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 270 | continue; |
| 271 | } |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 272 | ndk::ScopedAStatus temp = func(sub.handle); |
Shunkai Yao | 5c71834 | 2023-02-23 23:49:51 +0000 | [diff] [blame] | 273 | if (!temp.isOk()) { |
| 274 | status = ndk::ScopedAStatus::fromStatus(temp.getStatus()); |
| 275 | } |
| 276 | } |
| 277 | return status; |
| 278 | } |
| 279 | |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 280 | bool EffectProxy::isBypassing() const { |
| 281 | return mSubEffects[mActiveSubIdx].descriptor.common.flags.bypass; |
| 282 | } |
| 283 | |
Shunkai Yao | 1399323 | 2023-09-14 22:49:41 +0000 | [diff] [blame] | 284 | bool EffectProxy::isTunnel() const { |
| 285 | return mSubEffects[mActiveSubIdx].descriptor.common.flags.hwAcceleratorMode == |
| 286 | Flags::HardwareAccelerator::TUNNEL; |
Shunkai Yao | 0a04798 | 2023-09-13 16:55:26 +0000 | [diff] [blame] | 287 | } |
| 288 | |
Shunkai Yao | 79f9874 | 2023-05-03 23:54:43 +0000 | [diff] [blame] | 289 | binder_status_t EffectProxy::dump(int fd, const char** args, uint32_t numArgs) { |
| 290 | const std::string dumpString = toString(); |
| 291 | write(fd, dumpString.c_str(), dumpString.size()); |
| 292 | |
| 293 | return runWithAllSubEffects([&](std::shared_ptr<IEffect>& effect) { |
| 294 | return ndk::ScopedAStatus::fromStatus(effect->dump(fd, args, numArgs)); |
| 295 | }) |
| 296 | .getStatus(); |
| 297 | } |
| 298 | |
| 299 | std::string EffectProxy::toString(size_t level) const { |
| 300 | std::string prefixSpace(level, ' '); |
| 301 | std::string ss = prefixSpace + "EffectProxy:\n"; |
| 302 | prefixSpace += " "; |
| 303 | base::StringAppendF(&ss, "%sDescriptorCommon: %s\n", prefixSpace.c_str(), |
| 304 | mDescriptorCommon.toString().c_str()); |
| 305 | base::StringAppendF(&ss, "%sActiveSubIdx: %zu\n", prefixSpace.c_str(), mActiveSubIdx); |
| 306 | base::StringAppendF(&ss, "%sAllSubEffects:\n", prefixSpace.c_str()); |
| 307 | for (size_t i = 0; i < mSubEffects.size(); i++) { |
| 308 | base::StringAppendF(&ss, "%s[%zu] - Handle: %p, %s\n", prefixSpace.c_str(), i, |
| 309 | mSubEffects[i].handle.get(), |
| 310 | mSubEffects[i].descriptor.toString().c_str()); |
| 311 | } |
| 312 | return ss; |
| 313 | } |
| 314 | |
| 315 | } // namespace android::effect |