diff options
author | Wei Wang <wvw@google.com> | 2019-06-17 16:23:51 -0700 |
---|---|---|
committer | Wei Wang <wvw@google.com> | 2019-06-18 02:34:59 +0000 |
commit | 3acd4afe09360e50a23dfb9b2f2d7bd33cc9ca03 (patch) | |
tree | dde37970827c73a2d53f99f70b229b3caba8353e | |
parent | f31589e53e7648027c3b5d94f2476f94ecefd5f0 (diff) | |
download | pixel-3acd4afe09360e50a23dfb9b2f2d7bd33cc9ca03.tar.gz |
Convert atracehal into lazy HALandroid10-dev
Bug: 135293492
Test: HAL isn't running
Test: atrace and systrace works
Change-Id: Icd680a416b1376b4762553d20a7117d5999ee75b
-rw-r--r-- | atrace/AtraceDevice.cpp | 4 | ||||
-rw-r--r-- | atrace/android.hardware.atrace@1.0-service.pixel.rc | 2 | ||||
-rw-r--r-- | atrace/service.cpp | 5 |
3 files changed, 8 insertions, 3 deletions
diff --git a/atrace/AtraceDevice.cpp b/atrace/AtraceDevice.cpp index 26e56966..c673275b 100644 --- a/atrace/AtraceDevice.cpp +++ b/atrace/AtraceDevice.cpp @@ -84,7 +84,7 @@ Return<::android::hardware::atrace::V1_0::Status> AtraceDevice::enableCategories 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 @@ Return<::android::hardware::atrace::V1_0::Status> AtraceDevice::disableAllCatego 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 ef50fd0a..b26296d5 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 @@ service vendor.atrace-hal-1-0 /vendor/bin/hw/android.hardware.atrace@1.0-service class early_hal user system group system + oneshot + disabled diff --git a/atrace/service.cpp b/atrace/service.cpp index 423c39d0..3164aa26 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::OK; 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; } |