Merge lp:~boiko/telephony-service/greeter_dont_use_handler into lp:telephony-service

Proposed by Gustavo Pichorim Boiko
Status: Merged
Approved by: Tiago Salem Herrmann
Approved revision: 827
Merged at revision: 824
Proposed branch: lp:~boiko/telephony-service/greeter_dont_use_handler
Merge into: lp:telephony-service
Prerequisite: lp:~tiagosh/telephony-service/clear_snap_decision_on_reject
Diff against target: 118 lines (+28/-15)
3 files modified
libtelephonyservice/callmanager.cpp (+9/-5)
libtelephonyservice/telepathyhelper.cpp (+18/-9)
libtelephonyservice/telepathyhelper.h (+1/-1)
To merge this branch: bzr merge lp:~boiko/telephony-service/greeter_dont_use_handler
Reviewer Review Type Date Requested Status
Tiago Salem Herrmann (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+222231@code.launchpad.net

Commit message

Try to postpone the handler initialization as much as we can. It is still launched when the approver is started, but that is probably because of the telepathy introspection.

Description of the change

Try to postpone the handler initialization as much as we can. It is still launched when the approver is started, but that is probably because of the telepathy introspection.

== Checklist ==
Are there any related MPs required for this MP to build/function as expected? Please list.
Yes: https://code.launchpad.net/~tiagosh/telephony-service/clear_snap_decision_on_reject/+merge/222041

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/telephony-service) on device or emulator?
Yes

If you changed the UI, was the change specified/approved by design?
N/A

If you changed the packaging (debian), did you subscribe a core-dev to this MP?
N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
826. By Gustavo Pichorim Boiko

Init the handler interface.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
827. By Gustavo Pichorim Boiko

Merge latest changes from trunk.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote :

Looks good. Thanks.

-- CheckList --

Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
Yes

