Commit b585668e authored by spiiroin's avatar spiiroin

Merge branch 'jb48562_initial_battery_level' into 'master'

[batterynotifier] Use -1 for unknown battery level

See merge request !134
parents b29b864e ae4af333
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** Copyright (C) 2012-2019 Jolla Ltd.
** Copyright (c) 2019 Open Mobile Platform LLC.
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
** Copyright (c) 2012 - 2020 Jolla Ltd.
** Copyright (c) 2019 - 2020 Open Mobile Platform LLC.
**
** Contact: Robin Burchell <robin.burchell@jollamobile.com>
**
......@@ -342,7 +342,8 @@ bool BatteryNotifier::evaluateNotificationLevel(BatteryNotifier::NotificationTyp
break;
case BatteryNotifier::NotificationNotEnoughPower:
/* Battery level has dropped since charger was connected. */
level = (state.m_batteryLevel < state.m_minimumBatteryLevel);
level = (state.m_batteryLevel >= 0
&& state.m_batteryLevel < state.m_minimumBatteryLevel);
break;
}
return level;
......@@ -501,7 +502,8 @@ void BatteryNotifier::updateLowBatteryNotifier()
bool incall = m_currentState.m_callState != QMceCallState::None;
if (active || incall) {
/* Device is in "active use" */
if (m_currentState.m_batteryLevel <= m_lowBatteryRepeatLevel) {
if (m_currentState.m_batteryLevel >= 0
&& m_currentState.m_batteryLevel <= m_lowBatteryRepeatLevel) {
/* Significant battery level drop since the last warning
* -> repeat the warning immediately. */
m_lowBatteryRepeatActivity->run();
......
/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** Copyright (C) 2012-2019 Jolla Ltd.
** Copyright (c) 2019 Open Mobile Platform LLC.
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
** Copyright (c) 2012 - 2020 Jolla Ltd.
** Copyright (c) 2019 - 2020 Open Mobile Platform LLC.
**
** Contact: Robin Burchell <robin.burchell@jollamobile.com>
**
......@@ -92,8 +92,8 @@ private:
QMceChargerType::Type m_chargerType = QMceChargerType::None;
bool m_chargerState = false;
QMceBatteryStatus::Status m_batteryStatus = QMceBatteryStatus::Ok;
int m_batteryLevel = 50;
int m_minimumBatteryLevel = 0;
int m_batteryLevel = -1;
int m_minimumBatteryLevel = -1;
bool m_powerSaveMode = false;
QMceDisplay::State m_displayState = QMceDisplay::DisplayOn;
bool m_tkLock = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment