Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 59e5c259 authored by Todd Poynor's avatar Todd Poynor Committed by Gerrit Code Review
Browse files

Merge "metricsd binder: Abort if fail to register service"

parents f31aba9e 2862a784
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <base/metrics/statistics_recorder.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
#include <utils/Errors.h>
#include <utils/String16.h>
#include <utils/String8.h>

@@ -33,11 +34,14 @@ static const char16_t kCrashTypeUser[] = u"user";

BnMetricsdImpl::BnMetricsdImpl(const std::shared_ptr<CrashCounters>& 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();