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

Commit e6477dc8 authored by Changyeon Jo's avatar Changyeon Jo
Browse files

Use Google-style C++ loggers

This change replaces ALOG* usages in VtsHalEvsV1_1 with Google-style
C++ loggers.

Bug: 150893461
Test: Run VtsHalEvsV1_1TargetTest
Change-Id: Ia93c5a00d580bae99d15a7a893e57e0f1e2397d5
parent d6f4acf5
Loading
Loading
Loading
Loading
+76 −62
Original line number Original line Diff line number Diff line
@@ -38,16 +38,15 @@ static const float kNanoToSeconds = 0.000000001f;


#include <hidl/HidlTransportSupport.h>
#include <hidl/HidlTransportSupport.h>
#include <hwbinder/ProcessState.h>
#include <hwbinder/ProcessState.h>
#include <log/log.h>
#include <utils/Errors.h>
#include <utils/Errors.h>
#include <utils/StrongPointer.h>
#include <utils/StrongPointer.h>


#include <android/log.h>
#include <android/hardware/automotive/evs/1.1/IEvsCamera.h>
#include <android/hardware/automotive/evs/1.1/IEvsCamera.h>
#include <android/hardware/automotive/evs/1.1/IEvsCameraStream.h>
#include <android/hardware/automotive/evs/1.1/IEvsCameraStream.h>
#include <android/hardware/automotive/evs/1.1/IEvsEnumerator.h>
#include <android/hardware/automotive/evs/1.1/IEvsEnumerator.h>
#include <android/hardware/automotive/evs/1.1/IEvsDisplay.h>
#include <android/hardware/automotive/evs/1.1/IEvsDisplay.h>
#include <android/hardware/camera/device/3.2/ICameraDevice.h>
#include <android/hardware/camera/device/3.2/ICameraDevice.h>
#include <android-base/logging.h>
#include <system/camera_metadata.h>
#include <system/camera_metadata.h>
#include <ui/DisplayConfig.h>
#include <ui/DisplayConfig.h>
#include <ui/DisplayState.h>
#include <ui/DisplayState.h>
@@ -120,11 +119,12 @@ protected:
        // Get the camera list
        // Get the camera list
        pEnumerator->getCameraList_1_1(
        pEnumerator->getCameraList_1_1(
            [this](hidl_vec <CameraDesc> cameraList) {
            [this](hidl_vec <CameraDesc> cameraList) {
                ALOGI("Camera list callback received %zu cameras",
                LOG(INFO) << "Camera list callback received "
                      cameraList.size());
                          << cameraList.size()
                          << " cameras";
                cameraInfo.reserve(cameraList.size());
                cameraInfo.reserve(cameraList.size());
                for (auto&& cam: cameraList) {
                for (auto&& cam: cameraList) {
                    ALOGI("Found camera %s", cam.v1.cameraId.c_str());
                    LOG(INFO) << "Found camera " << cam.v1.cameraId;
                    cameraInfo.push_back(cam);
                    cameraInfo.push_back(cam);
                }
                }
            }
            }
@@ -137,10 +137,12 @@ protected:


        // Get the ultrasonics array list
        // Get the ultrasonics array list
        pEnumerator->getUltrasonicsArrayList([this](hidl_vec<UltrasonicsArrayDesc> ultraList) {
        pEnumerator->getUltrasonicsArrayList([this](hidl_vec<UltrasonicsArrayDesc> ultraList) {
            ALOGI("Ultrasonics array list callback received %zu arrays", ultraList.size());
            LOG(INFO) << "Ultrasonics array list callback received "
                      << ultraList.size()
                      << " arrays";
            ultrasonicsArraysInfo.reserve(ultraList.size());
            ultrasonicsArraysInfo.reserve(ultraList.size());
            for (auto&& ultraArray : ultraList) {
            for (auto&& ultraArray : ultraList) {
                ALOGI("Found ultrasonics array %s", ultraArray.ultrasonicsArrayId.c_str());
                LOG(INFO) << "Found ultrasonics array " << ultraArray.ultrasonicsArrayId;
                ultrasonicsArraysInfo.push_back(ultraArray);
                ultrasonicsArraysInfo.push_back(ultraArray);
            }
            }
        });
        });
@@ -195,7 +197,7 @@ protected:
        if (!flag) {
        if (!flag) {
            // EVS assumes that the device w/o a valid metadata is a physical
            // EVS assumes that the device w/o a valid metadata is a physical
            // device.
            // device.
            ALOGI("%s is not a logical camera device.", id.c_str());
            LOG(INFO) << id << " is not a logical camera device.";
            physicalCameras.emplace(id);
            physicalCameras.emplace(id);
            return physicalCameras;
            return physicalCameras;
        }
        }
@@ -205,7 +207,9 @@ protected:
        int rc = find_camera_metadata_ro_entry(metadata,
        int rc = find_camera_metadata_ro_entry(metadata,
                                               ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS,
                                               ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS,
                                               &entry);
                                               &entry);
        ALOGE_IF(rc, "No physical camera ID is found for a logical camera device");
        if (rc != 0) {
            LOG(ERROR) << "No physical camera ID is found for a logical camera device";
        }


        const uint8_t *ids = entry.data.u8;
        const uint8_t *ids = entry.data.u8;
        size_t start = 0;
        size_t start = 0;
@@ -219,7 +223,10 @@ protected:
            }
            }
        }
        }


        ALOGI("%s consists of %d physical camera devices.", id.c_str(), (int)physicalCameras.size());
        LOG(INFO) << id
                  << " consists of "
                  << physicalCameras.size()
                  << " physical camera devices";
        return physicalCameras;
        return physicalCameras;
    }
    }


