From 3714b98cf5502fc2b07930532e38548e93f32f57 Mon Sep 17 00:00:00 2001 From: Tri Vo Date: Fri, 31 May 2019 11:48:13 -0700 Subject: [PATCH] libpower: add error logs Bug: 134078730 Test: libpower_test Change-Id: I35ac20c3f075bb83e61d5fad5bcfd8a1876b0c30 --- power.cpp | 1 + power_test.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/power.cpp b/power.cpp index e9b6ccd..74abac9 100644 --- a/power.cpp +++ b/power.cpp @@ -44,6 +44,7 @@ int acquire_wake_lock(int, const char* id) { ATRACE_CALL(); const auto& suspendService = getSystemSuspendServiceOnce(); if (!suspendService) { + LOG(ERROR) << "ISystemSuspend::getService() failed."; return -1; } diff --git a/power_test.cpp b/power_test.cpp index 601df64..1ade263 100644 --- a/power_test.cpp +++ b/power_test.cpp @@ -73,8 +73,10 @@ TEST(LibpowerTest, WakeLockStressTest) { for (int j = 0; j < numLocks; j++) { // We want ids to be unique. std::string id = std::to_string(i) + "/" + std::to_string(j); - ASSERT_EQ(acquire_wake_lock(PARTIAL_WAKE_LOCK, id.c_str()), 0); - ASSERT_EQ(release_wake_lock(id.c_str()), 0); + ASSERT_EQ(acquire_wake_lock(PARTIAL_WAKE_LOCK, id.c_str()), 0) + << "id: " << id; + ASSERT_EQ(release_wake_lock(id.c_str()), 0) + << "id: " << id;; } }); }