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.
Change-Id: I59330ac03c8a52b6c21a2388bba0c143e68af4cf
Merged-In: I59330ac03c8a52b6c21a2388bba0c143e68af4cf
Bug: 265487852
Test: Presubmit, ran CtsCameraTestCases on Cuttlefish, adb shell dumpsys media camera and observed output
diff --git a/services/camera/libcameraservice/api1/Camera2Client.h b/services/camera/libcameraservice/api1/Camera2Client.h
index a7ea823..9ec1eb5 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.h
+++ b/services/camera/libcameraservice/api1/Camera2Client.h
@@ -103,9 +103,9 @@
Camera2Client(const sp<CameraService>& cameraService,
const sp<hardware::ICameraClient>& cameraClient,
std::shared_ptr<CameraServiceProxyWrapper> cameraServiceProxyWrapper,
- const String16& clientPackageName,
- const std::optional<String16>& clientFeatureId,
- const String8& cameraDeviceId,
+ const std::string& clientPackageName,
+ const std::optional<std::string>& clientFeatureId,
+ const std::string& cameraDeviceId,
int api1CameraId,
int cameraFacing,
int sensorOrientation,
@@ -119,7 +119,7 @@
virtual ~Camera2Client();
virtual status_t initialize(sp<CameraProviderManager> manager,
- const String8& monitorTags) override;
+ const std::string& monitorTags) override;
virtual status_t dump(int fd, const Vector<String16>& args);
@@ -244,7 +244,7 @@
status_t overrideVideoSnapshotSize(Parameters ¶ms);
template<typename TProviderPtr>
- status_t initializeImpl(TProviderPtr providerPtr, const String8& monitorTags);
+ status_t initializeImpl(TProviderPtr providerPtr, const std::string& monitorTags);
bool isZslEnabledInStillTemplate();
// The current rotate & crop mode passed by camera service