Commit 3451c2fc authored by spiiroin's avatar spiiroin

Merge branch 'jb43703_immediate_lock_lpm' into 'master'

Do not apply lock-immediately in lpm state

See merge request !36
parents 9107d360 8a98337d
......@@ -68,6 +68,7 @@ MceDeviceLock::MceDeviceLock(Authenticator::Methods allowedMethods, QObject *par
, m_displayOn(true)
, m_tklockActive(true)
, m_userActivity(true)
, m_lpmMode(false)
{
connect(&m_hbTimer, &BackgroundActivity::running, this, &MceDeviceLock::lock);
......@@ -102,6 +103,15 @@ MceDeviceLock::MceDeviceLock(Authenticator::Methods allowedMethods, QObject *par
handleInactivityStateChanged(state);
});
/* Note: LPM mode can't be queried at the time of writing */
systemBus().connectToSignal(
QString(),
QStringLiteral(MCE_SIGNAL_PATH),
QStringLiteral(MCE_SIGNAL_IF),
QStringLiteral(MCE_LPM_UI_MODE_SIG),
this,
SLOT(handleLpmModeChanged(const QString &)));
systemBus().registerObject(QStringLiteral("/devicelock"), this);
}
......@@ -129,7 +139,6 @@ void MceDeviceLock::trackMceProperty(
});
}
/** Handle tklock state signal/reply from mce
*/
void MceDeviceLock::handleTklockStateChanged(const QString &state)
......@@ -186,6 +195,20 @@ void MceDeviceLock::handleInactivityStateChanged(const bool state)
}
}
/** Handle LPM UI Mode signal from mce
*/
void MceDeviceLock::handleLpmModeChanged(const QString &state)
{
bool lpmMode = (state == MCE_LPM_UI_ENABLED);
if (m_lpmMode != lpmMode) {
qCDebug(daemon, "MCE LPM mode is now %s", lpmMode ? "true" : "false");
m_lpmMode = lpmMode;
setStateAndSetupLockTimer();
}
}
/** Helper for producing human readable devicelock state logging
*/
static const char *reprLockState(bool locked)
......@@ -211,7 +234,7 @@ bool MceDeviceLock::getRequiredLockState()
if (automaticLocking() < 0) {
/* Device locking is disabled */
locked = false;
} else if (automaticLocking() == 0 && !m_displayOn && !m_callActive) {
} else if (automaticLocking() == 0 && !m_displayOn && !m_lpmMode && !m_callActive) {
/* Display is off in immediate lock mode */
locked = true;
}
......
......@@ -100,6 +100,7 @@ protected slots:
void handleCallStateChanged(const QString &state);
void handleDisplayStateChanged(const QString &state);
void handleInactivityStateChanged(const bool state);
void handleLpmModeChanged(const QString &state);
private:
void trackMceProperty(
......@@ -122,6 +123,7 @@ private:
bool m_displayOn;
bool m_tklockActive;
bool m_userActivity;
bool m_lpmMode;
friend class MceDeviceLockAdaptor;
......
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