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/camera/aidl/android/hardware/ICameraServiceProxy.aidl b/camera/aidl/android/hardware/ICameraServiceProxy.aidl
index 4faa6b4..dcd69b0 100644
--- a/camera/aidl/android/hardware/ICameraServiceProxy.aidl
+++ b/camera/aidl/android/hardware/ICameraServiceProxy.aidl
@@ -44,14 +44,14 @@
* {@link android.hardware.camera2.CameraMetadata#SCALER_ROTATE_AND_CROP_180},
* {@link android.hardware.camera2.CameraMetadata#SCALER_ROTATE_AND_CROP_270}).
*/
- int getRotateAndCropOverride(String packageName, int lensFacing, int userId);
+ int getRotateAndCropOverride(@utf8InCpp String packageName, int lensFacing, int userId);
/**
* Returns the necessary autoframing override for the top activity which
* will be one of ({@link android.hardware.camera2.CameraMetadata#AUTOFRAMING_FALSE},
* {@link android.hardware.camera2.CameraMetadata#AUTOFRAMING_TRUE}).
*/
- int getAutoframingOverride(String packageName);
+ int getAutoframingOverride(@utf8InCpp String packageName);
/**
* Checks if the camera has been disabled via device policy.