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
diff --git a/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp b/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp
index cde8048..b31795b 100644
--- a/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp
+++ b/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp
@@ -38,16 +38,15 @@
#include <hidl/HidlTransportSupport.h>
#include <hwbinder/ProcessState.h>
-#include <log/log.h>
#include <utils/Errors.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/IEvsCameraStream.h>
#include <android/hardware/automotive/evs/1.1/IEvsEnumerator.h>
#include <android/hardware/automotive/evs/1.1/IEvsDisplay.h>
#include <android/hardware/camera/device/3.2/ICameraDevice.h>
+#include <android-base/logging.h>
#include <system/camera_metadata.h>
#include <ui/DisplayConfig.h>
#include <ui/DisplayState.h>
@@ -120,11 +119,12 @@
// Get the camera list
pEnumerator->getCameraList_1_1(
[this](hidl_vec <CameraDesc> cameraList) {
- ALOGI("Camera list callback received %zu cameras",
- cameraList.size());
+ LOG(INFO) << "Camera list callback received "
+ << cameraList.size()
+ << " cameras";
cameraInfo.reserve(cameraList.size());
for (auto&& cam: cameraList) {
- ALOGI("Found camera %s", cam.v1.cameraId.c_str());
+ LOG(INFO) << "Found camera " << cam.v1.cameraId;
cameraInfo.push_back(cam);
}
}
@@ -137,10 +137,12 @@
// Get the ultrasonics array list
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());
for (auto&& ultraArray : ultraList) {
- ALOGI("Found ultrasonics array %s", ultraArray.ultrasonicsArrayId.c_str());
+ LOG(INFO) << "Found ultrasonics array " << ultraArray.ultrasonicsArrayId;
ultrasonicsArraysInfo.push_back(ultraArray);
}
});
@@ -195,7 +197,7 @@
if (!flag) {
// EVS assumes that the device w/o a valid metadata is a physical
// device.
- ALOGI("%s is not a logical camera device.", id.c_str());
+ LOG(INFO) << id << " is not a logical camera device.";
physicalCameras.emplace(id);
return physicalCameras;
}
@@ -205,7 +207,9 @@
int rc = find_camera_metadata_ro_entry(metadata,
ANDROID_LOGICAL_MULTI_CAMERA_PHYSICAL_IDS,
&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;
size_t start = 0;
@@ -219,7 +223,10 @@
}
}
- 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;
}
@@ -247,7 +254,7 @@
* call to closeCamera. Then repeats the test to ensure all cameras can be reopened.
*/
TEST_P(EvsHidlTest, CameraOpenClean) {
- ALOGI("Starting CameraOpenClean test");
+ LOG(INFO) << "Starting CameraOpenClean test";
// Get the camera list
loadCameraList();
@@ -261,7 +268,7 @@
bool isLogicalCam = false;
auto devices = getPhysicalCameraIds(cam.v1.cameraId, 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;
}
@@ -286,7 +293,7 @@
// Verify that this camera self-identifies correctly
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);
}
);
@@ -316,7 +323,7 @@
* the system to be tolerant of shutdown/restart race conditions.
*/
TEST_P(EvsHidlTest, CameraOpenAggressive) {
- ALOGI("Starting CameraOpenAggressive test");
+ LOG(INFO) << "Starting CameraOpenAggressive test";
// Get the camera list
loadCameraList();
@@ -330,7 +337,7 @@
bool isLogicalCam = false;
getPhysicalCameraIds(cam.v1.cameraId, 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;
}
@@ -345,7 +352,7 @@
// Verify that this camera self-identifies correctly
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);
}
);
@@ -374,7 +381,7 @@
// Verify that the second camera instance self-identifies correctly
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);
}
);
@@ -393,7 +400,7 @@
* Measure and qualify the stream start up time and streaming frame rate of each reported camera
*/
TEST_P(EvsHidlTest, CameraStreamPerformance) {
- ALOGI("Starting CameraStreamPerformance test");
+ LOG(INFO) << "Starting CameraStreamPerformance test";
// Get the camera list
loadCameraList();
@@ -407,7 +414,7 @@
bool isLogicalCam = false;
auto devices = getPhysicalCameraIds(cam.v1.cameraId, 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;
}
@@ -444,8 +451,10 @@
kMaxStreamStartMilliseconds * devices.size());
printf("%s: Measured time to first frame %0.2f ms\n",
cam.v1.cameraId.c_str(), timeToFirstFrame * kNanoToMilliseconds);
- ALOGI("%s: Measured time to first frame %0.2f ms",
- cam.v1.cameraId.c_str(), timeToFirstFrame * kNanoToMilliseconds);
+ LOG(INFO) << cam.v1.cameraId
+ << ": Measured time to first frame "
+ << std::scientific << timeToFirstFrame * kNanoToMilliseconds
+ << " ms.";
// Check aspect ratio
unsigned width = 0, height = 0;
@@ -468,7 +477,9 @@
nsecs_t runTime = end - firstFrame;
float framesPerSecond = framesReceived / (runTime * kNanoToSeconds);
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);
// Explicitly release the camera
@@ -483,7 +494,7 @@
* than one frame time. The camera must cleanly skip frames until the client is ready again.
*/
TEST_P(EvsHidlTest, CameraStreamBuffering) {
- ALOGI("Starting CameraStreamBuffering test");
+ LOG(INFO) << "Starting CameraStreamBuffering test";
// Arbitrary constant (should be > 1 and less than crazy)
static const unsigned int kBuffersToHold = 6;
@@ -500,7 +511,7 @@
bool isLogicalCam = false;
getPhysicalCameraIds(cam.v1.cameraId, 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;
}
@@ -568,7 +579,7 @@
* which a human could observe to see the operation of the system on the physical display.
*/
TEST_P(EvsHidlTest, CameraToDisplayRoundTrip) {
- ALOGI("Starting CameraToDisplayRoundTrip test");
+ LOG(INFO) << "Starting CameraToDisplayRoundTrip test";
// Get the camera list
loadCameraList();
@@ -587,14 +598,14 @@
// Request exclusive access to the first EVS display
sp<IEvsDisplay_1_1> pDisplay = pEnumerator->openDisplay_1_1(targetDisplayId);
ASSERT_NE(pDisplay, nullptr);
- ALOGI("Display %d is in use.", targetDisplayId);
+ LOG(INFO) << "Display " << targetDisplayId << " is alreay in use.";
// Get the display descriptor
pDisplay->getDisplayInfo_1_1([](const auto& config, const auto& state) {
android::DisplayConfig* pConfig = (android::DisplayConfig*)config.data();
const auto width = pConfig->resolution.getWidth();
const auto height = pConfig->resolution.getHeight();
- ALOGI(" Resolution: %dx%d", width, height);
+ LOG(INFO) << " Resolution: " << width << "x" << height;
ASSERT_GT(width, 0);
ASSERT_GT(height, 0);
@@ -607,7 +618,7 @@
bool isLogicalCam = false;
getPhysicalCameraIds(cam.v1.cameraId, 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;
}
@@ -667,7 +678,7 @@
* underlying camera.
*/
TEST_P(EvsHidlTest, MultiCameraStream) {
- ALOGI("Starting MultiCameraStream test");
+ LOG(INFO) << "Starting MultiCameraStream test";
if (mIsHwModule) {
// This test is not for HW module implementation.
@@ -735,7 +746,9 @@
nsecs_t runTime = end - firstFrame;
float framesPerSecond0 = framesReceived0 / (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(framesPerSecond1, kMinimumFramesPerSecond);
@@ -774,7 +787,7 @@
* Verify that a client can adjust a camera parameter.
*/
TEST_P(EvsHidlTest, CameraParameter) {
- ALOGI("Starting CameraParameter test");
+ LOG(INFO) << "Starting CameraParameter test";
// Get the camera list
loadCameraList();
@@ -791,7 +804,7 @@
if (isLogicalCam) {
// TODO(b/145465724): Support camera parameter programming on
// logical devices.
- ALOGI("Skip a logical device %s", cam.v1.cameraId.c_str());
+ LOG(INFO) << "Skip a logical device " << cam.v1.cameraId;
continue;
}
@@ -918,7 +931,7 @@
* terminates or releases a role.
*/
TEST_P(EvsHidlTest, CameraMasterRelease) {
- ALOGI("Starting CameraMasterRelease test");
+ LOG(INFO) << "Starting CameraMasterRelease test";
if (mIsHwModule) {
// This test is not for HW module implementation.
@@ -939,7 +952,7 @@
if (isLogicalCam) {
// TODO(b/145465724): Support camera parameter programming on
// logical devices.
- ALOGI("Skip a logical device %s", cam.v1.cameraId.c_str());
+ LOG(INFO) << "Skip a logical device " << cam.v1.cameraId;
continue;
}
@@ -1012,7 +1025,7 @@
EvsEventDesc aTargetEvent;
aTargetEvent.aType = EvsEventType::MASTER_RELEASED;
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 @@
EvsEventDesc aTargetEvent;
aTargetEvent.aType = EvsEventType::MASTER_RELEASED;
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 @@
* camera parameters.
*/
TEST_P(EvsHidlTest, MultiCameraParameter) {
- ALOGI("Starting MultiCameraParameter test");
+ LOG(INFO) << "Starting MultiCameraParameter test";
if (mIsHwModule) {
// This test is not for HW module implementation.
@@ -1120,7 +1133,7 @@
if (isLogicalCam) {
// TODO(b/145465724): Support camera parameter programming on
// logical devices.
- ALOGI("Skip a logical device %s", cam.v1.cameraId.c_str());
+ LOG(INFO) << "Skip a logical device " << cam.v1.cameraId;
continue;
}
@@ -1256,7 +1269,7 @@
aTargetEvent.payload[0] = static_cast<uint32_t>(cmd);
aTargetEvent.payload[1] = val0;
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 @@
aTargetEvent.payload[0] = static_cast<uint32_t>(cmd);
aTargetEvent.payload[1] = val0;
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 @@
EvsEventDesc aTargetEvent;
aTargetEvent.aType = EvsEventType::MASTER_RELEASED;
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 @@
aTargetEvent.payload[0] = static_cast<uint32_t>(cmd);
aTargetEvent.payload[1] = val0;
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 @@
aTargetEvent.payload[0] = static_cast<uint32_t>(cmd);
aTargetEvent.payload[1] = val0;
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 @@
* a master role from other EVS clients without the display.
*/
TEST_P(EvsHidlTest, HighPriorityCameraClient) {
- ALOGI("Starting HighPriorityCameraClient test");
+ LOG(INFO) << "Starting HighPriorityCameraClient test";
if (mIsHwModule) {
// This test is not for HW module implementation.
@@ -1687,7 +1700,7 @@
aTargetEvent.payload[0] = static_cast<uint32_t>(CameraParam::AUTO_FOCUS);
aTargetEvent.payload[1] = 0;
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 @@
aTargetEvent.payload[0] = static_cast<uint32_t>(cam1Cmds[0]);
aTargetEvent.payload[1] = val0;
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 @@
EvsEventDesc aTargetEvent;
aTargetEvent.aType = EvsEventType::MASTER_RELEASED;
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 @@
aTargetEvent.payload[0] = static_cast<uint32_t>(CameraParam::AUTO_FOCUS);
aTargetEvent.payload[1] = 0;
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 @@
aTargetEvent.payload[0] = static_cast<uint32_t>(cam0Cmds[0]);
aTargetEvent.payload[1] = val0;
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 @@
* configurations from EVS and uses one of them to start a video stream.
*/
TEST_P(EvsHidlTest, CameraUseStreamConfigToDisplay) {
- ALOGI("Starting CameraUseStreamConfigToDisplay test");
+ LOG(INFO) << "Starting CameraUseStreamConfigToDisplay test";
// Get the camera list
loadCameraList();
@@ -2049,7 +2062,7 @@
* underlying camera with same configuration.
*/
TEST_P(EvsHidlTest, MultiCameraStreamUseConfig) {
- ALOGI("Starting MultiCameraStream test");
+ LOG(INFO) << "Starting MultiCameraStream test";
if (mIsHwModule) {
// This test is not for HW module implementation.
@@ -2094,9 +2107,8 @@
static_cast<PixelFormat>(HAL_PIXEL_FORMAT_RGBA_8888);
if (!foundCfg) {
- ALOGI("Device %s does not provide a list of supported stream configurations, skipped",
- cam.v1.cameraId.c_str());
-
+ LOG(INFO) << "Device " << cam.v1.cameraId
+ << " does not provide a list of supported stream configurations, skipped";
continue;
}
@@ -2162,7 +2174,9 @@
nsecs_t runTime = end - firstFrame;
float framesPerSecond0 = framesReceived0 / (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(framesPerSecond1, kMinimumFramesPerSecond);
@@ -2198,7 +2212,7 @@
* identifiers.
*/
TEST_P(EvsHidlTest, LogicalCameraMetadata) {
- ALOGI("Starting LogicalCameraMetadata test");
+ LOG(INFO) << "Starting LogicalCameraMetadata test";
// Get the camera list
loadCameraList();
@@ -2222,7 +2236,7 @@
* can be reopened.
*/
TEST_P(EvsHidlTest, UltrasonicsArrayOpenClean) {
- ALOGI("Starting UltrasonicsArrayOpenClean test");
+ LOG(INFO) << "Starting UltrasonicsArrayOpenClean test";
// Get the ultrasonics array list
loadUltrasonicsArrayList();
@@ -2236,7 +2250,7 @@
// Verify that this ultrasonics array self-identifies correctly
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);
});
@@ -2249,14 +2263,14 @@
// Starts a stream and verifies all data received is valid.
TEST_P(EvsHidlTest, UltrasonicsVerifyStreamData) {
- ALOGI("Starting UltrasonicsVerifyStreamData");
+ LOG(INFO) << "Starting UltrasonicsVerifyStreamData";
// Get the ultrasonics array list
loadUltrasonicsArrayList();
// For each ultrasonics array.
for (auto&& ultraInfo : ultrasonicsArraysInfo) {
- ALOGD("Testing ultrasonics array: %s", ultraInfo.ultrasonicsArrayId.c_str());
+ LOG(DEBUG) << "Testing ultrasonics array: " << ultraInfo.ultrasonicsArrayId;
sp<IEvsUltrasonicsArray> pUltrasonicsArray =
pEnumerator->openUltrasonicsArray(ultraInfo.ultrasonicsArrayId);
@@ -2285,14 +2299,14 @@
// Sets frames in flight before and after start of stream and verfies success.
TEST_P(EvsHidlTest, UltrasonicsSetFramesInFlight) {
- ALOGI("Starting UltrasonicsSetFramesInFlight");
+ LOG(INFO) << "Starting UltrasonicsSetFramesInFlight";
// Get the ultrasonics array list
loadUltrasonicsArrayList();
// For each ultrasonics array.
for (auto&& ultraInfo : ultrasonicsArraysInfo) {
- ALOGD("Testing ultrasonics array: %s", ultraInfo.ultrasonicsArrayId.c_str());
+ LOG(DEBUG) << "Testing ultrasonics array: " << ultraInfo.ultrasonicsArrayId;
sp<IEvsUltrasonicsArray> pUltrasonicsArray =
pEnumerator->openUltrasonicsArray(ultraInfo.ultrasonicsArrayId);