Merge lp:~unity-api-team/indicator-network/no-ofono-fix into lp:indicator-network/14.10

Proposed by Antti Kaijanmäki
Status: Merged
Approved by: Jussi Pakkanen
Approved revision: 330
Merged at revision: 332
Proposed branch: lp:~unity-api-team/indicator-network/no-ofono-fix
Merge into: lp:indicator-network/14.10
Diff against target: 92 lines (+22/-16)
3 files modified
network/modem-manager.cpp (+10/-10)
network/root-state.cpp (+2/-1)
network/wwan-section.cpp (+10/-5)
To merge this branch: bzr merge lp:~unity-api-team/indicator-network/no-ofono-fix
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Pete Woods (community) Approve
Jussi Pakkanen (community) Approve
Review via email: mp+219833@code.launchpad.net

Commit message

Fix crash when ofono is not running.

Description of the change

* Ensure the project compiles and the test suite executes without error
done.

* Ensure that non-obvious code has comments explaining it
It's clear as black.

* If the change works on specific profiles, please include those in the merge description
Affects all profiles.

TestPlan: https://wiki.ubuntu.com/Process/Merges/TestPlan/indicator-network
silo: https://launchpad.net/~ci-train-ppa-service/+archive/landing-011/

Note to Reviewers:
No need to run the autopilot tests.

All you need to test is that after installing the silo and rebooting:
1) indicator-network is available in the panel
2) the indicator has "Wifi" toggle
3) toggling the wifi toggle enables / disables wifi
4) you can connect to a wifi network
5) there is no roaming "R" icon on tablets without modem and indicator does not contain "Cellular Settings..." item OR if the device has a modem the indicator contains "Cellular Settings..." item
6) system-settings wifi page also contains wifi toggle and list of access points if wifi is enabled.

To post a comment you must log in.
Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

The crash was caused by "use before init" in modem-manager.cpp as ofono_disappeared() was getting called before m_unlockDialog got constructed.

Change in wwan-section.cpp makes sure we don't show the "Cellular Settings..." item on a system where there are no modems.

Revision history for this message
Jussi Pakkanen (jpakkane) wrote :

Yes from me and Pete.

review: Approve
Revision history for this message
Pete Woods (pete-woods) :
review: Approve
331. By Antti Kaijanmäki

merge trunk.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
332. By Antti Kaijanmäki

RootState: initialize m_roaming properly.

Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

Tested on mako:

1) indicator-network is available in the panel

Yes.

2) the indicator has "Wifi" toggle

Yes.

3) toggling the wifi toggle enables / disables wifi

Yes.

4) you can connect to a wifi network

Yes.

5) there is no roaming "R" icon on tablets without modem and indicator does not contain "Cellular Settings..." item OR if the device has a modem the indicator contains "Cellular Settings..." item

mako has a modem and cellular settings item is in the indicator

6) system-settings wifi page also contains wifi toggle and list of access points if wifi is enabled.

Yes.

Revision history for this message
Antti Kaijanmäki (kaijanmaki) wrote :

Satoris tested also with mako.

18:56 < Satoris> Wellark: the six list check passes with silo11.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'network/modem-manager.cpp'
2--- network/modem-manager.cpp 2014-04-30 21:32:28 +0000
3+++ network/modem-manager.cpp 2014-05-16 14:36:29 +0000
4@@ -56,16 +56,6 @@
5
6 m_dbus.reset(new core::dbus::DBus(m_bus));
7
8- auto names = m_dbus->list_names();
9- if (std::find(names.begin(), names.end(), org::ofono::Service::name()) != names.end()) {
10- ofono_appeared();
11- } else {
12- ofono_disappeared();
13- }
14- m_watcher = m_dbus->make_service_watcher(org::ofono::Service::name());
15- m_watcher->service_registered().connect([this]() { ofono_appeared(); });
16- m_watcher->service_unregistered().connect([this](){ ofono_disappeared(); });
17-
18 m_unlockDialog = std::make_shared<SimUnlockDialog>();
19 m_unlockDialog->state().changed().connect([this](SimUnlockDialog::State state){
20 switch (state) {
21@@ -82,6 +72,16 @@
22 break;
23 }
24 });
25+
26+ auto names = m_dbus->list_names();
27+ if (std::find(names.begin(), names.end(), org::ofono::Service::name()) != names.end()) {
28+ ofono_appeared();
29+ } else {
30+ ofono_disappeared();
31+ }
32+ m_watcher = m_dbus->make_service_watcher(org::ofono::Service::name());
33+ m_watcher->service_registered().connect([this]() { ofono_appeared(); });
34+ m_watcher->service_unregistered().connect([this](){ ofono_disappeared(); });
35 }
36
37 ~Private()
38
39=== modified file 'network/root-state.cpp'
40--- network/root-state.cpp 2014-05-15 15:52:51 +0000
41+++ network/root-state.cpp 2014-05-16 14:36:29 +0000
42@@ -62,7 +62,8 @@
43
44 RootState::Private::Private(std::shared_ptr<networking::Manager> manager, ModemManager::Ptr modemManager)
45 : m_manager{manager},
46- m_modemManager{modemManager}
47+ m_modemManager{modemManager},
48+ m_roaming{false}
49 {
50 m_manager->flightMode().changed().connect(std::bind(&Private::flightModeChanged, this, std::placeholders::_1));
51 flightModeChanged(m_manager->flightMode().get());
52
53=== modified file 'network/wwan-section.cpp'
54--- network/wwan-section.cpp 2014-04-23 13:18:25 +0000
55+++ network/wwan-section.cpp 2014-05-16 14:36:29 +0000
56@@ -76,9 +76,6 @@
57 m_topMenu = std::make_shared<Menu>();
58 m_topMenu->append(m_topItem);
59
60- m_modemManager->modems().changed().connect(std::bind(&Private::modemsChanged, this, std::placeholders::_1));
61- modemsChanged(m_modemManager->modems());
62-
63 m_openCellularSettings = std::make_shared<TextItem>(_("Cellular settings…"), "cellular", "settings");
64 m_openCellularSettings->activated().connect([](){
65 UrlDispatcher::send("settings:///system/cellular", [](std::string url, bool success){
66@@ -86,9 +83,10 @@
67 std::cerr << "URL Dispatcher failed on " << url << std::endl;
68 });
69 });
70-
71- m_bottomMenu->append(*m_openCellularSettings);
72 m_actionGroupMerger->add(*m_openCellularSettings);
73+
74+ m_modemManager->modems().changed().connect(std::bind(&Private::modemsChanged, this, std::placeholders::_1));
75+ modemsChanged(m_modemManager->modems());
76 }
77
78 void
79@@ -124,6 +122,13 @@
80 m_actionGroupMerger->add(*item);
81 m_items.push_back(std::make_pair(modem, item));
82 }
83+
84+ if (modems.size() == 0) {
85+ m_bottomMenu->clear();
86+ } else {
87+ if (m_bottomMenu->find(*m_openCellularSettings) == m_bottomMenu->end())
88+ m_bottomMenu->append(*m_openCellularSettings);
89+ }
90 }
91
92 WwanSection::WwanSection(ModemManager::Ptr modemManager)

Subscribers

People subscribed via source and target branches