mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 700261 - Add .chargingTime/.dischargingTime support to hal code. r=cjones
This commit is contained in:
parent
929ef89d75
commit
b4692e95a1
@ -235,6 +235,7 @@ BatteryManager::UpdateFromBatteryInfo(const hal::BatteryInformation& aBatteryInf
|
||||
{
|
||||
mLevel = aBatteryInfo.level();
|
||||
mCharging = aBatteryInfo.charging();
|
||||
mRemainingTime = aBatteryInfo.remainingTime();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -66,6 +66,7 @@ GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo)
|
||||
{
|
||||
aBatteryInfo->level() = dom::battery::kDefaultLevel;
|
||||
aBatteryInfo->charging() = dom::battery::kDefaultCharging;
|
||||
aBatteryInfo->remainingTime() = dom::battery::kUnknownRemainingTime;
|
||||
}
|
||||
|
||||
} // hal_impl
|
||||
|
@ -66,6 +66,7 @@ GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo)
|
||||
{
|
||||
aBatteryInfo->level() = dom::battery::kDefaultLevel;
|
||||
aBatteryInfo->charging() = dom::battery::kDefaultCharging;
|
||||
aBatteryInfo->remainingTime() = dom::battery::kUnknownRemainingTime;
|
||||
}
|
||||
#endif // !MOZ_ENABLE_DBUS
|
||||
|
||||
|
@ -171,6 +171,7 @@ GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo)
|
||||
|
||||
aBatteryInfo->level() = upowerClient->GetLevel();
|
||||
aBatteryInfo->charging() = upowerClient->IsCharging();
|
||||
aBatteryInfo->remainingTime() = kUnknownRemainingTime;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -332,7 +333,9 @@ UPowerClient::DeviceChanged(DBusGProxy* aProxy, const gchar* aObjectPath, UPower
|
||||
nsAutoRef<GHashTable> hashTable(aListener->GetDeviceProperties(aObjectPath));
|
||||
aListener->UpdateSavedInfo(hashTable);
|
||||
|
||||
hal::NotifyBatteryChange(hal::BatteryInformation(aListener->mLevel, aListener->mCharging));
|
||||
hal::NotifyBatteryChange(hal::BatteryInformation(aListener->mLevel,
|
||||
aListener->mCharging,
|
||||
kUnknownRemainingTime));
|
||||
}
|
||||
|
||||
/* static */ DBusHandlerResult
|
||||
|
@ -46,6 +46,7 @@ namespace hal {
|
||||
struct BatteryInformation {
|
||||
double level;
|
||||
bool charging;
|
||||
double remainingTime;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1262,6 +1262,8 @@ AndroidBridge::GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInf
|
||||
|
||||
aBatteryInfo->level() = info[0];
|
||||
aBatteryInfo->charging() = info[1] == 1.0f;
|
||||
// TODO: this is temporary until the Android backend handles this property.
|
||||
aBatteryInfo->remainingTime() = -1.0f;
|
||||
|
||||
mJNIEnv->ReleaseDoubleArrayElements(arr, info, 0);
|
||||
}
|
||||
|
@ -202,7 +202,9 @@ Java_org_mozilla_gecko_GeckoAppShell_notifyBatteryChange(JNIEnv* jenv, jclass,
|
||||
{}
|
||||
|
||||
NS_IMETHODIMP Run() {
|
||||
hal::NotifyBatteryChange(hal::BatteryInformation(mLevel, mCharging));
|
||||
// TODO: -1 is temporary until the Android backend handles the
|
||||
// remainingTime proporty.
|
||||
hal::NotifyBatteryChange(hal::BatteryInformation(mLevel, mCharging, -1.0));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user