Create a friend method for reporting battery health
Bug: 71860528
Test: Test: vts-tradefed run vts -m VtsHalHealthV2_0
Change-Id: I6c56c601ee59fe33ee4a19dd4aeafbe3a1bd4c72
diff --git a/healthd/Android.mk b/healthd/Android.mk
index 9127c60..7792eaf 100644
--- a/healthd/Android.mk
+++ b/healthd/Android.mk
@@ -50,6 +50,7 @@
android.hardware.health@2.0 \
android.hardware.health@2.0-impl \
android.hardware.health@1.0 \
+ android.hardware.health@1.0-convert \
libhealthstoragedefault \
libminui \
libpng \
@@ -96,6 +97,7 @@
android.hardware.health@2.0-impl \
android.hardware.health@2.0 \
android.hardware.health@1.0 \
+ android.hardware.health@1.0-convert \
libhidltransport \
libhidlbase \
libhwbinder \
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp
index 676ee41..561948c 100644
--- a/healthd/BatteryMonitor.cpp
+++ b/healthd/BatteryMonitor.cpp
@@ -86,6 +86,10 @@
initBatteryProperties(&props);
}
+struct BatteryProperties getBatteryProperties(BatteryMonitor* batteryMonitor) {
+ return batteryMonitor->props;
+}
+
int BatteryMonitor::getBatteryStatus(const char* status) {
int ret;
struct sysfsStringEnumMap batteryStatusMap[] = {
diff --git a/healthd/include/healthd/BatteryMonitor.h b/healthd/include/healthd/BatteryMonitor.h
index f9067cc..b6a1b66 100644
--- a/healthd/include/healthd/BatteryMonitor.h
+++ b/healthd/include/healthd/BatteryMonitor.h
@@ -42,6 +42,7 @@
int getChargeStatus();
status_t getProperty(int id, struct BatteryProperty *val);
void dumpState(int fd);
+ friend struct BatteryProperties getBatteryProperties(BatteryMonitor* batteryMonitor);
private:
struct healthd_config *mHealthdConfig;