mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1292655 - Limit BatteryManager chargingTime/dischargingTime precision. r=baku
This commit is contained in:
parent
a7f164c330
commit
7314ad853b
@ -149,6 +149,11 @@ BatteryManager::UpdateFromBatteryInfo(const hal::BatteryInformation& aBatteryInf
|
||||
mLevel = lround(mLevel * 10.0) / 10.0;
|
||||
if (mLevel == 1.0) {
|
||||
mRemainingTime = mCharging ? kDefaultRemainingTime : kUnknownRemainingTime;
|
||||
} else if (mRemainingTime != kUnknownRemainingTime) {
|
||||
// Round the remaining time to a multiple of 15 minutes and never zero
|
||||
const double MINUTES_15 = 15.0 * 60.0;
|
||||
mRemainingTime = fmax(lround(mRemainingTime / MINUTES_15) * MINUTES_15,
|
||||
MINUTES_15);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user