Merge "metricsd binder: Abort if fail to register service" am: 59e5c25919

am: 4a90546b6f

* commit '4a90546b6f1d2e256993389e5ff9e0bec6da68c2':
  metricsd binder: Abort if fail to register service
This commit is contained in:
Todd Poynor 2015-12-10 15:42:55 -08:00 committed by android-build-merger
commit 40e795d55d
1 changed files with 6 additions and 2 deletions

View File

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