Fix clang-tidy warnings in camera.
* Add explicit keyword to conversion constructors.
Bug: 28341362
* Use const reference type for read-only parameters.
Bug: 30407689
* Use const reference type to avoid unnecessary copy.
Bug: 30413862
Test: build with WITH_TIDY=1
Change-Id: I71d3008da843ba5f1df1a73a320fb2af6ceffa16
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index 17893a9..33429a6 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -65,7 +65,7 @@
private camera3_callback_ops {
public:
- Camera3Device(int id);
+ explicit Camera3Device(int id);
virtual ~Camera3Device();
@@ -220,7 +220,7 @@
struct Size {
uint32_t width;
uint32_t height;
- Size(uint32_t w = 0, uint32_t h = 0) : width(w), height(h){}
+ explicit Size(uint32_t w = 0, uint32_t h = 0) : width(w), height(h){}
};
// Map from format to size.
Vector<Size> mSupportedOpaqueInputSizes;
@@ -589,10 +589,10 @@
void setErrorState(const char *fmt, ...);
// If the input request is in mRepeatingRequests. Must be called with mRequestLock hold
- bool isRepeatingRequestLocked(const sp<CaptureRequest>);
+ bool isRepeatingRequestLocked(const sp<CaptureRequest>&);
// Handle AE precapture trigger cancel for devices <= CAMERA_DEVICE_API_VERSION_3_2.
- void handleAePrecaptureCancelRequest(sp<CaptureRequest> request);
+ void handleAePrecaptureCancelRequest(const sp<CaptureRequest>& request);
// Clear repeating requests. Must be called with mRequestLock held.
status_t clearRepeatingRequestsLocked(/*out*/ int64_t *lastFrameNumber = NULL);