Add UeventListener to pixelstats in gs101
Bug: 171793497 Test: Ensure that uevent listener reports data to statsd Change-Id: I9e90f8483298934a78320f37dbf5eb1ac38e8f97
This commit is contained in:
parent
d95bbb9740
commit
33a1ce7421
2 changed files with 10 additions and 0 deletions
|
@ -186,6 +186,9 @@ on init
|
||||||
# Loading common kernel modules in background
|
# Loading common kernel modules in background
|
||||||
start insmod_sh_common
|
start insmod_sh_common
|
||||||
|
|
||||||
|
# Charge stats (write 0)
|
||||||
|
chown system system /sys/class/power_supply/battery/charge_stats
|
||||||
|
|
||||||
# start watchdogd
|
# start watchdogd
|
||||||
start watchdogd
|
start watchdogd
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,13 @@
|
||||||
#define LOG_TAG "pixelstats"
|
#define LOG_TAG "pixelstats"
|
||||||
|
|
||||||
#include <android-base/logging.h>
|
#include <android-base/logging.h>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
#include <pixelstats/SysfsCollector.h>
|
#include <pixelstats/SysfsCollector.h>
|
||||||
|
#include <pixelstats/UeventListener.h>
|
||||||
|
|
||||||
using android::hardware::google::pixel::SysfsCollector;
|
using android::hardware::google::pixel::SysfsCollector;
|
||||||
|
using android::hardware::google::pixel::UeventListener;
|
||||||
|
|
||||||
#define UFSHC_PATH(filename) "/dev/sys/block/bootdevice/" #filename
|
#define UFSHC_PATH(filename) "/dev/sys/block/bootdevice/" #filename
|
||||||
const struct SysfsCollector::SysfsPaths sysfs_paths = {
|
const struct SysfsCollector::SysfsPaths sysfs_paths = {
|
||||||
|
@ -38,6 +41,10 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = {
|
||||||
int main() {
|
int main() {
|
||||||
LOG(INFO) << "starting PixelStats";
|
LOG(INFO) << "starting PixelStats";
|
||||||
|
|
||||||
|
UeventListener ueventListener("");
|
||||||
|
std::thread listenThread(&UeventListener::ListenForever, &ueventListener);
|
||||||
|
listenThread.detach();
|
||||||
|
|
||||||
SysfsCollector collector(sysfs_paths);
|
SysfsCollector collector(sysfs_paths);
|
||||||
collector.collect(); // This blocks forever.
|
collector.collect(); // This blocks forever.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue