.. | .. |
---|
72 | 72 | props->batteryStatus = BATTERY_STATUS_UNKNOWN; |
---|
73 | 73 | props->batteryHealth = BATTERY_HEALTH_UNKNOWN; |
---|
74 | 74 | props->batteryPresent = false; |
---|
75 | | - props->batteryLevel = 100; |
---|
| 75 | + props->batteryLevel = 0; |
---|
76 | 76 | props->batteryVoltage = 0; |
---|
77 | 77 | props->batteryTemperature = 0; |
---|
78 | 78 | props->batteryCurrent = 0; |
---|
.. | .. |
---|
210 | 210 | else |
---|
211 | 211 | props.batteryPresent = mBatteryDevicePresent; |
---|
212 | 212 | |
---|
213 | | - //props.batteryLevel = mBatteryFixedCapacity ? |
---|
214 | | - // mBatteryFixedCapacity : |
---|
215 | | - // getIntField(mHealthdConfig->batteryCapacityPath); |
---|
216 | | - props.batteryLevel = 100; |
---|
| 213 | + if (!props.batteryPresent) { |
---|
| 214 | + props.batteryLevel = 100;} |
---|
| 215 | + else { |
---|
| 216 | + props.batteryLevel = mBatteryFixedCapacity ? |
---|
| 217 | + mBatteryFixedCapacity : |
---|
| 218 | + getIntField(mHealthdConfig->batteryCapacityPath); |
---|
| 219 | + } |
---|
| 220 | + |
---|
217 | 221 | props.batteryVoltage = getIntField(mHealthdConfig->batteryVoltagePath) / 1000; |
---|
218 | 222 | |
---|
219 | 223 | if (!mHealthdConfig->batteryCurrentNowPath.isEmpty()) |
---|