cameraservice: Migrate all internal String8/String16s to std::string
String8 and String16 are deprecated classes. It is recommended to use
std::string or std::u16string wherever possible. String16 is the native
string class for aidl, but Strings marked @utf8InCpp can use std::string
directly.
This patch standardizes libcameraservice's use of strings to
std::string, which is capable of storing utf-8 strings. This makes the
code more readable and potentially reduces the number of string copies
to a minimum.
A new set of string utils is added to frameworks/av/camera to aid this
migration.
Bug: 265487852
Test: Presubmit, ran CtsCameraTestCases on Cuttlefish, adb shell dumpsys media camera and observed output
Change-Id: I2b258a8636030dc4b7751140db43981b39c64f0d
Merged-In: I59330ac03c8a52b6c21a2388bba0c143e68af4cf
diff --git a/services/camera/libcameraservice/device3/Camera3DeviceInjectionMethods.cpp b/services/camera/libcameraservice/device3/Camera3DeviceInjectionMethods.cpp
index 031c255..4640f2d 100644
--- a/services/camera/libcameraservice/device3/Camera3DeviceInjectionMethods.cpp
+++ b/services/camera/libcameraservice/device3/Camera3DeviceInjectionMethods.cpp
@@ -155,7 +155,7 @@
return mIsStreamConfigCompleteButNotInjected;
}
-const String8& Camera3Device::Camera3DeviceInjectionMethods::getInjectedCamId()
+const std::string& Camera3Device::Camera3DeviceInjectionMethods::getInjectedCamId()
const {
return mInjectedCamId;
}
@@ -204,7 +204,7 @@
// Start configuring the streams
ALOGV("%s: Injection camera %s: Starting stream configuration", __FUNCTION__,
- mInjectedCamId.string());
+ mInjectedCamId.c_str());
parent->mPreparerThread->pause();
@@ -247,12 +247,12 @@
parent->internalUpdateStatusLocked(STATUS_CONFIGURED);
ALOGV("%s: Injection camera %s: Stream configuration complete", __FUNCTION__,
- mInjectedCamId.string());
+ mInjectedCamId.c_str());
auto rc = parent->mPreparerThread->resume();
if (rc != OK) {
ALOGE("%s: Injection camera %s: Preparer thread failed to resume!",
- __FUNCTION__, mInjectedCamId.string());
+ __FUNCTION__, mInjectedCamId.c_str());
return rc;
}