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
=== modified file 'indicator/textchannelobserver.cpp'
--- indicator/textchannelobserver.cpp 2016-03-30 13:34:38 +0000
+++ indicator/textchannelobserver.cpp 2016-09-27 13:39:41 +0000
@@ -42,6 +42,7 @@
42#include <QContactFetchRequest>42#include <QContactFetchRequest>
43#include <QContactFilter>43#include <QContactFilter>
44#include <QContactPhoneNumber>44#include <QContactPhoneNumber>
45#include <QDBusInterface>
45#include <QImage>46#include <QImage>
46#include <History/TextEvent>47#include <History/TextEvent>
47#include <History/Manager>48#include <History/Manager>
@@ -158,6 +159,7 @@
158}159}
159160
160TextChannelObserver::TextChannelObserver(QObject *parent) :161TextChannelObserver::TextChannelObserver(QObject *parent) :
162 mPowerdIface("com.canonical.powerd", "/com/canonical/powerd", "com.canonical.powerd", QDBusConnection::systemBus()),
161 QObject(parent)163 QObject(parent)
162{164{
163 connect(MessagingMenu::instance(),165 connect(MessagingMenu::instance(),
@@ -644,12 +646,20 @@
644 QTimer *timer = new QTimer(this);646 QTimer *timer = new QTimer(this);
645 timer->setInterval(1500);647 timer->setInterval(1500);
646 timer->setSingleShot(true);648 timer->setSingleShot(true);
649 QString wakeToken;
650 QDBusReply<QString> reply = mPowerdIface.call("requestSysState", "telephony-service-indicator", 1);
651 if (reply.isValid()) {
652 wakeToken = reply.value();
653 }
647 QByteArray token(message.messageToken().toUtf8());654 QByteArray token(message.messageToken().toUtf8());
648 mUnreadMessages.append(token);655 mUnreadMessages.append(token);
649 QObject::connect(timer, &QTimer::timeout, [=]() {656 QObject::connect(timer, &QTimer::timeout, [=]() {
650 triggerNotificationForMessage(message, account->accountId(), participantIds);657 triggerNotificationForMessage(message, account->accountId(), participantIds);
651 Metrics::instance()->increment(Metrics::ReceivedMessages);658 Metrics::instance()->increment(Metrics::ReceivedMessages);
652 timer->deleteLater();659 timer->deleteLater();
660 if (!wakeToken.isEmpty()) {
661 mPowerdIface.call("clearSysState", wakeToken);
662 }
653 });663 });
654 timer->start();664 timer->start();
655 }665 }
656666
=== modified file 'indicator/textchannelobserver.h'
--- indicator/textchannelobserver.h 2015-04-30 15:49:52 +0000
+++ indicator/textchannelobserver.h 2016-09-27 13:39:41 +0000
@@ -64,6 +64,7 @@
64 QList<Tp::TextChannelPtr> mFlashChannels;64 QList<Tp::TextChannelPtr> mFlashChannels;
65 QMap<NotifyNotification*, NotificationData*> mNotifications;65 QMap<NotifyNotification*, NotificationData*> mNotifications;
66 QList<QByteArray> mUnreadMessages;66 QList<QByteArray> mUnreadMessages;
67 QDBusInterface mPowerdIface;
67};68};
6869
69#endif // TEXTCHANNELOBSERVER_H70#endif // TEXTCHANNELOBSERVER_H

Subscribers

People subscribed via source and target branches