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

Proposed by Thomas Voß on 2016-01-25
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 2016-01-25 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ß on 2016-01-25

Add handling of driver-specific quirks.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.cpp'
2--- src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.cpp 2015-11-13 10:19:29 +0000
3+++ src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.cpp 2016-01-25 16:17:56 +0000
4@@ -30,10 +30,13 @@
5
6 #include <com/ubuntu/location/connectivity/manager.h>
7
8+#include <core/posix/this_process.h>
9+
10 #include <boost/property_tree/ini_parser.hpp>
11
12 #include <random>
13
14+namespace env = core::posix::this_process::env;
15 namespace gps = com::ubuntu::location::providers::gps;
16 namespace android = com::ubuntu::location::providers::gps::android;
17
18@@ -328,7 +331,7 @@
19 if (thiz->impl.utc_time_request_handler)
20 {
21 thiz->impl.utc_time_request_handler();
22- } else
23+ } else if (not thiz->impl.quirks.avoid_reference_time_injection)
24 {
25 auto now = location::Clock::now().time_since_epoch();
26 auto ms_since_epoch = std::chrono::duration_cast<std::chrono::milliseconds>(now);
27@@ -515,6 +518,9 @@
28
29 bool android::HardwareAbstractionLayer::inject_reference_position(const location::Position& position)
30 {
31+ if (impl.quirks.avoid_reference_location_injection)
32+ return false;
33+
34 // TODO(tvoss): We should expose the int return type of the underyling
35 // Android HAL to capture errors here.
36 UHardwareGpsLocation loc;
37@@ -553,7 +559,8 @@
38 android::HardwareAbstractionLayer::Impl::Impl(
39 android::HardwareAbstractionLayer* parent,
40 const android::HardwareAbstractionLayer::Configuration& configuration)
41- : capabilities(0),
42+ : quirks(configuration.quirks),
43+ capabilities(0),
44 assistance_mode(gps::AssistanceMode::mobile_station_based),
45 position_mode(gps::PositionMode::periodic),
46 supl_assistant(*parent),
47@@ -664,6 +671,11 @@
48 {
49 create_xtra_downloader(),
50 gps_xtra_downloader_configuration((in_system_gps_conf ? in_system_gps_conf : in_gps_conf))
51+ },
52+ android::HardwareAbstractionLayer::Quirks
53+ {
54+ env::get("UBUNTU_LOCATION_SERVICE_GPS_QUIRK_AVOID_TIME_INJECTION", "false") == "true",
55+ env::get("UBUNTU_LOCATION_SERVICE_GPS_QUIRK_AVOID_LOCATION_INJECTION", "false") == "true",
56 }
57 };
58
59
60=== modified file 'src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.h'
61--- src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.h 2015-11-13 10:19:29 +0000
62+++ src/location_service/com/ubuntu/location/providers/gps/android_hardware_abstraction_layer.h 2016-01-25 16:17:56 +0000
63@@ -179,6 +179,15 @@
64 */
65 static void on_request_utc_time(void* context);
66
67+ /// @brief Quirks summarizes chip/driver-specific knobs and dials.
68+ struct Quirks
69+ {
70+ /// @brief Some chipsets are known to fail with reference time injection.
71+ bool avoid_reference_time_injection;
72+ /// @brief Some chipsets are known to fail for injected reference locations.
73+ bool avoid_reference_location_injection;
74+ };
75+
76 struct Configuration
77 {
78 struct
79@@ -186,6 +195,7 @@
80 std::shared_ptr<GpsXtraDownloader> downloader;
81 GpsXtraDownloader::Configuration configuration;
82 } gps_xtra;
83+ Quirks quirks;
84 };
85
86 HardwareAbstractionLayer(const Configuration& configuration);
87@@ -237,6 +247,8 @@
88 // Adjusts the assistance and positioning mode in one go, returning false in case of issues.
89 bool dispatch_updated_modes_to_driver();
90
91+ // Hw/driver-specific quirks.
92+ Quirks quirks;
93 // The parameter bundle for the hardware GPS instance.
94 UHardwareGpsParams gps_params;
95 // The actual handle to the hardware GPS instance.

Subscribers

People subscribed via source and target branches