Bug 700261 - Add .chargingTime/.dischargingTime support to hal code. r=cjones

This commit is contained in:
Mounir Lamouri 2011-11-09 09:58:59 +01:00
Родитель 929ef89d75
Коммит b4692e95a1
7 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -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;
}