Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #define LOG_TAG "healthd" |
| 18 | |
Yabin Cui | e98e177 | 2016-02-17 12:21:34 -0800 | [diff] [blame] | 19 | #include <healthd/healthd.h> |
| 20 | #include <healthd/BatteryMonitor.h> |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 21 | |
| 22 | #include <dirent.h> |
| 23 | #include <errno.h> |
| 24 | #include <fcntl.h> |
| 25 | #include <stdio.h> |
| 26 | #include <stdlib.h> |
Mark Salyzyn | acb1ddf | 2015-07-23 09:22:50 -0700 | [diff] [blame] | 27 | #include <sys/types.h> |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 28 | #include <unistd.h> |
James Hawkins | 588a2ca | 2016-02-18 14:52:46 -0800 | [diff] [blame] | 29 | #include <memory> |
Mark Salyzyn | acb1ddf | 2015-07-23 09:22:50 -0700 | [diff] [blame] | 30 | |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 31 | #include <android-base/file.h> |
| 32 | #include <android-base/strings.h> |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 33 | #include <batteryservice/BatteryService.h> |
| 34 | #include <cutils/klog.h> |
Todd Poynor | 3db03a5 | 2014-05-21 16:28:13 -0700 | [diff] [blame] | 35 | #include <cutils/properties.h> |
Todd Poynor | c133b71 | 2013-08-14 17:39:13 -0700 | [diff] [blame] | 36 | #include <utils/Errors.h> |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 37 | #include <utils/String8.h> |
| 38 | #include <utils/Vector.h> |
| 39 | |
| 40 | #define POWER_SUPPLY_SUBSYSTEM "power_supply" |
| 41 | #define POWER_SUPPLY_SYSFS_PATH "/sys/class/" POWER_SUPPLY_SUBSYSTEM |
Ruchi Kandoi | a78fc23 | 2014-07-10 15:06:21 -0700 | [diff] [blame] | 42 | #define FAKE_BATTERY_CAPACITY 42 |
| 43 | #define FAKE_BATTERY_TEMPERATURE 424 |
Ruchi Kandoi | 42a981d | 2015-09-28 13:35:59 -0700 | [diff] [blame] | 44 | #define ALWAYS_PLUGGED_CAPACITY 100 |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 45 | |
| 46 | namespace android { |
| 47 | |
| 48 | struct sysfsStringEnumMap { |
Mark Salyzyn | 6f5b47f | 2014-05-15 15:00:59 -0700 | [diff] [blame] | 49 | const char* s; |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 50 | int val; |
| 51 | }; |
| 52 | |
| 53 | static int mapSysfsString(const char* str, |
| 54 | struct sysfsStringEnumMap map[]) { |
| 55 | for (int i = 0; map[i].s; i++) |
| 56 | if (!strcmp(str, map[i].s)) |
| 57 | return map[i].val; |
| 58 | |
| 59 | return -1; |
| 60 | } |
| 61 | |
Yabin Cui | db04a49 | 2016-02-16 17:19:23 -0800 | [diff] [blame] | 62 | static void initBatteryProperties(BatteryProperties* props) { |
| 63 | props->chargerAcOnline = false; |
| 64 | props->chargerUsbOnline = false; |
| 65 | props->chargerWirelessOnline = false; |
| 66 | props->maxChargingCurrent = 0; |
| 67 | props->batteryStatus = BATTERY_STATUS_UNKNOWN; |
| 68 | props->batteryHealth = BATTERY_HEALTH_UNKNOWN; |
| 69 | props->batteryPresent = false; |
| 70 | props->batteryLevel = 0; |
| 71 | props->batteryVoltage = 0; |
| 72 | props->batteryTemperature = 0; |
| 73 | props->batteryCurrent = 0; |
| 74 | props->batteryCycleCount = 0; |
| 75 | props->batteryFullCharge = 0; |
| 76 | props->batteryTechnology.clear(); |
| 77 | } |
| 78 | |
| 79 | BatteryMonitor::BatteryMonitor() : mHealthdConfig(nullptr), mBatteryDevicePresent(false), |
| 80 | mAlwaysPluggedDevice(false), mBatteryFixedCapacity(0), mBatteryFixedTemperature(0) { |
| 81 | initBatteryProperties(&props); |
| 82 | } |
| 83 | |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 84 | int BatteryMonitor::getBatteryStatus(const char* status) { |
| 85 | int ret; |
| 86 | struct sysfsStringEnumMap batteryStatusMap[] = { |
| 87 | { "Unknown", BATTERY_STATUS_UNKNOWN }, |
| 88 | { "Charging", BATTERY_STATUS_CHARGING }, |
| 89 | { "Discharging", BATTERY_STATUS_DISCHARGING }, |
| 90 | { "Not charging", BATTERY_STATUS_NOT_CHARGING }, |
| 91 | { "Full", BATTERY_STATUS_FULL }, |
| 92 | { NULL, 0 }, |
| 93 | }; |
| 94 | |
| 95 | ret = mapSysfsString(status, batteryStatusMap); |
| 96 | if (ret < 0) { |
| 97 | KLOG_WARNING(LOG_TAG, "Unknown battery status '%s'\n", status); |
| 98 | ret = BATTERY_STATUS_UNKNOWN; |
| 99 | } |
| 100 | |
| 101 | return ret; |
| 102 | } |
| 103 | |
| 104 | int BatteryMonitor::getBatteryHealth(const char* status) { |
| 105 | int ret; |
| 106 | struct sysfsStringEnumMap batteryHealthMap[] = { |
| 107 | { "Unknown", BATTERY_HEALTH_UNKNOWN }, |
| 108 | { "Good", BATTERY_HEALTH_GOOD }, |
| 109 | { "Overheat", BATTERY_HEALTH_OVERHEAT }, |
| 110 | { "Dead", BATTERY_HEALTH_DEAD }, |
| 111 | { "Over voltage", BATTERY_HEALTH_OVER_VOLTAGE }, |
| 112 | { "Unspecified failure", BATTERY_HEALTH_UNSPECIFIED_FAILURE }, |
| 113 | { "Cold", BATTERY_HEALTH_COLD }, |
| 114 | { NULL, 0 }, |
| 115 | }; |
| 116 | |
| 117 | ret = mapSysfsString(status, batteryHealthMap); |
| 118 | if (ret < 0) { |
| 119 | KLOG_WARNING(LOG_TAG, "Unknown battery health '%s'\n", status); |
| 120 | ret = BATTERY_HEALTH_UNKNOWN; |
| 121 | } |
| 122 | |
| 123 | return ret; |
| 124 | } |
| 125 | |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 126 | int BatteryMonitor::readFromFile(const String8& path, std::string* buf) { |
| 127 | if (android::base::ReadFileToString(String8::std_string(path), buf)) { |
| 128 | *buf = android::base::Trim(*buf); |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 129 | } |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 130 | return buf->length(); |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | BatteryMonitor::PowerSupplyType BatteryMonitor::readPowerSupplyType(const String8& path) { |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 134 | std::string buf; |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 135 | BatteryMonitor::PowerSupplyType ret; |
| 136 | struct sysfsStringEnumMap supplyTypeMap[] = { |
| 137 | { "Unknown", ANDROID_POWER_SUPPLY_TYPE_UNKNOWN }, |
| 138 | { "Battery", ANDROID_POWER_SUPPLY_TYPE_BATTERY }, |
| 139 | { "UPS", ANDROID_POWER_SUPPLY_TYPE_AC }, |
| 140 | { "Mains", ANDROID_POWER_SUPPLY_TYPE_AC }, |
| 141 | { "USB", ANDROID_POWER_SUPPLY_TYPE_USB }, |
| 142 | { "USB_DCP", ANDROID_POWER_SUPPLY_TYPE_AC }, |
Johan Redestig | 3282861 | 2016-02-03 13:45:54 +0100 | [diff] [blame] | 143 | { "USB_HVDCP", ANDROID_POWER_SUPPLY_TYPE_AC }, |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 144 | { "USB_CDP", ANDROID_POWER_SUPPLY_TYPE_AC }, |
| 145 | { "USB_ACA", ANDROID_POWER_SUPPLY_TYPE_AC }, |
Benson Leung | 8a4eef6 | 2015-10-07 16:12:04 -0700 | [diff] [blame] | 146 | { "USB_C", ANDROID_POWER_SUPPLY_TYPE_AC }, |
| 147 | { "USB_PD", ANDROID_POWER_SUPPLY_TYPE_AC }, |
| 148 | { "USB_PD_DRP", ANDROID_POWER_SUPPLY_TYPE_USB }, |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 149 | { "Wireless", ANDROID_POWER_SUPPLY_TYPE_WIRELESS }, |
| 150 | { NULL, 0 }, |
| 151 | }; |
| 152 | |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 153 | if (readFromFile(path, &buf) <= 0) |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 154 | return ANDROID_POWER_SUPPLY_TYPE_UNKNOWN; |
| 155 | |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 156 | ret = (BatteryMonitor::PowerSupplyType)mapSysfsString(buf.c_str(), supplyTypeMap); |
Johan Redestig | 3282861 | 2016-02-03 13:45:54 +0100 | [diff] [blame] | 157 | if (ret < 0) { |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 158 | KLOG_WARNING(LOG_TAG, "Unknown power supply type '%s'\n", buf.c_str()); |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 159 | ret = ANDROID_POWER_SUPPLY_TYPE_UNKNOWN; |
Johan Redestig | 3282861 | 2016-02-03 13:45:54 +0100 | [diff] [blame] | 160 | } |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 161 | |
| 162 | return ret; |
| 163 | } |
| 164 | |
| 165 | bool BatteryMonitor::getBooleanField(const String8& path) { |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 166 | std::string buf; |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 167 | bool value = false; |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 168 | |
| 169 | if (readFromFile(path, &buf) > 0) |
| 170 | if (buf[0] != '0') |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 171 | value = true; |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 172 | |
| 173 | return value; |
| 174 | } |
| 175 | |
| 176 | int BatteryMonitor::getIntField(const String8& path) { |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 177 | std::string buf; |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 178 | int value = 0; |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 179 | |
| 180 | if (readFromFile(path, &buf) > 0) |
| 181 | value = std::stoi(buf.c_str(), NULL, 0); |
| 182 | |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 183 | return value; |
| 184 | } |
| 185 | |
| 186 | bool BatteryMonitor::update(void) { |
Todd Poynor | 10b235e | 2013-08-07 15:25:14 -0700 | [diff] [blame] | 187 | bool logthis; |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 188 | |
Yabin Cui | db04a49 | 2016-02-16 17:19:23 -0800 | [diff] [blame] | 189 | initBatteryProperties(&props); |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 190 | |
Todd Poynor | f5d3012 | 2013-08-12 17:03:35 -0700 | [diff] [blame] | 191 | if (!mHealthdConfig->batteryPresentPath.isEmpty()) |
| 192 | props.batteryPresent = getBooleanField(mHealthdConfig->batteryPresentPath); |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 193 | else |
Todd Poynor | 6dcc45e | 2013-10-21 20:26:25 -0700 | [diff] [blame] | 194 | props.batteryPresent = mBatteryDevicePresent; |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 195 | |
Todd Poynor | 3db03a5 | 2014-05-21 16:28:13 -0700 | [diff] [blame] | 196 | props.batteryLevel = mBatteryFixedCapacity ? |
| 197 | mBatteryFixedCapacity : |
| 198 | getIntField(mHealthdConfig->batteryCapacityPath); |
Todd Poynor | f5d3012 | 2013-08-12 17:03:35 -0700 | [diff] [blame] | 199 | props.batteryVoltage = getIntField(mHealthdConfig->batteryVoltagePath) / 1000; |
Todd Poynor | b45f1f5 | 2013-07-30 18:57:16 -0700 | [diff] [blame] | 200 | |
Ruchi Kandoi | cc33880 | 2015-08-24 13:01:16 -0700 | [diff] [blame] | 201 | if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) |
| 202 | props.batteryCurrent = getIntField(mHealthdConfig->batteryCurrentNowPath) / 1000; |
| 203 | |
| 204 | if (!mHealthdConfig->batteryFullChargePath.isEmpty()) |
| 205 | props.batteryFullCharge = getIntField(mHealthdConfig->batteryFullChargePath); |
| 206 | |
| 207 | if (!mHealthdConfig->batteryCycleCountPath.isEmpty()) |
| 208 | props.batteryCycleCount = getIntField(mHealthdConfig->batteryCycleCountPath); |
| 209 | |
Todd Poynor | 3db03a5 | 2014-05-21 16:28:13 -0700 | [diff] [blame] | 210 | props.batteryTemperature = mBatteryFixedTemperature ? |
| 211 | mBatteryFixedTemperature : |
| 212 | getIntField(mHealthdConfig->batteryTemperaturePath); |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 213 | |
Ruchi Kandoi | 42a981d | 2015-09-28 13:35:59 -0700 | [diff] [blame] | 214 | // For devices which do not have battery and are always plugged |
| 215 | // into power souce. |
| 216 | if (mAlwaysPluggedDevice) { |
| 217 | props.chargerAcOnline = true; |
| 218 | props.batteryPresent = true; |
| 219 | props.batteryStatus = BATTERY_STATUS_CHARGING; |
| 220 | props.batteryHealth = BATTERY_HEALTH_GOOD; |
| 221 | } |
| 222 | |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 223 | std::string buf; |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 224 | |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 225 | if (readFromFile(mHealthdConfig->batteryStatusPath, &buf) > 0) |
| 226 | props.batteryStatus = getBatteryStatus(buf.c_str()); |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 227 | |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 228 | if (readFromFile(mHealthdConfig->batteryHealthPath, &buf) > 0) |
| 229 | props.batteryHealth = getBatteryHealth(buf.c_str()); |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 230 | |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 231 | if (readFromFile(mHealthdConfig->batteryTechnologyPath, &buf) > 0) |
| 232 | props.batteryTechnology = String8(buf.c_str()); |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 233 | |
| 234 | unsigned int i; |
| 235 | |
| 236 | for (i = 0; i < mChargerNames.size(); i++) { |
| 237 | String8 path; |
| 238 | path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, |
| 239 | mChargerNames[i].string()); |
| 240 | |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 241 | if (getIntField(path)) { |
| 242 | path.clear(); |
| 243 | path.appendFormat("%s/%s/type", POWER_SUPPLY_SYSFS_PATH, |
| 244 | mChargerNames[i].string()); |
| 245 | switch(readPowerSupplyType(path)) { |
| 246 | case ANDROID_POWER_SUPPLY_TYPE_AC: |
| 247 | props.chargerAcOnline = true; |
| 248 | break; |
| 249 | case ANDROID_POWER_SUPPLY_TYPE_USB: |
| 250 | props.chargerUsbOnline = true; |
| 251 | break; |
| 252 | case ANDROID_POWER_SUPPLY_TYPE_WIRELESS: |
| 253 | props.chargerWirelessOnline = true; |
| 254 | break; |
| 255 | default: |
| 256 | KLOG_WARNING(LOG_TAG, "%s: Unknown power supply type\n", |
| 257 | mChargerNames[i].string()); |
| 258 | } |
| 259 | path.clear(); |
| 260 | path.appendFormat("%s/%s/current_max", POWER_SUPPLY_SYSFS_PATH, |
| 261 | mChargerNames[i].string()); |
| 262 | if (access(path.string(), R_OK) == 0) { |
| 263 | int maxChargingCurrent = getIntField(path); |
| 264 | if (props.maxChargingCurrent < maxChargingCurrent) { |
| 265 | props.maxChargingCurrent = maxChargingCurrent; |
Adrian Roos | d5fe667 | 2015-07-10 13:11:01 -0700 | [diff] [blame] | 266 | } |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 267 | } |
| 268 | } |
| 269 | } |
| 270 | |
Todd Poynor | 10b235e | 2013-08-07 15:25:14 -0700 | [diff] [blame] | 271 | logthis = !healthd_board_battery_update(&props); |
Todd Poynor | b45f1f5 | 2013-07-30 18:57:16 -0700 | [diff] [blame] | 272 | |
Todd Poynor | 10b235e | 2013-08-07 15:25:14 -0700 | [diff] [blame] | 273 | if (logthis) { |
| 274 | char dmesgline[256]; |
Ruchi Kandoi | cc33880 | 2015-08-24 13:01:16 -0700 | [diff] [blame] | 275 | size_t len; |
Todd Poynor | c15e993 | 2013-10-22 18:21:27 -0700 | [diff] [blame] | 276 | if (props.batteryPresent) { |
Todd Poynor | 6dcc45e | 2013-10-21 20:26:25 -0700 | [diff] [blame] | 277 | snprintf(dmesgline, sizeof(dmesgline), |
Todd Poynor | 10b235e | 2013-08-07 15:25:14 -0700 | [diff] [blame] | 278 | "battery l=%d v=%d t=%s%d.%d h=%d st=%d", |
| 279 | props.batteryLevel, props.batteryVoltage, |
| 280 | props.batteryTemperature < 0 ? "-" : "", |
| 281 | abs(props.batteryTemperature / 10), |
| 282 | abs(props.batteryTemperature % 10), props.batteryHealth, |
| 283 | props.batteryStatus); |
Todd Poynor | c15e993 | 2013-10-22 18:21:27 -0700 | [diff] [blame] | 284 | |
Ruchi Kandoi | cc33880 | 2015-08-24 13:01:16 -0700 | [diff] [blame] | 285 | len = strlen(dmesgline); |
Todd Poynor | c15e993 | 2013-10-22 18:21:27 -0700 | [diff] [blame] | 286 | if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) { |
Ruchi Kandoi | cc33880 | 2015-08-24 13:01:16 -0700 | [diff] [blame] | 287 | len += snprintf(dmesgline + len, sizeof(dmesgline) - len, |
| 288 | " c=%d", props.batteryCurrent); |
| 289 | } |
Todd Poynor | c15e993 | 2013-10-22 18:21:27 -0700 | [diff] [blame] | 290 | |
Ruchi Kandoi | cc33880 | 2015-08-24 13:01:16 -0700 | [diff] [blame] | 291 | if (!mHealthdConfig->batteryFullChargePath.isEmpty()) { |
| 292 | len += snprintf(dmesgline + len, sizeof(dmesgline) - len, |
| 293 | " fc=%d", props.batteryFullCharge); |
| 294 | } |
| 295 | |
| 296 | if (!mHealthdConfig->batteryCycleCountPath.isEmpty()) { |
| 297 | len += snprintf(dmesgline + len, sizeof(dmesgline) - len, |
| 298 | " cc=%d", props.batteryCycleCount); |
Todd Poynor | c15e993 | 2013-10-22 18:21:27 -0700 | [diff] [blame] | 299 | } |
| 300 | } else { |
Ruchi Kandoi | e9320b7 | 2016-02-22 12:46:57 -0800 | [diff] [blame] | 301 | len = snprintf(dmesgline, sizeof(dmesgline), |
Todd Poynor | 6dcc45e | 2013-10-21 20:26:25 -0700 | [diff] [blame] | 302 | "battery none"); |
Todd Poynor | 10b235e | 2013-08-07 15:25:14 -0700 | [diff] [blame] | 303 | } |
| 304 | |
Mark Salyzyn | acb1ddf | 2015-07-23 09:22:50 -0700 | [diff] [blame] | 305 | snprintf(dmesgline + len, sizeof(dmesgline) - len, " chg=%s%s%s", |
| 306 | props.chargerAcOnline ? "a" : "", |
| 307 | props.chargerUsbOnline ? "u" : "", |
| 308 | props.chargerWirelessOnline ? "w" : ""); |
| 309 | |
Mark Salyzyn | acb1ddf | 2015-07-23 09:22:50 -0700 | [diff] [blame] | 310 | KLOG_WARNING(LOG_TAG, "%s\n", dmesgline); |
Todd Poynor | b45f1f5 | 2013-07-30 18:57:16 -0700 | [diff] [blame] | 311 | } |
| 312 | |
Todd Poynor | c7464c9 | 2013-09-10 12:40:00 -0700 | [diff] [blame] | 313 | healthd_mode_ops->battery_update(&props); |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 314 | return props.chargerAcOnline | props.chargerUsbOnline | |
| 315 | props.chargerWirelessOnline; |
| 316 | } |
| 317 | |
Yabin Cui | aedf603 | 2016-02-19 18:03:23 -0800 | [diff] [blame] | 318 | int BatteryMonitor::getChargeStatus() { |
| 319 | int result = BATTERY_STATUS_UNKNOWN; |
| 320 | if (!mHealthdConfig->batteryStatusPath.isEmpty()) { |
Michael Scott | 3217c5c | 2016-06-05 11:20:13 -0700 | [diff] [blame] | 321 | std::string buf; |
| 322 | if (readFromFile(mHealthdConfig->batteryStatusPath, &buf) > 0) |
| 323 | result = getBatteryStatus(buf.c_str()); |
Yabin Cui | aedf603 | 2016-02-19 18:03:23 -0800 | [diff] [blame] | 324 | } |
| 325 | return result; |
| 326 | } |
| 327 | |
Todd Poynor | c133b71 | 2013-08-14 17:39:13 -0700 | [diff] [blame] | 328 | status_t BatteryMonitor::getProperty(int id, struct BatteryProperty *val) { |
| 329 | status_t ret = BAD_VALUE; |
| 330 | |
Todd Poynor | 8f132af | 2014-05-08 17:15:45 -0700 | [diff] [blame] | 331 | val->valueInt64 = LONG_MIN; |
| 332 | |
Todd Poynor | c133b71 | 2013-08-14 17:39:13 -0700 | [diff] [blame] | 333 | switch(id) { |
| 334 | case BATTERY_PROP_CHARGE_COUNTER: |
| 335 | if (!mHealthdConfig->batteryChargeCounterPath.isEmpty()) { |
Todd Poynor | 8f132af | 2014-05-08 17:15:45 -0700 | [diff] [blame] | 336 | val->valueInt64 = |
Todd Poynor | c133b71 | 2013-08-14 17:39:13 -0700 | [diff] [blame] | 337 | getIntField(mHealthdConfig->batteryChargeCounterPath); |
| 338 | ret = NO_ERROR; |
| 339 | } else { |
| 340 | ret = NAME_NOT_FOUND; |
| 341 | } |
| 342 | break; |
| 343 | |
| 344 | case BATTERY_PROP_CURRENT_NOW: |
| 345 | if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) { |
Todd Poynor | 8f132af | 2014-05-08 17:15:45 -0700 | [diff] [blame] | 346 | val->valueInt64 = |
Todd Poynor | c133b71 | 2013-08-14 17:39:13 -0700 | [diff] [blame] | 347 | getIntField(mHealthdConfig->batteryCurrentNowPath); |
| 348 | ret = NO_ERROR; |
| 349 | } else { |
| 350 | ret = NAME_NOT_FOUND; |
| 351 | } |
| 352 | break; |
| 353 | |
Todd Poynor | bc10211 | 2013-08-27 18:11:49 -0700 | [diff] [blame] | 354 | case BATTERY_PROP_CURRENT_AVG: |
| 355 | if (!mHealthdConfig->batteryCurrentAvgPath.isEmpty()) { |
Todd Poynor | 8f132af | 2014-05-08 17:15:45 -0700 | [diff] [blame] | 356 | val->valueInt64 = |
Todd Poynor | bc10211 | 2013-08-27 18:11:49 -0700 | [diff] [blame] | 357 | getIntField(mHealthdConfig->batteryCurrentAvgPath); |
| 358 | ret = NO_ERROR; |
| 359 | } else { |
| 360 | ret = NAME_NOT_FOUND; |
| 361 | } |
| 362 | break; |
| 363 | |
Paul Lawrence | 347c8de | 2014-03-19 15:04:40 -0700 | [diff] [blame] | 364 | case BATTERY_PROP_CAPACITY: |
| 365 | if (!mHealthdConfig->batteryCapacityPath.isEmpty()) { |
Todd Poynor | 8f132af | 2014-05-08 17:15:45 -0700 | [diff] [blame] | 366 | val->valueInt64 = |
Paul Lawrence | 347c8de | 2014-03-19 15:04:40 -0700 | [diff] [blame] | 367 | getIntField(mHealthdConfig->batteryCapacityPath); |
| 368 | ret = NO_ERROR; |
| 369 | } else { |
| 370 | ret = NAME_NOT_FOUND; |
| 371 | } |
| 372 | break; |
| 373 | |
Todd Poynor | 8f132af | 2014-05-08 17:15:45 -0700 | [diff] [blame] | 374 | case BATTERY_PROP_ENERGY_COUNTER: |
Todd Poynor | e14b37e | 2014-05-20 13:54:40 -0700 | [diff] [blame] | 375 | if (mHealthdConfig->energyCounter) { |
| 376 | ret = mHealthdConfig->energyCounter(&val->valueInt64); |
| 377 | } else { |
| 378 | ret = NAME_NOT_FOUND; |
| 379 | } |
Todd Poynor | 8f132af | 2014-05-08 17:15:45 -0700 | [diff] [blame] | 380 | break; |
| 381 | |
Todd Poynor | c133b71 | 2013-08-14 17:39:13 -0700 | [diff] [blame] | 382 | default: |
| 383 | break; |
| 384 | } |
| 385 | |
Todd Poynor | c133b71 | 2013-08-14 17:39:13 -0700 | [diff] [blame] | 386 | return ret; |
| 387 | } |
| 388 | |
Todd Poynor | 020369d | 2013-09-18 20:09:33 -0700 | [diff] [blame] | 389 | void BatteryMonitor::dumpState(int fd) { |
| 390 | int v; |
| 391 | char vs[128]; |
| 392 | |
Adrian Roos | d5fe667 | 2015-07-10 13:11:01 -0700 | [diff] [blame] | 393 | snprintf(vs, sizeof(vs), "ac: %d usb: %d wireless: %d current_max: %d\n", |
Todd Poynor | 020369d | 2013-09-18 20:09:33 -0700 | [diff] [blame] | 394 | props.chargerAcOnline, props.chargerUsbOnline, |
Adrian Roos | d5fe667 | 2015-07-10 13:11:01 -0700 | [diff] [blame] | 395 | props.chargerWirelessOnline, props.maxChargingCurrent); |
Todd Poynor | 020369d | 2013-09-18 20:09:33 -0700 | [diff] [blame] | 396 | write(fd, vs, strlen(vs)); |
| 397 | snprintf(vs, sizeof(vs), "status: %d health: %d present: %d\n", |
| 398 | props.batteryStatus, props.batteryHealth, props.batteryPresent); |
| 399 | write(fd, vs, strlen(vs)); |
| 400 | snprintf(vs, sizeof(vs), "level: %d voltage: %d temp: %d\n", |
| 401 | props.batteryLevel, props.batteryVoltage, |
| 402 | props.batteryTemperature); |
| 403 | write(fd, vs, strlen(vs)); |
| 404 | |
| 405 | if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) { |
| 406 | v = getIntField(mHealthdConfig->batteryCurrentNowPath); |
| 407 | snprintf(vs, sizeof(vs), "current now: %d\n", v); |
| 408 | write(fd, vs, strlen(vs)); |
| 409 | } |
| 410 | |
| 411 | if (!mHealthdConfig->batteryCurrentAvgPath.isEmpty()) { |
| 412 | v = getIntField(mHealthdConfig->batteryCurrentAvgPath); |
| 413 | snprintf(vs, sizeof(vs), "current avg: %d\n", v); |
| 414 | write(fd, vs, strlen(vs)); |
| 415 | } |
| 416 | |
| 417 | if (!mHealthdConfig->batteryChargeCounterPath.isEmpty()) { |
| 418 | v = getIntField(mHealthdConfig->batteryChargeCounterPath); |
| 419 | snprintf(vs, sizeof(vs), "charge counter: %d\n", v); |
| 420 | write(fd, vs, strlen(vs)); |
| 421 | } |
Ruchi Kandoi | cc33880 | 2015-08-24 13:01:16 -0700 | [diff] [blame] | 422 | |
| 423 | if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) { |
| 424 | snprintf(vs, sizeof(vs), "current now: %d\n", props.batteryCurrent); |
| 425 | write(fd, vs, strlen(vs)); |
| 426 | } |
| 427 | |
| 428 | if (!mHealthdConfig->batteryCycleCountPath.isEmpty()) { |
| 429 | snprintf(vs, sizeof(vs), "cycle count: %d\n", props.batteryCycleCount); |
| 430 | write(fd, vs, strlen(vs)); |
| 431 | } |
| 432 | |
| 433 | if (!mHealthdConfig->batteryFullChargePath.isEmpty()) { |
| 434 | snprintf(vs, sizeof(vs), "Full charge: %d\n", props.batteryFullCharge); |
| 435 | write(fd, vs, strlen(vs)); |
| 436 | } |
Todd Poynor | 020369d | 2013-09-18 20:09:33 -0700 | [diff] [blame] | 437 | } |
| 438 | |
Todd Poynor | c7464c9 | 2013-09-10 12:40:00 -0700 | [diff] [blame] | 439 | void BatteryMonitor::init(struct healthd_config *hc) { |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 440 | String8 path; |
Todd Poynor | 3db03a5 | 2014-05-21 16:28:13 -0700 | [diff] [blame] | 441 | char pval[PROPERTY_VALUE_MAX]; |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 442 | |
Todd Poynor | f5d3012 | 2013-08-12 17:03:35 -0700 | [diff] [blame] | 443 | mHealthdConfig = hc; |
James Hawkins | 588a2ca | 2016-02-18 14:52:46 -0800 | [diff] [blame] | 444 | std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(POWER_SUPPLY_SYSFS_PATH), closedir); |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 445 | if (dir == NULL) { |
| 446 | KLOG_ERROR(LOG_TAG, "Could not open %s\n", POWER_SUPPLY_SYSFS_PATH); |
| 447 | } else { |
| 448 | struct dirent* entry; |
| 449 | |
James Hawkins | 588a2ca | 2016-02-18 14:52:46 -0800 | [diff] [blame] | 450 | while ((entry = readdir(dir.get()))) { |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 451 | const char* name = entry->d_name; |
| 452 | |
| 453 | if (!strcmp(name, ".") || !strcmp(name, "..")) |
| 454 | continue; |
| 455 | |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 456 | // Look for "type" file in each subdirectory |
| 457 | path.clear(); |
| 458 | path.appendFormat("%s/%s/type", POWER_SUPPLY_SYSFS_PATH, name); |
| 459 | switch(readPowerSupplyType(path)) { |
| 460 | case ANDROID_POWER_SUPPLY_TYPE_AC: |
| 461 | case ANDROID_POWER_SUPPLY_TYPE_USB: |
| 462 | case ANDROID_POWER_SUPPLY_TYPE_WIRELESS: |
| 463 | path.clear(); |
| 464 | path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, name); |
| 465 | if (access(path.string(), R_OK) == 0) |
| 466 | mChargerNames.add(String8(name)); |
| 467 | break; |
| 468 | |
| 469 | case ANDROID_POWER_SUPPLY_TYPE_BATTERY: |
Todd Poynor | 6dcc45e | 2013-10-21 20:26:25 -0700 | [diff] [blame] | 470 | mBatteryDevicePresent = true; |
| 471 | |
Todd Poynor | f5d3012 | 2013-08-12 17:03:35 -0700 | [diff] [blame] | 472 | if (mHealthdConfig->batteryStatusPath.isEmpty()) { |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 473 | path.clear(); |
Todd Poynor | f5d3012 | 2013-08-12 17:03:35 -0700 | [diff] [blame] | 474 | path.appendFormat("%s/%s/status", POWER_SUPPLY_SYSFS_PATH, |
| 475 | name); |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 476 | if (access(path, R_OK) == 0) |
Todd Poynor | f5d3012 | 2013-08-12 17:03:35 -0700 | [diff] [blame] | 477 | mHealthdConfig->batteryStatusPath = path; |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 478 | } |
| 479 | |
Todd Poynor | f5d3012 | 2013-08-12 17:03:35 -0700 | [diff] [blame] | 480 | if (mHealthdConfig->batteryHealthPath.isEmpty()) { |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 481 | path.clear(); |
Todd Poynor | f5d3012 | 2013-08-12 17:03:35 -0700 | [diff] [blame] | 482 | path.appendFormat("%s/%s/health", POWER_SUPPLY_SYSFS_PATH, |
| 483 | name); |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 484 | if (access(path, R_OK) == 0) |
Todd Poynor | f5d3012 | 2013-08-12 17:03:35 -0700 | [diff] [blame] | 485 | mHealthdConfig->batteryHealthPath = path; |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 486 | } |
| 487 | |
Todd Poynor | f5d3012 | 2013-08-12 17:03:35 -0700 | [diff] [blame] | 488 | if (mHealthdConfig->batteryPresentPath.isEmpty()) { |
| 489 | path.clear(); |
| 490 | path.appendFormat("%s/%s/present", POWER_SUPPLY_SYSFS_PATH, |
| 491 | name); |
| 492 | if (access(path, R_OK) == 0) |
| 493 | mHealthdConfig->batteryPresentPath = path; |
| 494 | } |
| 495 | |
| 496 | if (mHealthdConfig->batteryCapacityPath.isEmpty()) { |
| 497 | path.clear(); |
| 498 | path.appendFormat("%s/%s/capacity", POWER_SUPPLY_SYSFS_PATH, |
| 499 | name); |
| 500 | if (access(path, R_OK) == 0) |
| 501 | mHealthdConfig->batteryCapacityPath = path; |
| 502 | } |
| 503 | |
| 504 | if (mHealthdConfig->batteryVoltagePath.isEmpty()) { |
| 505 | path.clear(); |
| 506 | path.appendFormat("%s/%s/voltage_now", |
| 507 | POWER_SUPPLY_SYSFS_PATH, name); |
| 508 | if (access(path, R_OK) == 0) { |
| 509 | mHealthdConfig->batteryVoltagePath = path; |
| 510 | } else { |
| 511 | path.clear(); |
| 512 | path.appendFormat("%s/%s/batt_vol", |
| 513 | POWER_SUPPLY_SYSFS_PATH, name); |
| 514 | if (access(path, R_OK) == 0) |
| 515 | mHealthdConfig->batteryVoltagePath = path; |
| 516 | } |
| 517 | } |
| 518 | |
Ruchi Kandoi | cc33880 | 2015-08-24 13:01:16 -0700 | [diff] [blame] | 519 | if (mHealthdConfig->batteryFullChargePath.isEmpty()) { |
| 520 | path.clear(); |
| 521 | path.appendFormat("%s/%s/charge_full", |
| 522 | POWER_SUPPLY_SYSFS_PATH, name); |
| 523 | if (access(path, R_OK) == 0) |
| 524 | mHealthdConfig->batteryFullChargePath = path; |
| 525 | } |
| 526 | |
Todd Poynor | f5d3012 | 2013-08-12 17:03:35 -0700 | [diff] [blame] | 527 | if (mHealthdConfig->batteryCurrentNowPath.isEmpty()) { |
| 528 | path.clear(); |
| 529 | path.appendFormat("%s/%s/current_now", |
| 530 | POWER_SUPPLY_SYSFS_PATH, name); |
| 531 | if (access(path, R_OK) == 0) |
| 532 | mHealthdConfig->batteryCurrentNowPath = path; |
| 533 | } |
| 534 | |
Ruchi Kandoi | cc33880 | 2015-08-24 13:01:16 -0700 | [diff] [blame] | 535 | if (mHealthdConfig->batteryCycleCountPath.isEmpty()) { |
| 536 | path.clear(); |
| 537 | path.appendFormat("%s/%s/cycle_count", |
| 538 | POWER_SUPPLY_SYSFS_PATH, name); |
| 539 | if (access(path, R_OK) == 0) |
| 540 | mHealthdConfig->batteryCycleCountPath = path; |
| 541 | } |
| 542 | |
Todd Poynor | bc10211 | 2013-08-27 18:11:49 -0700 | [diff] [blame] | 543 | if (mHealthdConfig->batteryCurrentAvgPath.isEmpty()) { |
| 544 | path.clear(); |
| 545 | path.appendFormat("%s/%s/current_avg", |
| 546 | POWER_SUPPLY_SYSFS_PATH, name); |
| 547 | if (access(path, R_OK) == 0) |
| 548 | mHealthdConfig->batteryCurrentAvgPath = path; |
| 549 | } |
| 550 | |
Todd Poynor | f5d3012 | 2013-08-12 17:03:35 -0700 | [diff] [blame] | 551 | if (mHealthdConfig->batteryChargeCounterPath.isEmpty()) { |
| 552 | path.clear(); |
| 553 | path.appendFormat("%s/%s/charge_counter", |
| 554 | POWER_SUPPLY_SYSFS_PATH, name); |
| 555 | if (access(path, R_OK) == 0) |
| 556 | mHealthdConfig->batteryChargeCounterPath = path; |
| 557 | } |
| 558 | |
| 559 | if (mHealthdConfig->batteryTemperaturePath.isEmpty()) { |
| 560 | path.clear(); |
| 561 | path.appendFormat("%s/%s/temp", POWER_SUPPLY_SYSFS_PATH, |
| 562 | name); |
| 563 | if (access(path, R_OK) == 0) { |
| 564 | mHealthdConfig->batteryTemperaturePath = path; |
| 565 | } else { |
| 566 | path.clear(); |
| 567 | path.appendFormat("%s/%s/batt_temp", |
| 568 | POWER_SUPPLY_SYSFS_PATH, name); |
| 569 | if (access(path, R_OK) == 0) |
| 570 | mHealthdConfig->batteryTemperaturePath = path; |
| 571 | } |
| 572 | } |
| 573 | |
| 574 | if (mHealthdConfig->batteryTechnologyPath.isEmpty()) { |
| 575 | path.clear(); |
| 576 | path.appendFormat("%s/%s/technology", |
| 577 | POWER_SUPPLY_SYSFS_PATH, name); |
| 578 | if (access(path, R_OK) == 0) |
| 579 | mHealthdConfig->batteryTechnologyPath = path; |
| 580 | } |
| 581 | |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 582 | break; |
| 583 | |
| 584 | case ANDROID_POWER_SUPPLY_TYPE_UNKNOWN: |
| 585 | break; |
| 586 | } |
| 587 | } |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 588 | } |
| 589 | |
Ruchi Kandoi | 42a981d | 2015-09-28 13:35:59 -0700 | [diff] [blame] | 590 | // Typically the case for devices which do not have a battery and |
| 591 | // and are always plugged into AC mains. |
Todd Poynor | 6dcc45e | 2013-10-21 20:26:25 -0700 | [diff] [blame] | 592 | if (!mBatteryDevicePresent) { |
Todd Poynor | ebeb0c0 | 2014-09-23 14:54:24 -0700 | [diff] [blame] | 593 | KLOG_WARNING(LOG_TAG, "No battery devices found\n"); |
Todd Poynor | 6dcc45e | 2013-10-21 20:26:25 -0700 | [diff] [blame] | 594 | hc->periodic_chores_interval_fast = -1; |
| 595 | hc->periodic_chores_interval_slow = -1; |
Ruchi Kandoi | fabd490 | 2016-02-29 13:13:39 -0800 | [diff] [blame] | 596 | mBatteryFixedCapacity = ALWAYS_PLUGGED_CAPACITY; |
| 597 | mBatteryFixedTemperature = FAKE_BATTERY_TEMPERATURE; |
| 598 | mAlwaysPluggedDevice = true; |
Todd Poynor | 6dcc45e | 2013-10-21 20:26:25 -0700 | [diff] [blame] | 599 | } else { |
| 600 | if (mHealthdConfig->batteryStatusPath.isEmpty()) |
| 601 | KLOG_WARNING(LOG_TAG, "BatteryStatusPath not found\n"); |
| 602 | if (mHealthdConfig->batteryHealthPath.isEmpty()) |
| 603 | KLOG_WARNING(LOG_TAG, "BatteryHealthPath not found\n"); |
| 604 | if (mHealthdConfig->batteryPresentPath.isEmpty()) |
| 605 | KLOG_WARNING(LOG_TAG, "BatteryPresentPath not found\n"); |
| 606 | if (mHealthdConfig->batteryCapacityPath.isEmpty()) |
| 607 | KLOG_WARNING(LOG_TAG, "BatteryCapacityPath not found\n"); |
| 608 | if (mHealthdConfig->batteryVoltagePath.isEmpty()) |
| 609 | KLOG_WARNING(LOG_TAG, "BatteryVoltagePath not found\n"); |
| 610 | if (mHealthdConfig->batteryTemperaturePath.isEmpty()) |
| 611 | KLOG_WARNING(LOG_TAG, "BatteryTemperaturePath not found\n"); |
| 612 | if (mHealthdConfig->batteryTechnologyPath.isEmpty()) |
| 613 | KLOG_WARNING(LOG_TAG, "BatteryTechnologyPath not found\n"); |
Ruchi Kandoi | cc33880 | 2015-08-24 13:01:16 -0700 | [diff] [blame] | 614 | if (mHealthdConfig->batteryCurrentNowPath.isEmpty()) |
| 615 | KLOG_WARNING(LOG_TAG, "BatteryCurrentNowPath not found\n"); |
| 616 | if (mHealthdConfig->batteryFullChargePath.isEmpty()) |
| 617 | KLOG_WARNING(LOG_TAG, "BatteryFullChargePath not found\n"); |
| 618 | if (mHealthdConfig->batteryCycleCountPath.isEmpty()) |
| 619 | KLOG_WARNING(LOG_TAG, "BatteryCycleCountPath not found\n"); |
Todd Poynor | 6dcc45e | 2013-10-21 20:26:25 -0700 | [diff] [blame] | 620 | } |
Todd Poynor | 3db03a5 | 2014-05-21 16:28:13 -0700 | [diff] [blame] | 621 | |
Ruchi Kandoi | a78fc23 | 2014-07-10 15:06:21 -0700 | [diff] [blame] | 622 | if (property_get("ro.boot.fake_battery", pval, NULL) > 0 |
| 623 | && strtol(pval, NULL, 10) != 0) { |
| 624 | mBatteryFixedCapacity = FAKE_BATTERY_CAPACITY; |
| 625 | mBatteryFixedTemperature = FAKE_BATTERY_TEMPERATURE; |
| 626 | } |
Todd Poynor | 752faf2 | 2013-06-12 13:25:59 -0700 | [diff] [blame] | 627 | } |
| 628 | |
| 629 | }; // namespace android |