Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0247ce01 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6073908 from 231698af to rvc-release

Change-Id: I64b4317ea8be0925b97ba953a2d9f85efc061507
parents 61831846 231698af
Loading
Loading
Loading
Loading
+30 −10
Original line number Diff line number Diff line
@@ -323,17 +323,23 @@ status_t DeviceHalHidl::createAudioPatch(
    if (mDevice == 0) return NO_INIT;
    if (patch == nullptr) return BAD_VALUE;

#if MAJOR_VERSION < 6
    if (*patch != AUDIO_PATCH_HANDLE_NONE) {
        status_t status = releaseAudioPatch(*patch);
        ALOGW_IF(status != NO_ERROR, "%s error %d releasing patch handle %d",
            __func__, status, *patch);
        *patch = AUDIO_PATCH_HANDLE_NONE;
    }
#endif

    hidl_vec<AudioPortConfig> hidlSources, hidlSinks;
    HidlUtils::audioPortConfigsFromHal(num_sources, sources, &hidlSources);
    HidlUtils::audioPortConfigsFromHal(num_sinks, sinks, &hidlSinks);
    Result retval;
    Return<void> ret = mDevice->createAudioPatch(
    Result retval = Result::OK;
    Return<void> ret;
    std::string methodName = "createAudioPatch";
    if (*patch == AUDIO_PATCH_HANDLE_NONE) {  // always true for MAJOR_VERSION < 6
        ret = mDevice->createAudioPatch(
                hidlSources, hidlSinks,
                [&](Result r, AudioPatchHandle hidlPatch) {
                    retval = r;
@@ -341,7 +347,21 @@ status_t DeviceHalHidl::createAudioPatch(
                        *patch = static_cast<audio_patch_handle_t>(hidlPatch);
                    }
                });
    return processReturn("createAudioPatch", ret, retval);
    } else {
#if MAJOR_VERSION >= 6
        ret = mDevice->updateAudioPatch(
                *patch,
                hidlSources, hidlSinks,
                [&](Result r, AudioPatchHandle hidlPatch) {
                    retval = r;
                    if (retval == Result::OK) {
                        *patch = static_cast<audio_patch_handle_t>(hidlPatch);
                    }
                });
        methodName = "updateAudioPatch";
#endif
    }
    return processReturn(methodName.c_str(), ret, retval);
}

status_t DeviceHalHidl::releaseAudioPatch(audio_patch_handle_t patch) {