Log if waitForHwService has to wait too long.
Test: internal marlin boots
Test: hidl_test
Test: verified logs after `setprop ctl.stop light-hal-2-0`
Bug: 34862771
Merged-In: Ie584103c2295fbb680933cc53d2be1e9432fc721
Change-Id: Ie584103c2295fbb680933cc53d2be1e9432fc721
diff --git a/transport/ServiceManagement.cpp b/transport/ServiceManagement.cpp
index 9eccede..5ba3ec3 100644
--- a/transport/ServiceManagement.cpp
+++ b/transport/ServiceManagement.cpp
@@ -300,11 +300,23 @@
return Void();
}
- void wait() {
+ void wait(const std::string &interface, const std::string &instanceName) {
+ using std::literals::chrono_literals::operator""s;
+
std::unique_lock<std::mutex> lock(mMutex);
- mCondition.wait(lock, [this]{
- return mRegistered;
- });
+ while(true) {
+ mCondition.wait_for(lock, 1s, [this]{
+ return mRegistered;
+ });
+
+ if (mRegistered) {
+ break;
+ }
+
+ LOG(WARNING) << "Waited one second for "
+ << interface << "/" << instanceName
+ << ". Waiting another...";
+ }
}
private:
@@ -338,7 +350,7 @@
return;
}
- waiter->wait();
+ waiter->wait(interface, instanceName);
}
}; // namespace details