Merge lp:~thomas-voss/location-service/add-quirk-handling-for-gps-drivers into lp:location-service/15.04

Proposed by Thomas Voß
Status: Needs review
Proposed branch: lp:~thomas-voss/location-service/add-quirk-handling-for-gps-drivers
Merge into: lp:location-service/15.04
Diff against target: 95 lines (+26/-2)
2 files modified
src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.cpp (+14/-2)
src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.h (+12/-0)
To merge this branch: bzr merge lp:~thomas-voss/location-service/add-quirk-handling-for-gps-drivers
Reviewer Review Type Date Requested Status
Ubuntu Phablet Team Pending
Review via email: mp+283835@code.launchpad.net

Commit message

Add handling of driver-specific quirks.

Description of the change

Add handling of driver-specific quirks.

To post a comment you must log in.

Unmerged revisions

216. By Thomas Voß

Add handling of driver-specific quirks.

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/providers/gps/android_hardware_abstraction_layer.cpp'
--- src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.cpp 2015-11-13 10:19:29 +0000
+++ src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.cpp 2016-01-25 16:17:56 +0000
@@ -30,10 +30,13 @@
3030
31#include <com/ubuntu/location/connectivity/manager.h>31#include <com/ubuntu/location/connectivity/manager.h>
3232
33#include <core/posix/this_process.h>
34
33#include <boost/property_tree/ini_parser.hpp>35#include <boost/property_tree/ini_parser.hpp>
3436
35#include <random>37#include <random>
3638
39namespace env = core::posix::this_process::env;
37namespace gps = com::ubuntu::location::providers::gps;40namespace gps = com::ubuntu::location::providers::gps;
38namespace android = com::ubuntu::location::providers::gps::android;41namespace android = com::ubuntu::location::providers::gps::android;
3942
@@ -328,7 +331,7 @@
328 if (thiz->impl.utc_time_request_handler)331 if (thiz->impl.utc_time_request_handler)
329 {332 {
330 thiz->impl.utc_time_request_handler();333 thiz->impl.utc_time_request_handler();
331 } else334 } else if (not thiz->impl.quirks.avoid_reference_time_injection)
332 {335 {
333 auto now = location::Clock::now().time_since_epoch();336 auto now = location::Clock::now().time_since_epoch();
334 auto ms_since_epoch = std::chrono::duration_cast<std::chrono::milliseconds>(now);337 auto ms_since_epoch = std::chrono::duration_cast<std::chrono::milliseconds>(now);
@@ -515,6 +518,9 @@
515518
516bool android::HardwareAbstractionLayer::inject_reference_position(const location::Position& position)519bool android::HardwareAbstractionLayer::inject_reference_position(const location::Position& position)
517{520{
521 if (impl.quirks.avoid_reference_location_injection)
522 return false;
523
518 // TODO(tvoss): We should expose the int return type of the underyling524 // TODO(tvoss): We should expose the int return type of the underyling
519 // Android HAL to capture errors here.525 // Android HAL to capture errors here.
520 UHardwareGpsLocation loc;526 UHardwareGpsLocation loc;
@@ -553,7 +559,8 @@
553android::HardwareAbstractionLayer::Impl::Impl(559android::HardwareAbstractionLayer::Impl::Impl(
554 android::HardwareAbstractionLayer* parent,560 android::HardwareAbstractionLayer* parent,
555 const android::HardwareAbstractionLayer::Configuration& configuration)561 const android::HardwareAbstractionLayer::Configuration& configuration)
556 : capabilities(0),562 : quirks(configuration.quirks),
563 capabilities(0),
557 assistance_mode(gps::AssistanceMode::mobile_station_based),564 assistance_mode(gps::AssistanceMode::mobile_station_based),
558 position_mode(gps::PositionMode::periodic),565 position_mode(gps::PositionMode::periodic),
559 supl_assistant(*parent),566 supl_assistant(*parent),
@@ -664,6 +671,11 @@
664 {671 {
665 create_xtra_downloader(),672 create_xtra_downloader(),
666 gps_xtra_downloader_configuration((in_system_gps_conf ? in_system_gps_conf : in_gps_conf))673 gps_xtra_downloader_configuration((in_system_gps_conf ? in_system_gps_conf : in_gps_conf))
674 },
675 android::HardwareAbstractionLayer::Quirks
676 {
677 env::get("UBUNTU_LOCATION_SERVICE_GPS_QUIRK_AVOID_TIME_INJECTION", "false") == "true",
678 env::get("UBUNTU_LOCATION_SERVICE_GPS_QUIRK_AVOID_LOCATION_INJECTION", "false") == "true",
667 }679 }
668 };680 };
669681
670682
=== modified file 'src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.h'
--- src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.h 2015-11-13 10:19:29 +0000
+++ src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.h 2016-01-25 16:17:56 +0000
@@ -179,6 +179,15 @@
179 */179 */
180 static void on_request_utc_time(void* context);180 static void on_request_utc_time(void* context);
181181
182 /// @brief Quirks summarizes chip/driver-specific knobs and dials.
183 struct Quirks
184 {
185 /// @brief Some chipsets are known to fail with reference time injection.
186 bool avoid_reference_time_injection;
187 /// @brief Some chipsets are known to fail for injected reference locations.
188 bool avoid_reference_location_injection;
189 };
190
182 struct Configuration191 struct Configuration
183 {192 {
184 struct193 struct
@@ -186,6 +195,7 @@
186 std::shared_ptr<GpsXtraDownloader> downloader;195 std::shared_ptr<GpsXtraDownloader> downloader;
187 GpsXtraDownloader::Configuration configuration;196 GpsXtraDownloader::Configuration configuration;
188 } gps_xtra;197 } gps_xtra;
198 Quirks quirks;
189 };199 };
190200
191 HardwareAbstractionLayer(const Configuration& configuration);201 HardwareAbstractionLayer(const Configuration& configuration);
@@ -237,6 +247,8 @@
237 // Adjusts the assistance and positioning mode in one go, returning false in case of issues.247 // Adjusts the assistance and positioning mode in one go, returning false in case of issues.
238 bool dispatch_updated_modes_to_driver();248 bool dispatch_updated_modes_to_driver();
239249
250 // Hw/driver-specific quirks.
251 Quirks quirks;
240 // The parameter bundle for the hardware GPS instance.252 // The parameter bundle for the hardware GPS instance.
241 UHardwareGpsParams gps_params;253 UHardwareGpsParams gps_params;
242 // The actual handle to the hardware GPS instance.254 // The actual handle to the hardware GPS instance.

Subscribers

People subscribed via source and target branches