Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b0b971b authored by Chih-Hung Hsieh's avatar Chih-Hung Hsieh
Browse files

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
parent 9831a9b5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -284,7 +284,7 @@ const SortedVector<String8>* VendorTagDescriptor::getAllSectionNames() const {
    return &mSections;
}

status_t VendorTagDescriptor::lookupTag(String8 name, String8 section, /*out*/uint32_t* tag) const {
status_t VendorTagDescriptor::lookupTag(const String8& name, const String8& section, /*out*/uint32_t* tag) const {
    ssize_t index = mReverseMapping.indexOfKey(section);
    if (index < 0) {
        ALOGE("%s: Section '%s' does not exist.", __FUNCTION__, section.string());
+1 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ class VendorTagDescriptor : public Parcelable {
         *
         * Returns OK on success, or a negative error code.
         */
        status_t lookupTag(String8 name, String8 section, /*out*/uint32_t* tag) const;
        status_t lookupTag(const String8& name, const String8& section, /*out*/uint32_t* tag) const;

        /**
         * Dump the currently configured vendor tags to a file descriptor.
+1 −1
Original line number Diff line number Diff line
@@ -812,7 +812,7 @@ status_t CameraHardwareInterfaceFlashControl::getSmallestSurfaceSize(
}

status_t CameraHardwareInterfaceFlashControl::initializePreviewWindow(
        sp<CameraHardwareInterface> device, int32_t width, int32_t height) {
        const sp<CameraHardwareInterface>& device, int32_t width, int32_t height) {
    status_t res;
    BufferQueue::createBufferQueue(&mProducer, &mConsumer);

+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ class CameraHardwareInterfaceFlashControl : public FlashControlBase {
        status_t disconnectCameraDevice();

        // initialize the preview window
        status_t initializePreviewWindow(sp<CameraHardwareInterface> device,
        status_t initializePreviewWindow(const sp<CameraHardwareInterface>& device,
                int32_t width, int32_t height);

        // start preview and enable torch
+2 −2
Original line number Diff line number Diff line
@@ -2366,7 +2366,7 @@ String8 CameraService::CameraState::getId() const {
void CameraService::ClientEventListener::onClientAdded(
        const resource_policy::ClientDescriptor<String8,
        sp<CameraService::BasicClient>>& descriptor) {
    auto basicClient = descriptor.getValue();
    const auto& basicClient = descriptor.getValue();
    if (basicClient.get() != nullptr) {
        BatteryNotifier& notifier(BatteryNotifier::getInstance());
        notifier.noteStartCamera(descriptor.getKey(),
@@ -2377,7 +2377,7 @@ void CameraService::ClientEventListener::onClientAdded(
void CameraService::ClientEventListener::onClientRemoved(
        const resource_policy::ClientDescriptor<String8,
        sp<CameraService::BasicClient>>& descriptor) {
    auto basicClient = descriptor.getValue();
    const auto& basicClient = descriptor.getValue();
    if (basicClient.get() != nullptr) {
        BatteryNotifier& notifier(BatteryNotifier::getInstance());
        notifier.noteStopCamera(descriptor.getKey(),
Loading