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
1=== modified file 'libtelephonyservice/callmanager.cpp'
2--- libtelephonyservice/callmanager.cpp 2014-04-15 17:21:13 +0000
3+++ libtelephonyservice/callmanager.cpp 2014-06-09 17:25:19 +0000
4@@ -23,6 +23,7 @@
5 #include "callmanager.h"
6 #include "callentry.h"
7 #include "telepathyhelper.h"
8+#include "greetercontacts.h"
9
10 #include <TelepathyQt/ContactManager>
11 #include <TelepathyQt/PendingContacts>
12@@ -216,13 +217,16 @@
13 return true;
14 }
15
16- // if that's not the case, query the teleophony-service-handler for the availability of calls
17+ // if that's not the case, and if not in greeter mode, query the telephony-service-handler
18+ // for the availability of calls.
19 // this is done only to get the live call view on clients as soon as possible, even before the
20 // telepathy observer is configured
21- QDBusInterface *phoneAppHandler = TelepathyHelper::instance()->handlerInterface();
22- QDBusReply<bool> reply = phoneAppHandler->call("HasCalls");
23- if (reply.isValid()) {
24- return reply.value();
25+ if (!GreeterContacts::instance()->isGreeterMode()) {
26+ QDBusInterface *phoneAppHandler = TelepathyHelper::instance()->handlerInterface();
27+ QDBusReply<bool> reply = phoneAppHandler->call("HasCalls");
28+ if (reply.isValid()) {
29+ return reply.value();
30+ }
31 }
32
33 return false;
34
35=== modified file 'libtelephonyservice/telepathyhelper.cpp'
36--- libtelephonyservice/telepathyhelper.cpp 2014-05-01 14:40:50 +0000
37+++ libtelephonyservice/telepathyhelper.cpp 2014-06-09 17:25:19 +0000
38@@ -24,6 +24,7 @@
39 #include "chatmanager.h"
40 #include "callmanager.h"
41 #include "config.h"
42+#include "greetercontacts.h"
43
44 #include <TelepathyQt/AccountSet>
45 #include <TelepathyQt/ChannelClassSpec>
46@@ -35,7 +36,8 @@
47 : QObject(parent),
48 mChannelObserver(0),
49 mFirstTime(true),
50- mConnected(false)
51+ mConnected(false),
52+ mHandlerInterface(0)
53 {
54 mAccountFeatures << Tp::Account::FeatureCore;
55 mContactFeatures << Tp::Contact::FeatureAlias
56@@ -64,11 +66,6 @@
57 SLOT(onAccountManagerReady(Tp::PendingOperation*)));
58
59 mClientRegistrar = Tp::ClientRegistrar::create(mAccountManager);
60- mHandlerInterface = new QDBusInterface("com.canonical.TelephonyServiceHandler",
61- "/com/canonical/TelephonyServiceHandler",
62- "com.canonical.TelephonyServiceHandler",
63- QDBusConnection::sessionBus(),
64- this);
65 }
66
67 TelepathyHelper::~TelepathyHelper()
68@@ -89,7 +86,8 @@
69 Q_FOREACH(const Tp::AccountPtr &account, mAccounts) {
70 ids << account->uniqueIdentifier();
71 }
72- } else {
73+ } else if (!GreeterContacts::instance()->isGreeterMode()) {
74+ // if we are in greeter mode, we should not initialize the handler to get the account IDs
75 QDBusReply<QStringList> reply = handlerInterface()->call("AccountIds");
76 if (reply.isValid()) {
77 ids = reply.value();
78@@ -111,14 +109,25 @@
79
80 QDBusInterface *TelepathyHelper::handlerInterface() const
81 {
82+ // delay the loading of the handler interface, as it seems this is triggering
83+ // the dbus activation of the handler process
84+ if (!mHandlerInterface) {
85+ mHandlerInterface = new QDBusInterface("com.canonical.TelephonyServiceHandler",
86+ "/com/canonical/TelephonyServiceHandler",
87+ "com.canonical.TelephonyServiceHandler",
88+ QDBusConnection::sessionBus(),
89+ const_cast<TelepathyHelper*>(this));
90+ }
91 return mHandlerInterface;
92 }
93
94 bool TelepathyHelper::connected() const
95 {
96- if (QCoreApplication::applicationName() != "telephony-service-handler" && mAccounts.isEmpty()) {
97+ if (QCoreApplication::applicationName() != "telephony-service-handler" &&
98+ mAccounts.isEmpty() &&
99+ !GreeterContacts::instance()->isGreeterMode()) {
100 // get the status from the handler
101- QDBusReply<bool> reply = mHandlerInterface->call("IsConnected");
102+ QDBusReply<bool> reply = handlerInterface()->call("IsConnected");
103 if (reply.isValid()) {
104 return reply.value();
105 }
106
107=== modified file 'libtelephonyservice/telepathyhelper.h'
108--- libtelephonyservice/telepathyhelper.h 2014-05-01 14:40:50 +0000
109+++ libtelephonyservice/telepathyhelper.h 2014-06-09 17:25:19 +0000
110@@ -95,7 +95,7 @@
111 ChannelObserver *mChannelObserver;
112 bool mFirstTime;
113 bool mConnected;
114- QDBusInterface *mHandlerInterface;
115+ mutable QDBusInterface *mHandlerInterface;
116 };
117
118 #endif // TELEPATHYHELPER_H

Subscribers

People subscribed via source and target branches