Merge "libpower: add error logs"

am: 9462a528d1

Change-Id: Ie4351e8f245bd41246291cdc4917b4731ef0b2e4
This commit is contained in:
Tri Vo 2019-06-04 18:58:08 -07:00 committed by android-build-merger
commit 9f7dc4acfc
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;;
}
});
}