Merge lp:~thomas-voss/location-service/do-not-rely-on-obsolete-satellite-based-positioning-state into lp:location-service/15.04

Proposed by Thomas Voß
Status: Merged
Approved by: Timo Jyrinki
Approved revision: 217
Merged at revision: 216
Proposed branch: lp:~thomas-voss/location-service/do-not-rely-on-obsolete-satellite-based-positioning-state
Merge into: lp:location-service/15.04
Diff against target: 71 lines (+3/-24)
2 files modified
src/location_service/com/ubuntu/location/engine.cpp (+2/-14)
tests/engine_test.cpp (+1/-10)
To merge this branch: bzr merge lp:~thomas-voss/location-service/do-not-rely-on-obsolete-satellite-based-positioning-state
Reviewer Review Type Date Requested Status
Scott Sweeny (community) Approve
Timo Jyrinki Approve
Review via email: mp+287790@code.launchpad.net

This proposal supersedes a proposal from 2016-03-02.

Commit message

Remove explicit option to disable satellite-based positioning services.

The service is clever enough to dynamically enable/disable the provider, taking into account
accuracy requirements.

Description of the change

Remove explicit option to disable satellite-based positioning services.

The service is clever enough to dynamically enable/disable the provider, taking into account
accuracy requirements.

To post a comment you must log in.
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Two tests failing (in the silo build):

Engine.reads_state_from_settings_on_construction
Engine.stores_state_from_settings_on_destruction

review: Needs Fixing
217. By Thomas Voß

Adjust test case and remove expectations on satellite-based positioning state.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Confirming fixed from the silo on my Bq OTA-9.1.

review: Approve
Revision history for this message
Scott Sweeny (ssweeny) wrote :

This code looks good, and the tests all pass locally for me with this latest change.

review: Approve
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

That is, without the silo upgrade, unable to get a real GPS fix as witnessed with client --bus system. With the silo in identical conditions, a trustworthy GPS fix with accurate location.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Ok the problem and how to test the fix:

/var/lib/ubuntu-location-service/config.ini:
- On my (stable OTA-9.1, untouched) phone the second line about satellites use was "Off"

Real GPS wasn't use, only the cell/wifi based approximation 500m-1km off the goal.

I used "client" from ubuntu-location-service-example package to ./client --bus system. When it was broken, I only got approximate location and not eg velocity data.

