Merge lp:~lukas-kde/unity8/lockBeforeSuspend into lp:unity8

Proposed by Lukáš Tinkl
Status: Merged
Approved by: Andrea Cimitan
Approved revision: 2397
Merged at revision: 2438
Proposed branch: lp:~lukas-kde/unity8/lockBeforeSuspend
Merge into: lp:unity8
Diff against target: 45 lines (+7/-0)
1 file modified
plugins/Unity/Session/dbusunitysessionservice.cpp (+7/-0)
To merge this branch: bzr merge lp:~lukas-kde/unity8/lockBeforeSuspend
Reviewer Review Type Date Requested Status
Andrea Cimitan (community) Approve
Unity8 CI Bot continuous-integration Approve
Review via email: mp+294545@code.launchpad.net

Commit message

Lock the session when putting the laptop into sleep

Description of the change

Lock the session when putting the laptop into sleep

Logind tells us it's preparing for sleep and we react to it; also our Suspend/Hibernate/HybridSleep DBUS methods emit the same signal (when invoked manually, e.g. using keyboard shortcuts)

* Are there any related MPs required for this MP to build/function as expected? Please list.

No

* Did you perform an exploratory manual test run of your code change and any related functionality?

Yes

* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?

N/A

* If you changed the UI, has there been a design review?

N/A

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2397
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1205/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/744
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/744
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1617
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1572
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/1572
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1565
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1565/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1565
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1565/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1565
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1565/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1565
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1565/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1565
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1565/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1565
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/1565/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/1205/rebuild

review: Approve (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

Do we want this to be configurable? iirc on desktop we currently have an option to lock after suspend or not

review: Needs Information
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

I'd say in the longterm yes, for now we don't have any such config and a sensible default value is to lock imo.

Revision history for this message
Andrea Cimitan (cimi) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
y
 * Did CI run pass? If not, please explain why.
y

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Unity/Session/dbusunitysessionservice.cpp'
2--- plugins/Unity/Session/dbusunitysessionservice.cpp 2016-04-27 15:01:10 +0000
3+++ plugins/Unity/Session/dbusunitysessionservice.cpp 2016-05-12 17:11:24 +0000
4@@ -227,11 +227,14 @@
5 {
6 if (!active) {
7 setupSystemdInhibition();
8+ } else {
9+ Q_EMIT prepareForSleep();
10 }
11 }
12
13 Q_SIGNALS:
14 void screensaverActiveChanged(bool active);
15+ void prepareForSleep();
16 };
17
18 Q_GLOBAL_STATIC(DBusUnitySessionServicePrivate, d)
19@@ -245,6 +248,7 @@
20 // ... and our Unlocked() signal to the logind's session Unlock() signal
21 // (lightdm handles the unlocking by calling logind's Unlock method which in turn emits this signal we connect to)
22 QDBusConnection::systemBus().connect(LOGIN1_SERVICE, d->logindSessionPath, LOGIN1_SESSION_IFACE, QStringLiteral("Unlock"), this, SIGNAL(Unlocked()));
23+ connect(d, &DBusUnitySessionServicePrivate::prepareForSleep, this, &DBusUnitySessionService::PromptLock);
24 } else {
25 qWarning() << "Failed to connect to logind's session Lock/Unlock signals";
26 }
27@@ -390,16 +394,19 @@
28
29 void DBusUnitySessionService::Suspend()
30 {
31+ PromptLock();
32 d->makeLogin1Call(QStringLiteral("Suspend"), {false});
33 }
34
35 void DBusUnitySessionService::Hibernate()
36 {
37+ PromptLock();
38 d->makeLogin1Call(QStringLiteral("Hibernate"), {false});
39 }
40
41 void DBusUnitySessionService::HybridSleep()
42 {
43+ PromptLock();
44 d->makeLogin1Call(QStringLiteral("HybridSleep"), {false});
45 }
46

Subscribers

People subscribed via source and target branches