diff --git a/audio/core/all-versions/default/ParametersUtil.cpp b/audio/core/all-versions/default/ParametersUtil.cpp index c0e29030e0..eb2d2c2320 100644 --- a/audio/core/all-versions/default/ParametersUtil.cpp +++ b/audio/core/all-versions/default/ParametersUtil.cpp @@ -97,15 +97,15 @@ void ParametersUtil::getParametersImpl( retval = getHalStatusToResult(status); break; } - result[i].key = halKey.string(); - result[i].value = halValue.string(); + result[i].key = halKey.c_str(); + result[i].value = halValue.c_str(); } cb(retval, result); } std::unique_ptr ParametersUtil::getParams(const AudioParameter& keys) { String8 paramsAndValues; - char* halValues = halGetParameters(keys.keysToString().string()); + char* halValues = halGetParameters(keys.keysToString().c_str()); if (halValues != NULL) { paramsAndValues.setTo(halValues); free(halValues); @@ -163,7 +163,7 @@ Result ParametersUtil::setParam(const char* name, const DeviceAddress& address) } Result ParametersUtil::setParams(const AudioParameter& param) { - int halStatus = halSetParameters(param.toString().string()); + int halStatus = halSetParameters(param.toString().c_str()); return util::analyzeStatus(halStatus); } diff --git a/audio/core/all-versions/default/Stream.cpp b/audio/core/all-versions/default/Stream.cpp index 8e85a8b255..c11b675a7f 100644 --- a/audio/core/all-versions/default/Stream.cpp +++ b/audio/core/all-versions/default/Stream.cpp @@ -114,7 +114,7 @@ Return Stream::getSupportedSampleRates(AudioFormat format, SampleRateSet halSampleRates; if (result == Result::OK) { halSampleRates = - samplingRatesFromString(halListValue.string(), AudioParameter::valueListSeparator); + samplingRatesFromString(halListValue.c_str(), AudioParameter::valueListSeparator); sampleRates = hidl_vec(halSampleRates.begin(), halSampleRates.end()); // Legacy get_parameter does not return a status_t, thus can not advertise of failure. // Note that this method must succeed (non empty list) if the format is supported. @@ -140,7 +140,7 @@ Return Stream::getSupportedChannelMasks(AudioFormat format, ChannelMaskSet halChannelMasks; if (result == Result::OK) { halChannelMasks = - channelMasksFromString(halListValue.string(), AudioParameter::valueListSeparator); + channelMasksFromString(halListValue.c_str(), AudioParameter::valueListSeparator); channelMasks.resize(halChannelMasks.size()); size_t i = 0; for (auto channelMask : halChannelMasks) { @@ -182,7 +182,7 @@ Return Stream::getSupportedFormats(getSupportedFormats_cb _hidl_cb) { hidl_vec formats; FormatVector halFormats; if (result == Result::OK) { - halFormats = formatsFromString(halListValue.string(), AudioParameter::valueListSeparator); + halFormats = formatsFromString(halListValue.c_str(), AudioParameter::valueListSeparator); formats.resize(halFormats.size()); for (size_t i = 0; i < halFormats.size(); ++i) { formats[i] = AudioFormat(halFormats[i]); @@ -226,7 +226,7 @@ Return Stream::getSupportedProfiles(getSupportedProfiles_cb _hidl_cb) { // Ensure that the separator is one character, despite that it's defined as a C string. static_assert(sizeof(AUDIO_PARAMETER_VALUE_LIST_SEPARATOR) == 2); std::vector halFormats = - splitString(halListValue.string(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); + splitString(halListValue.c_str(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); hidl_vec formats; (void)HidlUtils::audioFormatsFromHal(halFormats, &formats); std::vector tempProfiles; @@ -241,7 +241,7 @@ Return Stream::getSupportedProfiles(getSupportedProfiles_cb _hidl_cb) { result = getParam(AudioParameter::keyStreamSupportedSamplingRates, &halListValue, context); if (result != Result::OK) break; std::vector halSampleRates = - splitString(halListValue.string(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); + splitString(halListValue.c_str(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); hidl_vec sampleRates; sampleRates.resize(halSampleRates.size()); for (size_t i = 0; i < sampleRates.size(); ++i) { @@ -251,7 +251,7 @@ Return Stream::getSupportedProfiles(getSupportedProfiles_cb _hidl_cb) { result = getParam(AudioParameter::keyStreamSupportedChannels, &halListValue, context); if (result != Result::OK) break; std::vector halChannelMasks = - splitString(halListValue.string(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); + splitString(halListValue.c_str(), AUDIO_PARAMETER_VALUE_LIST_SEPARATOR[0]); hidl_vec channelMasks; (void)HidlUtils::audioChannelMasksFromHal(halChannelMasks, &channelMasks); // Create a profile.