After upgrading to the fixed silo, despite the config.ini still having the "Off" in there on the second line, I started getting (when near window or outside) the exact coordinates of myself and also additional data in the ./client --bus system output regarding velocity that was not there before.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Ie Engine::SatelliteBasedPositioningState=SatelliteBasedPositioningState::off is the setting that should be set for testing the bug and the fact that silo fixes GPS to work even if that line is there.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/location_service/com/ubuntu/location/engine.cpp'
--- src/location_service/com/ubuntu/location/engine.cpp 2015-11-19 09:55:37 +0000
+++ src/location_service/com/ubuntu/location/engine.cpp 2016-03-02 15:26:55 +0000
@@ -97,10 +97,7 @@
97 Configuration::Keys::engine_state,97 Configuration::Keys::engine_state,
98 Configuration::Defaults::engine_state);98 Configuration::Defaults::engine_state);
9999
100 configuration.satellite_based_positioning_state =100 configuration.satellite_based_positioning_state = Configuration::Defaults::satellite_based_positioning_state;
101 settings->get_enum_for_key<SatelliteBasedPositioningState>(
102 Configuration::Keys::satellite_based_positioning_state,
103 Configuration::Defaults::satellite_based_positioning_state);
104101
105 configuration.wifi_and_cell_id_reporting_state =102 configuration.wifi_and_cell_id_reporting_state =
106 settings->get_enum_for_key<WifiAndCellIdReportingState>(103 settings->get_enum_for_key<WifiAndCellIdReportingState>(
@@ -110,12 +107,7 @@
110 configuration.engine_state.changed().connect([this](const Engine::Status& status)107 configuration.engine_state.changed().connect([this](const Engine::Status& status)
111 {108 {
112 Engine::settings->set_enum_for_key<Engine::Status>(Configuration::Keys::engine_state, status);109 Engine::settings->set_enum_for_key<Engine::Status>(Configuration::Keys::engine_state, status);
113 });110 });
114
115 configuration.satellite_based_positioning_state.changed().connect([this](SatelliteBasedPositioningState state)
116 {
117 Engine::settings->set_enum_for_key<SatelliteBasedPositioningState>(Configuration::Keys::satellite_based_positioning_state, state);
118 });
119111
120 configuration.wifi_and_cell_id_reporting_state.changed().connect([this](WifiAndCellIdReportingState state)112 configuration.wifi_and_cell_id_reporting_state.changed().connect([this](WifiAndCellIdReportingState state)
121 {113 {
@@ -129,10 +121,6 @@
129 Configuration::Keys::engine_state,121 Configuration::Keys::engine_state,
130 configuration.engine_state);122 configuration.engine_state);
131123
132 settings->set_enum_for_key<SatelliteBasedPositioningState>(
133 Configuration::Keys::satellite_based_positioning_state,
134 configuration.satellite_based_positioning_state);
135
136 settings->set_enum_for_key<WifiAndCellIdReportingState>(124 settings->set_enum_for_key<WifiAndCellIdReportingState>(
137 Configuration::Keys::wifi_and_cell_id_reporting_state,125 Configuration::Keys::wifi_and_cell_id_reporting_state,
138 configuration.wifi_and_cell_id_reporting_state);126 configuration.wifi_and_cell_id_reporting_state);
139127
=== modified file 'tests/engine_test.cpp'
--- tests/engine_test.cpp 2015-11-19 09:55:37 +0000
+++ tests/engine_test.cpp 2016-03-02 15:26:55 +0000
@@ -273,13 +273,9 @@
273 auto selection_policy = std::make_shared<NiceMock<MockProviderSelectionPolicy>>();273 auto selection_policy = std::make_shared<NiceMock<MockProviderSelectionPolicy>>();
274274
275 EXPECT_CALL(*settings, has_value_for_key(_))275 EXPECT_CALL(*settings, has_value_for_key(_))
276 .Times(3)276 .Times(2)
277 .WillRepeatedly(Return(true));277 .WillRepeatedly(Return(true));
278 EXPECT_CALL(*settings, get_string_for_key_or_throw(278 EXPECT_CALL(*settings, get_string_for_key_or_throw(
279 location::Engine::Configuration::Keys::satellite_based_positioning_state))
280 .Times(1)
281 .WillRepeatedly(Return(ss_satellite_based_positioning_state.str()));
282 EXPECT_CALL(*settings, get_string_for_key_or_throw(
283 location::Engine::Configuration::Keys::wifi_and_cell_id_reporting_state))279 location::Engine::Configuration::Keys::wifi_and_cell_id_reporting_state))
284 .Times(1)280 .Times(1)
285 .WillRepeatedly(Return(ss_wifi_and_cell_id_reporting_state.str()));281 .WillRepeatedly(Return(ss_wifi_and_cell_id_reporting_state.str()));
@@ -299,11 +295,6 @@
299 auto selection_policy = std::make_shared<NiceMock<MockProviderSelectionPolicy>>();295 auto selection_policy = std::make_shared<NiceMock<MockProviderSelectionPolicy>>();
300296
301 EXPECT_CALL(*settings, set_string_for_key(297 EXPECT_CALL(*settings, set_string_for_key(
302 location::Engine::Configuration::Keys::satellite_based_positioning_state,
303 _))
304 .Times(1)
305 .WillRepeatedly(Return(true));
306 EXPECT_CALL(*settings, set_string_for_key(
307 location::Engine::Configuration::Keys::wifi_and_cell_id_reporting_state,298 location::Engine::Configuration::Keys::wifi_and_cell_id_reporting_state,
308 _))299 _))
309 .Times(1)300 .Times(1)

Subscribers

People subscribed via source and target branches