Merge lp:~tiagosh/telephony-service/request-wake-lock into lp:telephony-service

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Bill Filler
Approved revision: 1210
Merged at revision: 1209
Proposed branch: lp:~tiagosh/telephony-service/request-wake-lock
Merge into: lp:telephony-service
Diff against target: 52 lines (+11/-0)
2 files modified
indicator/textchannelobserver.cpp (+10/-0)
indicator/textchannelobserver.h (+1/-0)
To merge this branch: bzr merge lp:~tiagosh/telephony-service/request-wake-lock
Reviewer Review Type Date Requested Status
system-apps-ci-bot continuous-integration Needs Fixing
Alexandros Frantzis (community) Needs Fixing
Review via email: mp+306801@code.launchpad.net

Commit message

Request a wake lock so the device doesn't go to deep sleep when receiving an sms.

Description of the change

Request a wake lock so the device doesn't go to deep sleep when receiving an sms.

To post a comment you must log in.
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

PASSED: Continuous integration, rev:1209
https://jenkins.canonical.com/system-apps/job/lp-telephony-service-ci/62/
Executed test runs:
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build/1621
    SUCCESS: https://jenkins.canonical.com/system-apps/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=default/383
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1621
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1468
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1468/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1468
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1468/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1468
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1468/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1468
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1468/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1468
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1468/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1468
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1468/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1468
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1468/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1468
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1468/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1468
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1468/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-telephony-service-ci/62/rebuild

review: Approve (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

com.canonical.powerd.requestWakeup doesn't acquire a wake lock, it asks for a wakeup signal to be emitted after a timeout. This wakeup signal is special in that it can wake up the phone from suspend, but it doesn't act as a wakelock, i.e. it doesn't inhibit future suspends.

To acquire a wakelock from (re)powerd use instead:

cookie = com.canonical.powerd.requestSysState("telephony-service-indicator", 1)

(where '1' means 'active state')

and to release the wakelock:

com.canonical.powerd.clearSysState(cookie)

review: Needs Fixing
1210. By Tiago Salem Herrmann

change requestWakeup to requestSysState

Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

Thanks for the review.
Just fixed as you suggested and it works fine.

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1210
https://jenkins.canonical.com/system-apps/job/lp-telephony-service-ci/65/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/1640/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/1640
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1486/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial+overlay/1486/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1486
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=yakkety/1486/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1486
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1486/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1486
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial+overlay/1486/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1486
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=yakkety/1486/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1486
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/1486/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial+overlay/1486/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=yakkety/1486/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-telephony-service-ci/65/rebuild

review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'indicator/textchannelobserver.cpp'
2--- indicator/textchannelobserver.cpp 2016-03-30 13:34:38 +0000
3+++ indicator/textchannelobserver.cpp 2016-09-27 13:39:41 +0000
4@@ -42,6 +42,7 @@
5 #include <QContactFetchRequest>
6 #include <QContactFilter>
7 #include <QContactPhoneNumber>
8+#include <QDBusInterface>
9 #include <QImage>
10 #include <History/TextEvent>
11 #include <History/Manager>
12@@ -158,6 +159,7 @@
13 }
14
15 TextChannelObserver::TextChannelObserver(QObject *parent) :
16+ mPowerdIface("com.canonical.powerd", "/com/canonical/powerd", "com.canonical.powerd", QDBusConnection::systemBus()),
17 QObject(parent)
18 {
19 connect(MessagingMenu::instance(),
20@@ -644,12 +646,20 @@
21 QTimer *timer = new QTimer(this);
22 timer->setInterval(1500);
23 timer->setSingleShot(true);
24+ QString wakeToken;
25+ QDBusReply<QString> reply = mPowerdIface.call("requestSysState", "telephony-service-indicator", 1);
26+ if (reply.isValid()) {
27+ wakeToken = reply.value();
28+ }
29 QByteArray token(message.messageToken().toUtf8());
30 mUnreadMessages.append(token);
31 QObject::connect(timer, &QTimer::timeout, [=]() {
32 triggerNotificationForMessage(message, account->accountId(), participantIds);
33 Metrics::instance()->increment(Metrics::ReceivedMessages);
34 timer->deleteLater();
35+ if (!wakeToken.isEmpty()) {
36+ mPowerdIface.call("clearSysState", wakeToken);
37+ }
38 });
39 timer->start();
40 }
41
42=== modified file 'indicator/textchannelobserver.h'
43--- indicator/textchannelobserver.h 2015-04-30 15:49:52 +0000
44+++ indicator/textchannelobserver.h 2016-09-27 13:39:41 +0000
45@@ -64,6 +64,7 @@
46 QList<Tp::TextChannelPtr> mFlashChannels;
47 QMap<NotifyNotification*, NotificationData*> mNotifications;
48 QList<QByteArray> mUnreadMessages;
49+ QDBusInterface mPowerdIface;
50 };
51
52 #endif // TEXTCHANNELOBSERVER_H

Subscribers

People subscribed via source and target branches