Snap for 5671254 from 3acd4afe09360e50a23dfb9b2f2d7bd33cc9ca03 to qt-release

Change-Id: Icbfacb60ac6582ad71f33498df6725bf9ea4f81e
diff --git a/atrace/AtraceDevice.cpp b/atrace/AtraceDevice.cpp
index 26e5696..c673275 100644
--- a/atrace/AtraceDevice.cpp
+++ b/atrace/AtraceDevice.cpp
@@ -84,7 +84,7 @@
         if (kTracingMap.count(c)) {
             for (auto &p : kTracingMap.at(c).paths) {
                 if (!android::base::WriteStringToFile("1", p.first)) {
-                    LOG(ERROR) << "Failed to disable tracing on: " << p.first;
+                    LOG(ERROR) << "Failed to enable tracing on: " << p.first;
                     if (p.second) {
                         // disable before return
                         disableAllCategories();
@@ -104,7 +104,7 @@
     for (auto &c : kTracingMap) {
         for (auto &p : c.second.paths) {
             if (!android::base::WriteStringToFile("0", p.first)) {
-                LOG(ERROR) << "Failed to enable tracing on: " << p.first;
+                LOG(ERROR) << "Failed to disable tracing on: " << p.first;
                 if (p.second) {
                     ret = Status::ERROR_TRACING_POINT;
                 }
diff --git a/atrace/android.hardware.atrace@1.0-service.pixel.rc b/atrace/android.hardware.atrace@1.0-service.pixel.rc
index ef50fd0..b26296d 100644
--- a/atrace/android.hardware.atrace@1.0-service.pixel.rc
+++ b/atrace/android.hardware.atrace@1.0-service.pixel.rc
@@ -17,3 +17,5 @@
     class early_hal
     user system
     group system
+    oneshot
+    disabled
diff --git a/atrace/service.cpp b/atrace/service.cpp
index 423c39d..3164aa2 100644
--- a/atrace/service.cpp
+++ b/atrace/service.cpp
@@ -16,6 +16,7 @@
 
 #define LOG_TAG "android.hardware.atrace@1.0-service.pixel"
 
+#include <hidl/HidlLazyUtils.h>
 #include <hidl/HidlSupport.h>
 #include <hidl/HidlTransportSupport.h>
 
@@ -25,13 +26,15 @@
 using ::android::sp;
 using ::android::hardware::configureRpcThreadpool;
 using ::android::hardware::joinRpcThreadpool;
+using ::android::hardware::LazyServiceRegistrar;
 using ::android::hardware::atrace::V1_0::IAtraceDevice;
 using ::android::hardware::atrace::V1_0::implementation::AtraceDevice;
 
 int main(int /* argc */, char * /* argv */ []) {
     sp<IAtraceDevice> atrace = new AtraceDevice;
     configureRpcThreadpool(1, true /* will join */);
-    if (atrace->registerAsService() != OK) {
+    auto serviceRegistrar = std::make_shared<LazyServiceRegistrar>();
+    if (serviceRegistrar->registerService(atrace) != OK) {
         ALOGE("Could not register service.");
         return 1;
     }