libpower: add error logs

Bug: 134078730
Test: libpower_test
Change-Id: I35ac20c3f075bb83e61d5fad5bcfd8a1876b0c30
This commit is contained in:
Tri Vo 2019-05-31 11:48:13 -07:00
parent 1a0ad92fd9
commit 3714b98cf5
2 changed files with 5 additions and 2 deletions

View file

@ -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;
}

View file

@ -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;;
}
});
}