diff --git a/metricsd/uploader/bn_metricsd_impl.cc b/metricsd/uploader/bn_metricsd_impl.cc
index 113a705c7..2cbc2dae7 100644
--- a/metricsd/uploader/bn_metricsd_impl.cc
+++ b/metricsd/uploader/bn_metricsd_impl.cc
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
#include
#include
@@ -33,11 +34,14 @@ static const char16_t kCrashTypeUser[] = u"user";
BnMetricsdImpl::BnMetricsdImpl(const std::shared_ptr& counters)
: counters_(counters) {
- CHECK(counters_);
+ CHECK(counters_) << "Invalid counters argument to constructor";
}
void BnMetricsdImpl::Run() {
- android::defaultServiceManager()->addService(getInterfaceDescriptor(), this);
+ android::status_t status =
+ android::defaultServiceManager()->addService(getInterfaceDescriptor(),
+ this);
+ CHECK(status == android::OK) << "Metricsd service registration failed";
android::ProcessState::self()->setThreadPoolMaxThreadCount(0);
android::IPCThreadState::self()->disableBackgroundScheduling(true);
android::IPCThreadState::self()->joinThreadPool();