зеркало из https://github.com/mozilla/gecko-dev.git
Bug 703610 - Return level=1.0 when the battery is full (Battery API UPower backend). r=cjones
This commit is contained in:
Родитель
1b0d327de1
Коммит
61ee629f94
|
@ -384,8 +384,6 @@ UPowerClient::UpdateSavedInfo(GHashTable* aHashTable)
|
|||
{
|
||||
bool isFull = false;
|
||||
|
||||
mLevel = g_value_get_double(static_cast<const GValue*>(g_hash_table_lookup(aHashTable, "Percentage")))*0.01;
|
||||
|
||||
/*
|
||||
* State values are confusing...
|
||||
* First of all, after looking at upower sources (0.9.13), it seems that
|
||||
|
@ -420,6 +418,17 @@ UPowerClient::UpdateSavedInfo(GHashTable* aHashTable)
|
|||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* The battery level might be very close to 100% (like 99.xxxx%) without
|
||||
* increasing. It seems that upower sets the battery state as 'full' in that
|
||||
* case so we should trust it and not even try to get the value.
|
||||
*/
|
||||
if (isFull) {
|
||||
mLevel = 1.0;
|
||||
} else {
|
||||
mLevel = g_value_get_double(static_cast<const GValue*>(g_hash_table_lookup(aHashTable, "Percentage")))*0.01;
|
||||
}
|
||||
|
||||
if (isFull) {
|
||||
mRemainingTime = 0;
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче