Add UeventListener to pixelstats in gs101
Bug: 171793497
Test: Ensure that uevent listener reports data to statsd
Change-Id: I9e90f8483298934a78320f37dbf5eb1ac38e8f97
diff --git a/pixelstats/service.cpp b/pixelstats/service.cpp
index 33d885f..5c381eb 100644
--- a/pixelstats/service.cpp
+++ b/pixelstats/service.cpp
@@ -17,10 +17,13 @@
#define LOG_TAG "pixelstats"
#include <android-base/logging.h>
+#include <thread>
#include <pixelstats/SysfsCollector.h>
+#include <pixelstats/UeventListener.h>
using android::hardware::google::pixel::SysfsCollector;
+using android::hardware::google::pixel::UeventListener;
#define UFSHC_PATH(filename) "/dev/sys/block/bootdevice/" #filename
const struct SysfsCollector::SysfsPaths sysfs_paths = {
@@ -38,6 +41,10 @@
int main() {
LOG(INFO) << "starting PixelStats";
+ UeventListener ueventListener("");
+ std::thread listenThread(&UeventListener::ListenForever, &ueventListener);
+ listenThread.detach();
+
SysfsCollector collector(sysfs_paths);
collector.collect(); // This blocks forever.