Did CI run pass? If not, please explain why.
Yes

Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
Yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libtelephonyservice/callmanager.cpp'
--- libtelephonyservice/callmanager.cpp 2014-04-15 17:21:13 +0000
+++ libtelephonyservice/callmanager.cpp 2014-06-09 17:25:19 +0000
@@ -23,6 +23,7 @@
23#include "callmanager.h"23#include "callmanager.h"
24#include "callentry.h"24#include "callentry.h"
25#include "telepathyhelper.h"25#include "telepathyhelper.h"
26#include "greetercontacts.h"
2627
27#include <TelepathyQt/ContactManager>28#include <TelepathyQt/ContactManager>
28#include <TelepathyQt/PendingContacts>29#include <TelepathyQt/PendingContacts>
@@ -216,13 +217,16 @@
216 return true;217 return true;
217 }218 }
218219
219 // if that's not the case, query the teleophony-service-handler for the availability of calls220 // if that's not the case, and if not in greeter mode, query the telephony-service-handler
221 // for the availability of calls.
220 // this is done only to get the live call view on clients as soon as possible, even before the222 // this is done only to get the live call view on clients as soon as possible, even before the
221 // telepathy observer is configured223 // telepathy observer is configured
222 QDBusInterface *phoneAppHandler = TelepathyHelper::instance()->handlerInterface();224 if (!GreeterContacts::instance()->isGreeterMode()) {
223 QDBusReply<bool> reply = phoneAppHandler->call("HasCalls");225 QDBusInterface *phoneAppHandler = TelepathyHelper::instance()->handlerInterface();
224 if (reply.isValid()) {226 QDBusReply<bool> reply = phoneAppHandler->call("HasCalls");
225 return reply.value();227 if (reply.isValid()) {
228 return reply.value();
229 }
226 }230 }
227231
228 return false;232 return false;
229233
=== modified file 'libtelephonyservice/telepathyhelper.cpp'
--- libtelephonyservice/telepathyhelper.cpp 2014-05-01 14:40:50 +0000
+++ libtelephonyservice/telepathyhelper.cpp 2014-06-09 17:25:19 +0000
@@ -24,6 +24,7 @@
24#include "chatmanager.h"24#include "chatmanager.h"
25#include "callmanager.h"25#include "callmanager.h"
26#include "config.h"26#include "config.h"
27#include "greetercontacts.h"
2728
28#include <TelepathyQt/AccountSet>29#include <TelepathyQt/AccountSet>
29#include <TelepathyQt/ChannelClassSpec>30#include <TelepathyQt/ChannelClassSpec>
@@ -35,7 +36,8 @@
35 : QObject(parent),36 : QObject(parent),
36 mChannelObserver(0),37 mChannelObserver(0),
37 mFirstTime(true),38 mFirstTime(true),
38 mConnected(false)39 mConnected(false),
40 mHandlerInterface(0)
39{41{
40 mAccountFeatures << Tp::Account::FeatureCore;42 mAccountFeatures << Tp::Account::FeatureCore;
41 mContactFeatures << Tp::Contact::FeatureAlias43 mContactFeatures << Tp::Contact::FeatureAlias
@@ -64,11 +66,6 @@
64 SLOT(onAccountManagerReady(Tp::PendingOperation*)));66 SLOT(onAccountManagerReady(Tp::PendingOperation*)));
6567
66 mClientRegistrar = Tp::ClientRegistrar::create(mAccountManager);68 mClientRegistrar = Tp::ClientRegistrar::create(mAccountManager);
67 mHandlerInterface = new QDBusInterface("com.canonical.TelephonyServiceHandler",
68 "/com/canonical/TelephonyServiceHandler",
69 "com.canonical.TelephonyServiceHandler",
70 QDBusConnection::sessionBus(),
71 this);
72}69}
7370
74TelepathyHelper::~TelepathyHelper()71TelepathyHelper::~TelepathyHelper()
@@ -89,7 +86,8 @@
89 Q_FOREACH(const Tp::AccountPtr &account, mAccounts) {86 Q_FOREACH(const Tp::AccountPtr &account, mAccounts) {
90 ids << account->uniqueIdentifier();87 ids << account->uniqueIdentifier();
91 }88 }
92 } else {89 } else if (!GreeterContacts::instance()->isGreeterMode()) {
90 // if we are in greeter mode, we should not initialize the handler to get the account IDs
93 QDBusReply<QStringList> reply = handlerInterface()->call("AccountIds");91 QDBusReply<QStringList> reply = handlerInterface()->call("AccountIds");
94 if (reply.isValid()) {92 if (reply.isValid()) {
95 ids = reply.value();93 ids = reply.value();
@@ -111,14 +109,25 @@
111109
112QDBusInterface *TelepathyHelper::handlerInterface() const110QDBusInterface *TelepathyHelper::handlerInterface() const
113{111{
112 // delay the loading of the handler interface, as it seems this is triggering
113 // the dbus activation of the handler process
114 if (!mHandlerInterface) {
115 mHandlerInterface = new QDBusInterface("com.canonical.TelephonyServiceHandler",
116 "/com/canonical/TelephonyServiceHandler",
117 "com.canonical.TelephonyServiceHandler",
118 QDBusConnection::sessionBus(),
119 const_cast<TelepathyHelper*>(this));
120 }
114 return mHandlerInterface;121 return mHandlerInterface;
115}122}
116123
117bool TelepathyHelper::connected() const124bool TelepathyHelper::connected() const
118{125{
119 if (QCoreApplication::applicationName() != "telephony-service-handler" && mAccounts.isEmpty()) {126 if (QCoreApplication::applicationName() != "telephony-service-handler" &&
127 mAccounts.isEmpty() &&
128 !GreeterContacts::instance()->isGreeterMode()) {
120 // get the status from the handler129 // get the status from the handler
121 QDBusReply<bool> reply = mHandlerInterface->call("IsConnected");130 QDBusReply<bool> reply = handlerInterface()->call("IsConnected");
122 if (reply.isValid()) {131 if (reply.isValid()) {
123 return reply.value();132 return reply.value();
124 }133 }
125134
=== modified file 'libtelephonyservice/telepathyhelper.h'
--- libtelephonyservice/telepathyhelper.h 2014-05-01 14:40:50 +0000
+++ libtelephonyservice/telepathyhelper.h 2014-06-09 17:25:19 +0000
@@ -95,7 +95,7 @@
95 ChannelObserver *mChannelObserver;95 ChannelObserver *mChannelObserver;
96 bool mFirstTime;96 bool mFirstTime;
97 bool mConnected;97 bool mConnected;
98 QDBusInterface *mHandlerInterface;98 mutable QDBusInterface *mHandlerInterface;
99};99};
100100
101#endif // TELEPATHYHELPER_H101#endif // TELEPATHYHELPER_H

Subscribers

People subscribed via source and target branches