DivestOS/Patches/Common/android_hardware_qcom_gps/0001-rollover.patch
Tad 2f83043c68 14.1+15.1: GPS week rollover fix
16.0: 279492
17.1: 278135

also switch to alternate Xtra servers
https://developer.gemalto.com/threads/gps-time-info-error
2020-08-09 12:30:47 -04:00

106 lines
4.8 KiB
Diff

From 67a2a14cf94f41a11d73cd76aac01fb02f4b6399 Mon Sep 17 00:00:00 2001
From: jlask <jason972000@gmail.com>
Date: Tue, 19 May 2020 10:04:37 -0500
Subject: [PATCH] gps: Correct week rollover timestamps
This adjustment will help with applications checking the time coming from gps.
Some applictions will consider times in the far past as an error.
Change-Id: I69d6971249c4898ac3895f725e46f268cdb2b00d
---
core/LocApiBase.cpp | 7 +++++++
msm8084/core/LocApiBase.cpp | 7 +++++++
msm8909/core/LocApiBase.cpp | 7 +++++++
msm8960/core/LocApiBase.cpp | 6 ++++++
msm8974/core/LocApiBase.cpp | 6 ++++++
5 files changed, 33 insertions(+)
diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp
index f56694e..a284080 100644
--- a/core/LocApiBase.cpp
+++ b/core/LocApiBase.cpp
@@ -243,6 +243,13 @@ void LocApiBase::reportPosition(UlpLocation &location,
location.gpsLocation.bearing, location.gpsLocation.accuracy,
location.gpsLocation.timestamp, location.rawDataSize,
location.rawData, status, loc_technology_mask);
+
+ if (location.gpsLocation.timestamp > 0 &&
+ location.gpsLocation.timestamp <1580000000000) {
+ location.gpsLocation.timestamp = location.gpsLocation.timestamp + 619315200000;
+ LOC_LOGV("week rollover fixed, timestamp: %lld.", location.gpsLocation.timestamp);
+ }
+
// loop through adapters, and deliver to all adapters.
TO_ALL_LOCADAPTERS(
mLocAdapters[i]->reportPosition(location,
diff --git a/msm8084/core/LocApiBase.cpp b/msm8084/core/LocApiBase.cpp
index 152243f..aed4cdd 100644
--- a/msm8084/core/LocApiBase.cpp
+++ b/msm8084/core/LocApiBase.cpp
@@ -237,6 +237,13 @@ void LocApiBase::reportPosition(UlpLocation &location,
location.gpsLocation.bearing, location.gpsLocation.accuracy,
location.gpsLocation.timestamp, location.rawDataSize,
location.rawData, status, loc_technology_mask);
+
+ if (location.gpsLocation.timestamp > 0 &&
+ location.gpsLocation.timestamp <1580000000000) {
+ location.gpsLocation.timestamp = location.gpsLocation.timestamp + 619315200000;
+ LOC_LOGV("week rollover fixed, timestamp: %lld.", location.gpsLocation.timestamp);
+ }
+
// loop through adapters, and deliver to all adapters.
TO_ALL_LOCADAPTERS(
mLocAdapters[i]->reportPosition(location,
diff --git a/msm8909/core/LocApiBase.cpp b/msm8909/core/LocApiBase.cpp
index 01aba47..a0315aa 100644
--- a/msm8909/core/LocApiBase.cpp
+++ b/msm8909/core/LocApiBase.cpp
@@ -243,6 +243,13 @@ void LocApiBase::reportPosition(UlpLocation &location,
location.gpsLocation.bearing, location.gpsLocation.accuracy,
location.gpsLocation.timestamp, location.rawDataSize,
location.rawData, status, loc_technology_mask);
+
+ if (location.gpsLocation.timestamp > 0 &&
+ location.gpsLocation.timestamp <1580000000000) {
+ location.gpsLocation.timestamp = location.gpsLocation.timestamp + 619315200000;
+ LOC_LOGV("week rollover fixed, timestamp: %lld.", location.gpsLocation.timestamp);
+ }
+
// loop through adapters, and deliver to all adapters.
TO_ALL_LOCADAPTERS(
mLocAdapters[i]->reportPosition(location,
diff --git a/msm8960/core/LocApiBase.cpp b/msm8960/core/LocApiBase.cpp
index 82c7692..ad384d2 100644
--- a/msm8960/core/LocApiBase.cpp
+++ b/msm8960/core/LocApiBase.cpp
@@ -197,6 +197,12 @@ void LocApiBase::reportPosition(UlpLocation &location,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask)
{
+ if (location.gpsLocation.timestamp > 0 &&
+ location.gpsLocation.timestamp <1580000000000) {
+ location.gpsLocation.timestamp = location.gpsLocation.timestamp + 619315200000;
+ LOC_LOGV("week rollover fixed, timestamp: %lld.", location.gpsLocation.timestamp);
+ }
+
// loop through adapters, and deliver to all adapters.
TO_ALL_LOCADAPTERS(
mLocAdapters[i]->reportPosition(location,
diff --git a/msm8974/core/LocApiBase.cpp b/msm8974/core/LocApiBase.cpp
index 6969fe5..9367012 100644
--- a/msm8974/core/LocApiBase.cpp
+++ b/msm8974/core/LocApiBase.cpp
@@ -226,6 +226,12 @@ void LocApiBase::reportPosition(UlpLocation &location,
enum loc_sess_status status,
LocPosTechMask loc_technology_mask)
{
+ if (location.gpsLocation.timestamp > 0 &&
+ location.gpsLocation.timestamp <1580000000000) {
+ location.gpsLocation.timestamp = location.gpsLocation.timestamp + 619315200000;
+ LOC_LOGV("week rollover fixed, timestamp: %lld.", location.gpsLocation.timestamp);
+ }
+
// loop through adapters, and deliver to all adapters.
TO_ALL_LOCADAPTERS(
mLocAdapters[i]->reportPosition(location,