Use explicit .c_str() for hidl_string
hidl_string no longer will provide an implicit cast to const char* as it
interfers with other expected behaviors of the class. It now emulated
std::string in requiring a call to .c_str() to get the same behavior.
Bug: 36532780
Test: Build the tree
Change-Id: I265590c7c18f425e44863df062a56b67519a932a
diff --git a/automotive/evs/1.0/default/EvsEnumerator.cpp b/automotive/evs/1.0/default/EvsEnumerator.cpp
index 731e21b..b25d418 100644
--- a/automotive/evs/1.0/default/EvsEnumerator.cpp
+++ b/automotive/evs/1.0/default/EvsEnumerator.cpp
@@ -99,7 +99,7 @@
}
// Construct a camera instance for the caller
- pActiveCamera = new EvsCamera(cameraId);
+ pActiveCamera = new EvsCamera(cameraId.c_str());
pRecord->activeInstance = pActiveCamera;
if (pActiveCamera == nullptr) {
ALOGE("Failed to allocate new EvsCamera object for %s\n", cameraId.c_str());
diff --git a/drm/1.0/default/CryptoPlugin.cpp b/drm/1.0/default/CryptoPlugin.cpp
index 9c51b15..5e5b5a7 100644
--- a/drm/1.0/default/CryptoPlugin.cpp
+++ b/drm/1.0/default/CryptoPlugin.cpp
@@ -35,7 +35,7 @@
// Methods from ::android::hardware::drm::V1_0::ICryptoPlugin follow
Return<bool> CryptoPlugin::requiresSecureDecoderComponent(
const hidl_string& mime) {
- return mLegacyPlugin->requiresSecureDecoderComponent(mime);
+ return mLegacyPlugin->requiresSecureDecoderComponent(mime.c_str());
}
Return<void> CryptoPlugin::notifyResolution(uint32_t width,
diff --git a/drm/1.0/default/DrmPlugin.cpp b/drm/1.0/default/DrmPlugin.cpp
index c7428a5..bfe0646 100644
--- a/drm/1.0/default/DrmPlugin.cpp
+++ b/drm/1.0/default/DrmPlugin.cpp
@@ -70,15 +70,15 @@
if (status == android::OK) {
android::KeyedVector<String8, String8> legacyOptionalParameters;
for (size_t i = 0; i < optionalParameters.size(); i++) {
- legacyOptionalParameters.add(String8(optionalParameters[i].key),
- String8(optionalParameters[i].value));
+ legacyOptionalParameters.add(String8(optionalParameters[i].key.c_str()),
+ String8(optionalParameters[i].value.c_str()));
}
android::DrmPlugin::KeyRequestType legacyRequestType =
android::DrmPlugin::kKeyRequestType_Unknown;
status = mLegacyPlugin->getKeyRequest(toVector(scope),
- toVector(initData), String8(mimeType), legacyKeyType,
+ toVector(initData), String8(mimeType.c_str()), legacyKeyType,
legacyOptionalParameters, legacyRequest, defaultUrl,
&legacyRequestType);
@@ -149,7 +149,7 @@
Vector<uint8_t> legacyRequest;
String8 legacyDefaultUrl;
status_t status = mLegacyPlugin->getProvisionRequest(
- String8(certificateType), String8(certificateAuthority),
+ String8(certificateType.c_str()), String8(certificateAuthority.c_str()),
legacyRequest, legacyDefaultUrl);
_hidl_cb(toStatus(status), toHidlVec(legacyRequest),
@@ -217,7 +217,7 @@
getPropertyString_cb _hidl_cb) {
String8 legacyValue;
status_t status = mLegacyPlugin->getPropertyString(
- String8(propertyName), legacyValue);
+ String8(propertyName.c_str()), legacyValue);
_hidl_cb(toStatus(status), legacyValue.string());
return Void();
}
@@ -226,7 +226,7 @@
getPropertyByteArray_cb _hidl_cb) {
Vector<uint8_t> legacyValue;
status_t status = mLegacyPlugin->getPropertyByteArray(
- String8(propertyName), legacyValue);
+ String8(propertyName.c_str()), legacyValue);
_hidl_cb(toStatus(status), toHidlVec(legacyValue));
return Void();
}
@@ -234,15 +234,15 @@
Return<Status> DrmPlugin::setPropertyString(const hidl_string& propertyName,
const hidl_string& value) {
status_t legacyStatus =
- mLegacyPlugin->setPropertyString(String8(propertyName),
- String8(value));
+ mLegacyPlugin->setPropertyString(String8(propertyName.c_str()),
+ String8(value.c_str()));
return toStatus(legacyStatus);
}
Return<Status> DrmPlugin::setPropertyByteArray(
const hidl_string& propertyName, const hidl_vec<uint8_t>& value) {
status_t legacyStatus =
- mLegacyPlugin->setPropertyByteArray(String8(propertyName),
+ mLegacyPlugin->setPropertyByteArray(String8(propertyName.c_str()),
toVector(value));
return toStatus(legacyStatus);
}
@@ -251,7 +251,7 @@
const hidl_vec<uint8_t>& sessionId, const hidl_string& algorithm) {
status_t legacyStatus =
mLegacyPlugin->setCipherAlgorithm(toVector(sessionId),
- String8(algorithm));
+ String8(algorithm.c_str()));
return toStatus(legacyStatus);
}
@@ -259,7 +259,7 @@
const hidl_vec<uint8_t>& sessionId, const hidl_string& algorithm) {
status_t legacyStatus =
mLegacyPlugin->setMacAlgorithm(toVector(sessionId),
- String8(algorithm));
+ String8(algorithm.c_str()));
return toStatus(legacyStatus);
}
@@ -313,7 +313,7 @@
Vector<uint8_t> legacySignature;
status_t status = mLegacyPlugin->signRSA(toVector(sessionId),
- String8(algorithm), toVector(message), toVector(wrappedKey),
+ String8(algorithm.c_str()), toVector(message), toVector(wrappedKey),
legacySignature);
_hidl_cb(toStatus(status), toHidlVec(legacySignature));
return Void();
diff --git a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
index a65c7b8..14c4a2a 100644
--- a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
+++ b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
@@ -616,7 +616,7 @@
switch (type) {
#define CHECK_TYPE_STRING_FOR_SENSOR_TYPE(type) \
- case SensorType::type: ASSERT_STREQ(SENSOR_STRING_TYPE_ ## type, stringType); break;
+ case SensorType::type: ASSERT_STREQ(SENSOR_STRING_TYPE_ ## type, stringType.c_str()); break;
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ACCELEROMETER);
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ACCELEROMETER_UNCALIBRATED);
CHECK_TYPE_STRING_FOR_SENSOR_TYPE(ADDITIONAL_INFO);