summaryrefslogtreecommitdiffstats
path: root/healthd
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-12-07 16:29:46 -0800
committerSteve Kondik <steve@cyngn.com>2015-12-07 16:29:46 -0800
commitb1e86e2d1fc315a3b108c28a5ff6bc649ea584d5 (patch)
treef19b4590cd850cba130840fdff8988ed97a40497 /healthd
parent33ecd3756347ef2663e500949ab4b33392086fbc (diff)
parenta6116961338548409b14076eefbef211afc8c3fe (diff)
downloadsystem_core-b1e86e2d1fc315a3b108c28a5ff6bc649ea584d5.zip
system_core-b1e86e2d1fc315a3b108c28a5ff6bc649ea584d5.tar.gz
system_core-b1e86e2d1fc315a3b108c28a5ff6bc649ea584d5.tar.bz2
Merge tag 'android-6.0.1_r3' of https://android.googlesource.com/platform/system/core into HEAD
Android 6.0.1 release 3 Change-Id: I8b65c0223e3444360432abd871a9d8f007831ba0
Diffstat (limited to 'healthd')
-rw-r--r--healthd/BatteryMonitor.cpp19
-rw-r--r--healthd/BatteryMonitor.h1
2 files changed, 19 insertions, 1 deletions
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp
index f40bce6..67a8ad0 100644
--- a/healthd/BatteryMonitor.cpp
+++ b/healthd/BatteryMonitor.cpp
@@ -40,6 +40,7 @@
#define POWER_SUPPLY_SYSFS_PATH "/sys/class/" POWER_SUPPLY_SUBSYSTEM
#define FAKE_BATTERY_CAPACITY 42
#define FAKE_BATTERY_TEMPERATURE 424
+#define ALWAYS_PLUGGED_CAPACITY 100
namespace android {
@@ -208,6 +209,15 @@ bool BatteryMonitor::update(void) {
mBatteryFixedTemperature :
getIntField(mHealthdConfig->batteryTemperaturePath);
+ // For devices which do not have battery and are always plugged
+ // into power souce.
+ if (mAlwaysPluggedDevice) {
+ props.chargerAcOnline = true;
+ props.batteryPresent = true;
+ props.batteryStatus = BATTERY_STATUS_CHARGING;
+ props.batteryHealth = BATTERY_HEALTH_GOOD;
+ }
+
const int SIZE = 128;
char buf[SIZE];
String8 btech;
@@ -822,8 +832,15 @@ void BatteryMonitor::init(struct healthd_config *hc) {
closedir(dir);
}
- if (!mChargerNames.size())
+ // This indicates that there is no charger driver registered.
+ // Typically the case for devices which do not have a battery and
+ // and are always plugged into AC mains.
+ if (!mChargerNames.size()) {
KLOG_ERROR(LOG_TAG, "No charger supplies found\n");
+ mBatteryFixedCapacity = ALWAYS_PLUGGED_CAPACITY;
+ mBatteryFixedTemperature = FAKE_BATTERY_TEMPERATURE;
+ mAlwaysPluggedDevice = true;
+ }
if (!mBatteryDevicePresent && !mDockBatteryDevicePresent) {
KLOG_WARNING(LOG_TAG, "No battery devices found\n");
hc->periodic_chores_interval_fast = -1;
diff --git a/healthd/BatteryMonitor.h b/healthd/BatteryMonitor.h
index 6e3ec98..4320348 100644
--- a/healthd/BatteryMonitor.h
+++ b/healthd/BatteryMonitor.h
@@ -51,6 +51,7 @@ class BatteryMonitor {
Vector<String8> mChargerNames;
bool mBatteryDevicePresent;
bool mDockBatteryDevicePresent;
+ bool mAlwaysPluggedDevice;
int mBatteryFixedCapacity;
int mBatteryFixedTemperature;
struct BatteryProperties props;