Pixestat: add battery info

Bug: 171947164
Test: manually, no read fail found
Change-Id: I35bbca1aec39e6fb6133386b96efd727a9f74099
Signed-off-by: Denny cy Lee <dennycylee@google.com>
This commit is contained in:
Denny cy Lee 2021-05-18 14:50:01 +08:00 committed by TreeHugger Robot
parent 294e58b1b2
commit 8101fbcec0

View file

@ -17,11 +17,11 @@
#define LOG_TAG "pixelstats"
#include <android-base/logging.h>
#include <thread>
#include <pixelstats/SysfsCollector.h>
#include <pixelstats/UeventListener.h>
#include <thread>
using android::hardware::google::pixel::SysfsCollector;
using android::hardware::google::pixel::UeventListener;
@ -31,6 +31,7 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = {
.SlowioWriteCntPath = UFSHC_PATH(slowio_write_cnt),
.SlowioUnmapCntPath = UFSHC_PATH(slowio_unmap_cnt),
.SlowioSyncCntPath = UFSHC_PATH(slowio_sync_cnt),
.CycleCountBinsPath = "/sys/class/power_supply/battery/cycle_counts",
.UFSLifetimeA = UFSHC_PATH(health_descriptor/life_time_estimation_a),
.UFSLifetimeB = UFSHC_PATH(health_descriptor/life_time_estimation_b),
.UFSLifetimeC = UFSHC_PATH(health_descriptor/life_time_estimation_c),
@ -38,14 +39,15 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = {
.F2fsStatsPath = "/sys/fs/f2fs/",
.ImpedancePath = "/sys/devices/platform/audiometrics/speaker_impedance",
.CodecPath = "/sys/devices/platform/audiometrics/codec_state",
};
.EEPROMPath = "/dev/battery_history"};
const char *const kAudioUevent = "/devices/virtual/amcs/amcs";
const char *const kSSOCDetailsPath = "/sys/class/power_supply/battery/ssoc_details";
int main() {
LOG(INFO) << "starting PixelStats";
UeventListener ueventListener(kAudioUevent);
UeventListener ueventListener(kAudioUevent, kSSOCDetailsPath);
std::thread listenThread(&UeventListener::ListenForever, &ueventListener);
listenThread.detach();