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/api2/CameraOfflineSessionClient.h b/services/camera/libcameraservice/api2/CameraOfflineSessionClient.h
index ad763f9..70bad03 100644
--- a/services/camera/libcameraservice/api2/CameraOfflineSessionClient.h
+++ b/services/camera/libcameraservice/api2/CameraOfflineSessionClient.h
@@ -47,9 +47,9 @@
sp<CameraOfflineSessionBase> session,
const KeyedVector<sp<IBinder>, sp<CompositeStream>>& offlineCompositeStreamMap,
const sp<ICameraDeviceCallbacks>& remoteCallback,
- const String16& clientPackageName,
- const std::optional<String16>& clientFeatureId,
- const String8& cameraIdStr, int cameraFacing, int sensorOrientation,
+ const std::string& clientPackageName,
+ const std::optional<std::string>& clientFeatureId,
+ const std::string& cameraIdStr, int cameraFacing, int sensorOrientation,
int clientPid, uid_t clientUid, int servicePid) :
CameraService::BasicClient(
cameraService,
@@ -73,12 +73,12 @@
status_t dumpClient(int /*fd*/, const Vector<String16>& /*args*/) override;
- status_t startWatchingTags(const String8 &tags, int outFd) override;
+ status_t startWatchingTags(const std::string &tags, int outFd) override;
status_t stopWatchingTags(int outFd) override;
status_t dumpWatchedEventsToVector(std::vector<std::string> &out) override;
status_t initialize(sp<CameraProviderManager> /*manager*/,
- const String8& /*monitorTags*/) override;
+ const std::string& /*monitorTags*/) override;
status_t setRotateAndCropOverride(uint8_t rotateAndCrop) override;
@@ -117,7 +117,7 @@
void notifyPrepared(int streamId) override;
void notifyRequestQueueEmpty() override;
void notifyRepeatingRequestError(long lastFrameNumber) override;
- status_t injectCamera(const String8& injectedCamId,
+ status_t injectCamera(const std::string& injectedCamId,
sp<CameraProviderManager> manager) override;
status_t stopInjection() override;