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
Bug: 265487852
Test: Presubmit, ran CtsCameraTestCases on Cuttlefish, adb shell dumpsys media camera and observed output
diff --git a/services/camera/libcameraservice/common/FrameProducer.h b/services/camera/libcameraservice/common/FrameProducer.h
index a14b3d6..dd4df7d 100644
--- a/services/camera/libcameraservice/common/FrameProducer.h
+++ b/services/camera/libcameraservice/common/FrameProducer.h
@@ -18,7 +18,6 @@
#define ANDROID_SERVERS_CAMERA_FRAMEPRODUCER_H
#include <utils/RefBase.h>
-#include <utils/String8.h>
#include <utils/Timers.h>
#include "camera/CameraMetadata.h"
@@ -39,7 +38,7 @@
/**
* Retrieve the device camera ID
*/
- virtual const String8& getId() const = 0;
+ virtual const std::string& getId() const = 0;
/**
* Wait for a new frame to be produced, with timeout in nanoseconds.