@@ -247,7 +254,7 @@ protected:
 * call to closeCamera.  Then repeats the test to ensure all cameras can be reopened.
 * call to closeCamera.  Then repeats the test to ensure all cameras can be reopened.
 */
 */
TEST_P(EvsHidlTest, CameraOpenClean) {
TEST_P(EvsHidlTest, CameraOpenClean) {
    ALOGI("Starting CameraOpenClean test");
    LOG(INFO) << "Starting CameraOpenClean test";


    // Get the camera list
    // Get the camera list
    loadCameraList();
    loadCameraList();
@@ -261,7 +268,7 @@ TEST_P(EvsHidlTest, CameraOpenClean) {
        bool isLogicalCam = false;
        bool isLogicalCam = false;
        auto devices = getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam);
        auto devices = getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam);
        if (mIsHwModule && isLogicalCam) {
        if (mIsHwModule && isLogicalCam) {
            ALOGI("Skip a logical device %s for HW module", cam.v1.cameraId.c_str());
            LOG(INFO) << "Skip a logical device, " << cam.v1.cameraId << " for HW target.";
            continue;
            continue;
        }
        }


@@ -286,7 +293,7 @@ TEST_P(EvsHidlTest, CameraOpenClean) {


            // Verify that this camera self-identifies correctly
            // Verify that this camera self-identifies correctly
            pCam->getCameraInfo_1_1([&cam](CameraDesc desc) {
            pCam->getCameraInfo_1_1([&cam](CameraDesc desc) {
                                        ALOGD("Found camera %s", desc.v1.cameraId.c_str());
                                        LOG(DEBUG) << "Found camera " << desc.v1.cameraId;
                                        EXPECT_EQ(cam.v1.cameraId, desc.v1.cameraId);
                                        EXPECT_EQ(cam.v1.cameraId, desc.v1.cameraId);
                                    }
                                    }
            );
            );
@@ -316,7 +323,7 @@ TEST_P(EvsHidlTest, CameraOpenClean) {
 * the system to be tolerant of shutdown/restart race conditions.
 * the system to be tolerant of shutdown/restart race conditions.
 */
 */
TEST_P(EvsHidlTest, CameraOpenAggressive) {
TEST_P(EvsHidlTest, CameraOpenAggressive) {
    ALOGI("Starting CameraOpenAggressive test");
    LOG(INFO) << "Starting CameraOpenAggressive test";


    // Get the camera list
    // Get the camera list
    loadCameraList();
    loadCameraList();
@@ -330,7 +337,7 @@ TEST_P(EvsHidlTest, CameraOpenAggressive) {
        bool isLogicalCam = false;
        bool isLogicalCam = false;
        getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam);
        getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam);
        if (mIsHwModule && isLogicalCam) {
        if (mIsHwModule && isLogicalCam) {
            ALOGI("Skip a logical device %s for HW module", cam.v1.cameraId.c_str());
            LOG(INFO) << "Skip a logical device, " << cam.v1.cameraId << " for HW target.";
            continue;
            continue;
        }
        }


@@ -345,7 +352,7 @@ TEST_P(EvsHidlTest, CameraOpenAggressive) {


        // Verify that this camera self-identifies correctly
        // Verify that this camera self-identifies correctly
        pCam->getCameraInfo_1_1([&cam](CameraDesc desc) {
        pCam->getCameraInfo_1_1([&cam](CameraDesc desc) {
                                    ALOGD("Found camera %s", desc.v1.cameraId.c_str());
                                    LOG(DEBUG) << "Found camera " << desc.v1.cameraId;
                                    EXPECT_EQ(cam.v1.cameraId, desc.v1.cameraId);
                                    EXPECT_EQ(cam.v1.cameraId, desc.v1.cameraId);
                                }
                                }
        );
        );
@@ -374,7 +381,7 @@ TEST_P(EvsHidlTest, CameraOpenAggressive) {


        // Verify that the second camera instance self-identifies correctly
        // Verify that the second camera instance self-identifies correctly
        pCam2->getCameraInfo_1_1([&cam](CameraDesc desc) {
        pCam2->getCameraInfo_1_1([&cam](CameraDesc desc) {
                                     ALOGD("Found camera %s", desc.v1.cameraId.c_str());
                                     LOG(DEBUG) << "Found camera " << desc.v1.cameraId;
                                     EXPECT_EQ(cam.v1.cameraId, desc.v1.cameraId);
                                     EXPECT_EQ(cam.v1.cameraId, desc.v1.cameraId);
                                 }
                                 }
        );
        );
@@ -393,7 +400,7 @@ TEST_P(EvsHidlTest, CameraOpenAggressive) {
 * Measure and qualify the stream start up time and streaming frame rate of each reported camera
 * Measure and qualify the stream start up time and streaming frame rate of each reported camera
 */
 */
TEST_P(EvsHidlTest, CameraStreamPerformance) {
TEST_P(EvsHidlTest, CameraStreamPerformance) {
    ALOGI("Starting CameraStreamPerformance test");
    LOG(INFO) << "Starting CameraStreamPerformance test";


    // Get the camera list
    // Get the camera list
    loadCameraList();
    loadCameraList();
@@ -407,7 +414,7 @@ TEST_P(EvsHidlTest, CameraStreamPerformance) {
        bool isLogicalCam = false;
        bool isLogicalCam = false;
        auto devices = getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam);
        auto devices = getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam);
        if (mIsHwModule && isLogicalCam) {
        if (mIsHwModule && isLogicalCam) {
            ALOGI("Skip a logical device %s", cam.v1.cameraId.c_str());
            LOG(INFO) << "Skip a logical device " << cam.v1.cameraId;
            continue;
            continue;
        }
        }


@@ -444,8 +451,10 @@ TEST_P(EvsHidlTest, CameraStreamPerformance) {
                  kMaxStreamStartMilliseconds * devices.size());
                  kMaxStreamStartMilliseconds * devices.size());
        printf("%s: Measured time to first frame %0.2f ms\n",
        printf("%s: Measured time to first frame %0.2f ms\n",
               cam.v1.cameraId.c_str(), timeToFirstFrame * kNanoToMilliseconds);
               cam.v1.cameraId.c_str(), timeToFirstFrame * kNanoToMilliseconds);
        ALOGI("%s: Measured time to first frame %0.2f ms",
        LOG(INFO) << cam.v1.cameraId
              cam.v1.cameraId.c_str(), timeToFirstFrame * kNanoToMilliseconds);
                  << ": Measured time to first frame "
                  << std::scientific << timeToFirstFrame * kNanoToMilliseconds
                  << " ms.";


        // Check aspect ratio
        // Check aspect ratio
        unsigned width = 0, height = 0;
        unsigned width = 0, height = 0;
@@ -468,7 +477,9 @@ TEST_P(EvsHidlTest, CameraStreamPerformance) {
        nsecs_t runTime = end - firstFrame;
        nsecs_t runTime = end - firstFrame;
        float framesPerSecond = framesReceived / (runTime * kNanoToSeconds);
        float framesPerSecond = framesReceived / (runTime * kNanoToSeconds);
        printf("Measured camera rate %3.2f fps\n", framesPerSecond);
        printf("Measured camera rate %3.2f fps\n", framesPerSecond);
        ALOGI("Measured camera rate %3.2f fps", framesPerSecond);
        LOG(INFO) << "Measured camera rate "
                  << std::scientific << framesPerSecond
                  << " fps.";
        EXPECT_GE(framesPerSecond, kMinimumFramesPerSecond);
        EXPECT_GE(framesPerSecond, kMinimumFramesPerSecond);


        // Explicitly release the camera
        // Explicitly release the camera
@@ -483,7 +494,7 @@ TEST_P(EvsHidlTest, CameraStreamPerformance) {
 * than one frame time.  The camera must cleanly skip frames until the client is ready again.
 * than one frame time.  The camera must cleanly skip frames until the client is ready again.
 */
 */
TEST_P(EvsHidlTest, CameraStreamBuffering) {
TEST_P(EvsHidlTest, CameraStreamBuffering) {
    ALOGI("Starting CameraStreamBuffering test");
    LOG(INFO) << "Starting CameraStreamBuffering test";


    // Arbitrary constant (should be > 1 and less than crazy)
    // Arbitrary constant (should be > 1 and less than crazy)
    static const unsigned int kBuffersToHold = 6;
    static const unsigned int kBuffersToHold = 6;
@@ -500,7 +511,7 @@ TEST_P(EvsHidlTest, CameraStreamBuffering) {
        bool isLogicalCam = false;
        bool isLogicalCam = false;
        getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam);
        getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam);
        if (mIsHwModule && isLogicalCam) {
        if (mIsHwModule && isLogicalCam) {
            ALOGI("Skip a logical device %s for HW module", cam.v1.cameraId.c_str());
            LOG(INFO) << "Skip a logical device " << cam.v1.cameraId << " for HW target.";
            continue;
            continue;
        }
        }


@@ -568,7 +579,7 @@ TEST_P(EvsHidlTest, CameraStreamBuffering) {
 * which a human could observe to see the operation of the system on the physical display.
 * which a human could observe to see the operation of the system on the physical display.
 */
 */
TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) {
TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) {
    ALOGI("Starting CameraToDisplayRoundTrip test");
    LOG(INFO) << "Starting CameraToDisplayRoundTrip test";


    // Get the camera list
    // Get the camera list
    loadCameraList();
    loadCameraList();
@@ -587,14 +598,14 @@ TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) {
    // Request exclusive access to the first EVS display
    // Request exclusive access to the first EVS display
    sp<IEvsDisplay_1_1> pDisplay = pEnumerator->openDisplay_1_1(targetDisplayId);
    sp<IEvsDisplay_1_1> pDisplay = pEnumerator->openDisplay_1_1(targetDisplayId);
    ASSERT_NE(pDisplay, nullptr);
    ASSERT_NE(pDisplay, nullptr);
    ALOGI("Display %d is in use.", targetDisplayId);
    LOG(INFO) << "Display " << targetDisplayId << " is alreay in use.";


    // Get the display descriptor
    // Get the display descriptor
    pDisplay->getDisplayInfo_1_1([](const auto& config, const auto& state) {
    pDisplay->getDisplayInfo_1_1([](const auto& config, const auto& state) {
        android::DisplayConfig* pConfig = (android::DisplayConfig*)config.data();
        android::DisplayConfig* pConfig = (android::DisplayConfig*)config.data();
        const auto width = pConfig->resolution.getWidth();
        const auto width = pConfig->resolution.getWidth();
        const auto height = pConfig->resolution.getHeight();
        const auto height = pConfig->resolution.getHeight();
        ALOGI("    Resolution: %dx%d", width, height);
        LOG(INFO) << "    Resolution: " << width << "x" << height;
        ASSERT_GT(width, 0);
        ASSERT_GT(width, 0);
        ASSERT_GT(height, 0);
        ASSERT_GT(height, 0);


@@ -607,7 +618,7 @@ TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) {
        bool isLogicalCam = false;
        bool isLogicalCam = false;
        getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam);
        getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam);
        if (mIsHwModule && isLogicalCam) {
        if (mIsHwModule && isLogicalCam) {
            ALOGI("Skip a logical device %s for HW module", cam.v1.cameraId.c_str());
            LOG(INFO) << "Skip a logical device " << cam.v1.cameraId << " for HW target.";
            continue;
            continue;
        }
        }


@@ -667,7 +678,7 @@ TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) {
 * underlying camera.
 * underlying camera.
 */
 */
TEST_P(EvsHidlTest, MultiCameraStream) {
TEST_P(EvsHidlTest, MultiCameraStream) {
    ALOGI("Starting MultiCameraStream test");
    LOG(INFO) << "Starting MultiCameraStream test";


    if (mIsHwModule) {
    if (mIsHwModule) {
        // This test is not for HW module implementation.
        // This test is not for HW module implementation.
@@ -735,7 +746,9 @@ TEST_P(EvsHidlTest, MultiCameraStream) {
        nsecs_t runTime = end - firstFrame;
        nsecs_t runTime = end - firstFrame;
        float framesPerSecond0 = framesReceived0 / (runTime * kNanoToSeconds);
        float framesPerSecond0 = framesReceived0 / (runTime * kNanoToSeconds);
        float framesPerSecond1 = framesReceived1 / (runTime * kNanoToSeconds);
        float framesPerSecond1 = framesReceived1 / (runTime * kNanoToSeconds);
        ALOGI("Measured camera rate %3.2f fps and %3.2f fps", framesPerSecond0, framesPerSecond1);
        LOG(INFO) << "Measured camera rate "
                  << std::scientific << framesPerSecond0 << " fps and "
                  << framesPerSecond1 << " fps";
        EXPECT_GE(framesPerSecond0, kMinimumFramesPerSecond);
        EXPECT_GE(framesPerSecond0, kMinimumFramesPerSecond);
        EXPECT_GE(framesPerSecond1, kMinimumFramesPerSecond);
        EXPECT_GE(framesPerSecond1, kMinimumFramesPerSecond);


@@ -774,7 +787,7 @@ TEST_P(EvsHidlTest, MultiCameraStream) {
 * Verify that a client can adjust a camera parameter.
 * Verify that a client can adjust a camera parameter.
 */
 */
TEST_P(EvsHidlTest, CameraParameter) {
TEST_P(EvsHidlTest, CameraParameter) {
    ALOGI("Starting CameraParameter test");
    LOG(INFO) << "Starting CameraParameter test";


    // Get the camera list
    // Get the camera list
    loadCameraList();
    loadCameraList();
@@ -791,7 +804,7 @@ TEST_P(EvsHidlTest, CameraParameter) {
        if (isLogicalCam) {
        if (isLogicalCam) {
            // TODO(b/145465724): Support camera parameter programming on
            // TODO(b/145465724): Support camera parameter programming on
            // logical devices.
            // logical devices.
            ALOGI("Skip a logical device %s", cam.v1.cameraId.c_str());
            LOG(INFO) << "Skip a logical device " << cam.v1.cameraId;
            continue;
            continue;
        }
        }


@@ -918,7 +931,7 @@ TEST_P(EvsHidlTest, CameraParameter) {
 * terminates or releases a role.
 * terminates or releases a role.
 */
 */
TEST_P(EvsHidlTest, CameraMasterRelease) {
TEST_P(EvsHidlTest, CameraMasterRelease) {
    ALOGI("Starting CameraMasterRelease test");
    LOG(INFO) << "Starting CameraMasterRelease test";


    if (mIsHwModule) {
    if (mIsHwModule) {
        // This test is not for HW module implementation.
        // This test is not for HW module implementation.
@@ -939,7 +952,7 @@ TEST_P(EvsHidlTest, CameraMasterRelease) {
        if (isLogicalCam) {
        if (isLogicalCam) {
            // TODO(b/145465724): Support camera parameter programming on
            // TODO(b/145465724): Support camera parameter programming on
            // logical devices.
            // logical devices.
            ALOGI("Skip a logical device %s", cam.v1.cameraId.c_str());
            LOG(INFO) << "Skip a logical device " << cam.v1.cameraId;
            continue;
            continue;
        }
        }


@@ -1012,7 +1025,7 @@ TEST_P(EvsHidlTest, CameraMasterRelease) {
                EvsEventDesc aTargetEvent;
                EvsEventDesc aTargetEvent;
                aTargetEvent.aType = EvsEventType::MASTER_RELEASED;
                aTargetEvent.aType = EvsEventType::MASTER_RELEASED;
                if (!frameHandlerNonMaster->waitForEvent(aTargetEvent, aNotification, true)) {
                if (!frameHandlerNonMaster->waitForEvent(aTargetEvent, aNotification, true)) {
                    ALOGW("A timer is expired before a target event is fired.");
                    LOG(WARNING) << "A timer is expired before a target event is fired.";
                }
                }


            }
            }
@@ -1057,7 +1070,7 @@ TEST_P(EvsHidlTest, CameraMasterRelease) {
                EvsEventDesc aTargetEvent;
                EvsEventDesc aTargetEvent;
                aTargetEvent.aType = EvsEventType::MASTER_RELEASED;
                aTargetEvent.aType = EvsEventType::MASTER_RELEASED;
                if (!frameHandlerMaster->waitForEvent(aTargetEvent, aNotification, true)) {
                if (!frameHandlerMaster->waitForEvent(aTargetEvent, aNotification, true)) {
                    ALOGW("A timer is expired before a target event is fired.");
                    LOG(WARNING) << "A timer is expired before a target event is fired.";
                }
                }


            }
            }
@@ -1099,7 +1112,7 @@ TEST_P(EvsHidlTest, CameraMasterRelease) {
 * camera parameters.
 * camera parameters.
 */
 */
TEST_P(EvsHidlTest, MultiCameraParameter) {
TEST_P(EvsHidlTest, MultiCameraParameter) {
    ALOGI("Starting MultiCameraParameter test");
    LOG(INFO) << "Starting MultiCameraParameter test";


    if (mIsHwModule) {
    if (mIsHwModule) {
        // This test is not for HW module implementation.
        // This test is not for HW module implementation.
@@ -1120,7 +1133,7 @@ TEST_P(EvsHidlTest, MultiCameraParameter) {
        if (isLogicalCam) {
        if (isLogicalCam) {
            // TODO(b/145465724): Support camera parameter programming on
            // TODO(b/145465724): Support camera parameter programming on
            // logical devices.
            // logical devices.
            ALOGI("Skip a logical device %s", cam.v1.cameraId.c_str());
            LOG(INFO) << "Skip a logical device " << cam.v1.cameraId;
            continue;
            continue;
        }
        }


@@ -1256,7 +1269,7 @@ TEST_P(EvsHidlTest, MultiCameraParameter) {
                    aTargetEvent.payload[0] = static_cast<uint32_t>(cmd);
                    aTargetEvent.payload[0] = static_cast<uint32_t>(cmd);
                    aTargetEvent.payload[1] = val0;
                    aTargetEvent.payload[1] = val0;
                    if (!frameHandlerMaster->waitForEvent(aTargetEvent, aNotification0)) {
                    if (!frameHandlerMaster->waitForEvent(aTargetEvent, aNotification0)) {
                        ALOGW("A timer is expired before a target event is fired.");
                        LOG(WARNING) << "A timer is expired before a target event is fired.";
                    }
                    }
                }
                }
            );
            );
@@ -1273,7 +1286,7 @@ TEST_P(EvsHidlTest, MultiCameraParameter) {
                    aTargetEvent.payload[0] = static_cast<uint32_t>(cmd);
                    aTargetEvent.payload[0] = static_cast<uint32_t>(cmd);
                    aTargetEvent.payload[1] = val0;
                    aTargetEvent.payload[1] = val0;
                    if (!frameHandlerNonMaster->waitForEvent(aTargetEvent, aNotification1)) {
                    if (!frameHandlerNonMaster->waitForEvent(aTargetEvent, aNotification1)) {
                        ALOGW("A timer is expired before a target event is fired.");
                        LOG(WARNING) << "A timer is expired before a target event is fired.";
                    }
                    }
                }
                }
            );
            );
@@ -1374,7 +1387,7 @@ TEST_P(EvsHidlTest, MultiCameraParameter) {
                EvsEventDesc aTargetEvent;
                EvsEventDesc aTargetEvent;
                aTargetEvent.aType = EvsEventType::MASTER_RELEASED;
                aTargetEvent.aType = EvsEventType::MASTER_RELEASED;
                if (!frameHandlerNonMaster->waitForEvent(aTargetEvent, aNotification0, true)) {
                if (!frameHandlerNonMaster->waitForEvent(aTargetEvent, aNotification0, true)) {
                    ALOGW("A timer is expired before a target event is fired.");
                    LOG(WARNING) << "A timer is expired before a target event is fired.";
                }
                }
            }
            }
        );
        );
@@ -1466,7 +1479,7 @@ TEST_P(EvsHidlTest, MultiCameraParameter) {
                    aTargetEvent.payload[0] = static_cast<uint32_t>(cmd);
                    aTargetEvent.payload[0] = static_cast<uint32_t>(cmd);
                    aTargetEvent.payload[1] = val0;
                    aTargetEvent.payload[1] = val0;
                    if (!frameHandlerMaster->waitForEvent(aTargetEvent, aNotification0)) {
                    if (!frameHandlerMaster->waitForEvent(aTargetEvent, aNotification0)) {
                        ALOGW("A timer is expired before a target event is fired.");
                        LOG(WARNING) << "A timer is expired before a target event is fired.";
                    }
                    }
                }
                }
            );
            );
@@ -1482,7 +1495,7 @@ TEST_P(EvsHidlTest, MultiCameraParameter) {
                    aTargetEvent.payload[0] = static_cast<uint32_t>(cmd);
                    aTargetEvent.payload[0] = static_cast<uint32_t>(cmd);
                    aTargetEvent.payload[1] = val0;
                    aTargetEvent.payload[1] = val0;
                    if (!frameHandlerNonMaster->waitForEvent(aTargetEvent, aNotification1)) {
                    if (!frameHandlerNonMaster->waitForEvent(aTargetEvent, aNotification1)) {
                        ALOGW("A timer is expired before a target event is fired.");
                        LOG(WARNING) << "A timer is expired before a target event is fired.";
                    }
                    }
                }
                }
            );
            );
@@ -1572,7 +1585,7 @@ TEST_P(EvsHidlTest, MultiCameraParameter) {
 * a master role from other EVS clients without the display.
 * a master role from other EVS clients without the display.
 */
 */
TEST_P(EvsHidlTest, HighPriorityCameraClient) {
TEST_P(EvsHidlTest, HighPriorityCameraClient) {
    ALOGI("Starting HighPriorityCameraClient test");
    LOG(INFO) << "Starting HighPriorityCameraClient test";


    if (mIsHwModule) {
    if (mIsHwModule) {
        // This test is not for HW module implementation.
        // This test is not for HW module implementation.
@@ -1687,7 +1700,7 @@ TEST_P(EvsHidlTest, HighPriorityCameraClient) {
                    aTargetEvent.payload[0] = static_cast<uint32_t>(CameraParam::AUTO_FOCUS);
                    aTargetEvent.payload[0] = static_cast<uint32_t>(CameraParam::AUTO_FOCUS);
                    aTargetEvent.payload[1] = 0;
                    aTargetEvent.payload[1] = 0;
                    if (!frameHandler0->waitForEvent(aTargetEvent, aNotification)) {
                    if (!frameHandler0->waitForEvent(aTargetEvent, aNotification)) {
                        ALOGW("A timer is expired before a target event is fired.");
                        LOG(WARNING) << "A timer is expired before a target event is fired.";
                    }
                    }
                }
                }
            );
            );
@@ -1740,7 +1753,7 @@ TEST_P(EvsHidlTest, HighPriorityCameraClient) {
                aTargetEvent.payload[0] = static_cast<uint32_t>(cam1Cmds[0]);
                aTargetEvent.payload[0] = static_cast<uint32_t>(cam1Cmds[0]);
                aTargetEvent.payload[1] = val0;
                aTargetEvent.payload[1] = val0;
                if (!frameHandler1->waitForEvent(aTargetEvent, aNotification)) {
                if (!frameHandler1->waitForEvent(aTargetEvent, aNotification)) {
                    ALOGW("A timer is expired before a target event is fired.");
                    LOG(WARNING) << "A timer is expired before a target event is fired.";
                }
                }
            }
            }
        );
        );
@@ -1791,7 +1804,7 @@ TEST_P(EvsHidlTest, HighPriorityCameraClient) {
                EvsEventDesc aTargetEvent;
                EvsEventDesc aTargetEvent;
                aTargetEvent.aType = EvsEventType::MASTER_RELEASED;
                aTargetEvent.aType = EvsEventType::MASTER_RELEASED;
                if (!frameHandler1->waitForEvent(aTargetEvent, aNotification, true)) {
                if (!frameHandler1->waitForEvent(aTargetEvent, aNotification, true)) {
                    ALOGW("A timer is expired before a target event is fired.");
                    LOG(WARNING) << "A timer is expired before a target event is fired.";
                }
                }
            }
            }
        );
        );
@@ -1833,7 +1846,7 @@ TEST_P(EvsHidlTest, HighPriorityCameraClient) {
                    aTargetEvent.payload[0] = static_cast<uint32_t>(CameraParam::AUTO_FOCUS);
                    aTargetEvent.payload[0] = static_cast<uint32_t>(CameraParam::AUTO_FOCUS);
                    aTargetEvent.payload[1] = 0;
                    aTargetEvent.payload[1] = 0;
                    if (!frameHandler1->waitForEvent(aTargetEvent, aNotification)) {
                    if (!frameHandler1->waitForEvent(aTargetEvent, aNotification)) {
                        ALOGW("A timer is expired before a target event is fired.");
                        LOG(WARNING) << "A timer is expired before a target event is fired.";
                    }
                    }
                }
                }
            );
            );
@@ -1882,7 +1895,7 @@ TEST_P(EvsHidlTest, HighPriorityCameraClient) {
                aTargetEvent.payload[0] = static_cast<uint32_t>(cam0Cmds[0]);
                aTargetEvent.payload[0] = static_cast<uint32_t>(cam0Cmds[0]);
                aTargetEvent.payload[1] = val0;
                aTargetEvent.payload[1] = val0;
                if (!frameHandler0->waitForEvent(aTargetEvent, aNotification)) {
                if (!frameHandler0->waitForEvent(aTargetEvent, aNotification)) {
                    ALOGW("A timer is expired before a target event is fired.");
                    LOG(WARNING) << "A timer is expired before a target event is fired.";
                }
                }
            }
            }
        );
        );
@@ -1945,7 +1958,7 @@ TEST_P(EvsHidlTest, HighPriorityCameraClient) {
 * configurations from EVS and uses one of them to start a video stream.
 * configurations from EVS and uses one of them to start a video stream.
 */
 */
TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) {
TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) {
    ALOGI("Starting CameraUseStreamConfigToDisplay test");
    LOG(INFO) << "Starting CameraUseStreamConfigToDisplay test";


    // Get the camera list
    // Get the camera list
    loadCameraList();
    loadCameraList();
@@ -2049,7 +2062,7 @@ TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) {
 * underlying camera with same configuration.
 * underlying camera with same configuration.
 */
 */
TEST_P(EvsHidlTest, MultiCameraStreamUseConfig) {
TEST_P(EvsHidlTest, MultiCameraStreamUseConfig) {
    ALOGI("Starting MultiCameraStream test");
    LOG(INFO) << "Starting MultiCameraStream test";


    if (mIsHwModule) {
    if (mIsHwModule) {
        // This test is not for HW module implementation.
        // This test is not for HW module implementation.
@@ -2094,9 +2107,8 @@ TEST_P(EvsHidlTest, MultiCameraStreamUseConfig) {
            static_cast<PixelFormat>(HAL_PIXEL_FORMAT_RGBA_8888);
            static_cast<PixelFormat>(HAL_PIXEL_FORMAT_RGBA_8888);


        if (!foundCfg) {
        if (!foundCfg) {
            ALOGI("Device %s does not provide a list of supported stream configurations, skipped",
            LOG(INFO) << "Device " << cam.v1.cameraId
                  cam.v1.cameraId.c_str());
                      << " does not provide a list of supported stream configurations, skipped";

            continue;
            continue;
        }
        }


@@ -2162,7 +2174,9 @@ TEST_P(EvsHidlTest, MultiCameraStreamUseConfig) {
        nsecs_t runTime = end - firstFrame;
        nsecs_t runTime = end - firstFrame;
        float framesPerSecond0 = framesReceived0 / (runTime * kNanoToSeconds);
        float framesPerSecond0 = framesReceived0 / (runTime * kNanoToSeconds);
        float framesPerSecond1 = framesReceived1 / (runTime * kNanoToSeconds);
        float framesPerSecond1 = framesReceived1 / (runTime * kNanoToSeconds);
        ALOGI("Measured camera rate %3.2f fps and %3.2f fps", framesPerSecond0, framesPerSecond1);
        LOG(INFO) << "Measured camera rate "
                  << std::scientific << framesPerSecond0 << " fps and "
                  << framesPerSecond1 << " fps";
        EXPECT_GE(framesPerSecond0, kMinimumFramesPerSecond);
        EXPECT_GE(framesPerSecond0, kMinimumFramesPerSecond);
        EXPECT_GE(framesPerSecond1, kMinimumFramesPerSecond);
        EXPECT_GE(framesPerSecond1, kMinimumFramesPerSecond);


@@ -2198,7 +2212,7 @@ TEST_P(EvsHidlTest, MultiCameraStreamUseConfig) {
 * identifiers.
 * identifiers.
 */
 */
TEST_P(EvsHidlTest, LogicalCameraMetadata) {
TEST_P(EvsHidlTest, LogicalCameraMetadata) {
    ALOGI("Starting LogicalCameraMetadata test");
    LOG(INFO) << "Starting LogicalCameraMetadata test";


    // Get the camera list
    // Get the camera list
    loadCameraList();
    loadCameraList();
@@ -2222,7 +2236,7 @@ TEST_P(EvsHidlTest, LogicalCameraMetadata) {
 * can be reopened.
 * can be reopened.
 */
 */
TEST_P(EvsHidlTest, UltrasonicsArrayOpenClean) {
TEST_P(EvsHidlTest, UltrasonicsArrayOpenClean) {
    ALOGI("Starting UltrasonicsArrayOpenClean test");
    LOG(INFO) << "Starting UltrasonicsArrayOpenClean test";


    // Get the ultrasonics array list
    // Get the ultrasonics array list
    loadUltrasonicsArrayList();
    loadUltrasonicsArrayList();
@@ -2236,7 +2250,7 @@ TEST_P(EvsHidlTest, UltrasonicsArrayOpenClean) {


            // Verify that this ultrasonics array self-identifies correctly
            // Verify that this ultrasonics array self-identifies correctly
            pUltrasonicsArray->getUltrasonicArrayInfo([&ultraInfo](UltrasonicsArrayDesc desc) {
            pUltrasonicsArray->getUltrasonicArrayInfo([&ultraInfo](UltrasonicsArrayDesc desc) {
                ALOGD("Found ultrasonics array %s", ultraInfo.ultrasonicsArrayId.c_str());
                LOG(DEBUG) << "Found ultrasonics array " << ultraInfo.ultrasonicsArrayId;
                EXPECT_EQ(ultraInfo.ultrasonicsArrayId, desc.ultrasonicsArrayId);
                EXPECT_EQ(ultraInfo.ultrasonicsArrayId, desc.ultrasonicsArrayId);
            });
            });


@@ -2249,14 +2263,14 @@ TEST_P(EvsHidlTest, UltrasonicsArrayOpenClean) {


// Starts a stream and verifies all data received is valid.
// Starts a stream and verifies all data received is valid.
TEST_P(EvsHidlTest, UltrasonicsVerifyStreamData) {
TEST_P(EvsHidlTest, UltrasonicsVerifyStreamData) {
    ALOGI("Starting UltrasonicsVerifyStreamData");
    LOG(INFO) << "Starting UltrasonicsVerifyStreamData";


    // Get the ultrasonics array list
    // Get the ultrasonics array list
    loadUltrasonicsArrayList();
    loadUltrasonicsArrayList();


    // For each ultrasonics array.
    // For each ultrasonics array.
    for (auto&& ultraInfo : ultrasonicsArraysInfo) {
    for (auto&& ultraInfo : ultrasonicsArraysInfo) {
        ALOGD("Testing ultrasonics array: %s", ultraInfo.ultrasonicsArrayId.c_str());
        LOG(DEBUG) << "Testing ultrasonics array: " << ultraInfo.ultrasonicsArrayId;


        sp<IEvsUltrasonicsArray> pUltrasonicsArray =
        sp<IEvsUltrasonicsArray> pUltrasonicsArray =
                pEnumerator->openUltrasonicsArray(ultraInfo.ultrasonicsArrayId);
                pEnumerator->openUltrasonicsArray(ultraInfo.ultrasonicsArrayId);
@@ -2285,14 +2299,14 @@ TEST_P(EvsHidlTest, UltrasonicsVerifyStreamData) {


// Sets frames in flight before and after start of stream and verfies success.
// Sets frames in flight before and after start of stream and verfies success.
TEST_P(EvsHidlTest, UltrasonicsSetFramesInFlight) {
TEST_P(EvsHidlTest, UltrasonicsSetFramesInFlight) {
    ALOGI("Starting UltrasonicsSetFramesInFlight");
    LOG(INFO) << "Starting UltrasonicsSetFramesInFlight";


    // Get the ultrasonics array list
    // Get the ultrasonics array list
    loadUltrasonicsArrayList();
    loadUltrasonicsArrayList();


    // For each ultrasonics array.
    // For each ultrasonics array.
    for (auto&& ultraInfo : ultrasonicsArraysInfo) {
    for (auto&& ultraInfo : ultrasonicsArraysInfo) {
        ALOGD("Testing ultrasonics array: %s", ultraInfo.ultrasonicsArrayId.c_str());
        LOG(DEBUG) << "Testing ultrasonics array: " << ultraInfo.ultrasonicsArrayId;


        sp<IEvsUltrasonicsArray> pUltrasonicsArray =
        sp<IEvsUltrasonicsArray> pUltrasonicsArray =
                pEnumerator->openUltrasonicsArray(ultraInfo.ultrasonicsArrayId);
                pEnumerator->openUltrasonicsArray(ultraInfo.ultrasonicsArrayId);