Merge "Fixed the sign error in GnssClock" into nyc-dev
am: da9f52a
* commit 'da9f52a795fc8af2250b22a167b88343af9fe917':
Fixed the sign error in GnssClock
Change-Id: I4a60184b0e5e706831ce2c0c742751ab43b03040
This commit is contained in:
@@ -97,7 +97,7 @@ public final class GnssClock implements Parcelable {
|
|||||||
*
|
*
|
||||||
* <p>The sign of the value is defined by the following equation:
|
* <p>The sign of the value is defined by the following equation:
|
||||||
* <pre>
|
* <pre>
|
||||||
* UtcTimeNanos = TimeNanos + (FullBiasNanos + BiasNanos) - LeapSecond * 1,000,000,000</pre>
|
* UtcTimeNanos = TimeNanos - (FullBiasNanos + BiasNanos) - LeapSecond * 1,000,000,000</pre>
|
||||||
*
|
*
|
||||||
* <p>The value is only available if {@link #hasLeapSecond()} is {@code true}.
|
* <p>The value is only available if {@link #hasLeapSecond()} is {@code true}.
|
||||||
*/
|
*/
|
||||||
@@ -130,9 +130,9 @@ public final class GnssClock implements Parcelable {
|
|||||||
*
|
*
|
||||||
* <p>This value is expected to be monotonically increasing while the hardware clock remains
|
* <p>This value is expected to be monotonically increasing while the hardware clock remains
|
||||||
* powered on. For the case of a hardware clock that is not continuously on, see the
|
* powered on. For the case of a hardware clock that is not continuously on, see the
|
||||||
* {@link #getHardwareClockDiscontinuityCount} field. The GPS time can be derived by adding
|
* {@link #getHardwareClockDiscontinuityCount} field. The GPS time can be derived by subtracting
|
||||||
* {@link #getFullBiasNanos()} and {@link #getBiasNanos()} (when they are available) to this
|
* the sum of {@link #getFullBiasNanos()} and {@link #getBiasNanos()} (when they are available)
|
||||||
* value. Sub-nanosecond accuracy can be provided by means of {@link #getBiasNanos()}.
|
* from this value. Sub-nanosecond accuracy can be provided by means of {@link #getBiasNanos()}.
|
||||||
*
|
*
|
||||||
* <p>The error estimate for this value (if applicable) is {@link #getTimeUncertaintyNanos()}.
|
* <p>The error estimate for this value (if applicable) is {@link #getTimeUncertaintyNanos()}.
|
||||||
*/
|
*/
|
||||||
@@ -213,7 +213,7 @@ public final class GnssClock implements Parcelable {
|
|||||||
* <p>The sign of the value is defined by the following equation:
|
* <p>The sign of the value is defined by the following equation:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* local estimate of GPS time = TimeNanos + (FullBiasNanos + BiasNanos)</pre>
|
* local estimate of GPS time = TimeNanos - (FullBiasNanos + BiasNanos)</pre>
|
||||||
*/
|
*/
|
||||||
public long getFullBiasNanos() {
|
public long getFullBiasNanos() {
|
||||||
return mFullBiasNanos;
|
return mFullBiasNanos;
|
||||||
|
|||||||
@@ -1112,7 +1112,7 @@ static jobject translate_gps_clock(JNIEnv* env, GpsClock* clock) {
|
|||||||
JavaObject object(env, "android/location/GnssClock");
|
JavaObject object(env, "android/location/GnssClock");
|
||||||
GpsClockFlags flags = clock->flags;
|
GpsClockFlags flags = clock->flags;
|
||||||
|
|
||||||
SET_IF(GNSS_CLOCK_HAS_LEAP_SECOND,
|
SET_IF(GPS_CLOCK_HAS_LEAP_SECOND,
|
||||||
LeapSecond,
|
LeapSecond,
|
||||||
static_cast<int32_t>(clock->leap_second));
|
static_cast<int32_t>(clock->leap_second));
|
||||||
|
|
||||||
@@ -1121,8 +1121,9 @@ static jobject translate_gps_clock(JNIEnv* env, GpsClock* clock) {
|
|||||||
// old GPS_CLOCK types (active only in a limited number of older devices),
|
// old GPS_CLOCK types (active only in a limited number of older devices),
|
||||||
// the GPS time information is handled as an always discontinuous HW clock,
|
// the GPS time information is handled as an always discontinuous HW clock,
|
||||||
// with the GPS time information put into the full_bias_ns instead - so that
|
// with the GPS time information put into the full_bias_ns instead - so that
|
||||||
// time_ns + full_bias_ns = local estimate of GPS time (as remains true, in
|
// time_ns - full_bias_ns = local estimate of GPS time. Additionally, the
|
||||||
// the new GnssClock struct.)
|
// sign of full_bias_ns and bias_ns has flipped between GpsClock &
|
||||||
|
// GnssClock, so that is also handled below.
|
||||||
switch (clock->type) {
|
switch (clock->type) {
|
||||||
case GPS_CLOCK_TYPE_UNKNOWN:
|
case GPS_CLOCK_TYPE_UNKNOWN:
|
||||||
// Clock type unsupported.
|
// Clock type unsupported.
|
||||||
@@ -1133,7 +1134,7 @@ static jobject translate_gps_clock(JNIEnv* env, GpsClock* clock) {
|
|||||||
break;
|
break;
|
||||||
case GPS_CLOCK_TYPE_GPS_TIME:
|
case GPS_CLOCK_TYPE_GPS_TIME:
|
||||||
// GPS time, need to convert.
|
// GPS time, need to convert.
|
||||||
flags |= GNSS_CLOCK_HAS_FULL_BIAS;
|
flags |= GPS_CLOCK_HAS_FULL_BIAS;
|
||||||
clock->full_bias_ns = clock->time_ns;
|
clock->full_bias_ns = clock->time_ns;
|
||||||
clock->time_ns = 0;
|
clock->time_ns = 0;
|
||||||
SET(HardwareClockDiscontinuityCount,
|
SET(HardwareClockDiscontinuityCount,
|
||||||
@@ -1142,16 +1143,20 @@ static jobject translate_gps_clock(JNIEnv* env, GpsClock* clock) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SET(TimeNanos, clock->time_ns);
|
SET(TimeNanos, clock->time_ns);
|
||||||
SET_IF(GNSS_CLOCK_HAS_TIME_UNCERTAINTY,
|
SET_IF(GPS_CLOCK_HAS_TIME_UNCERTAINTY,
|
||||||
TimeUncertaintyNanos,
|
TimeUncertaintyNanos,
|
||||||
clock->time_uncertainty_ns);
|
clock->time_uncertainty_ns);
|
||||||
SET_IF(GNSS_CLOCK_HAS_FULL_BIAS, FullBiasNanos, clock->full_bias_ns);
|
|
||||||
SET_IF(GNSS_CLOCK_HAS_BIAS, BiasNanos, clock->bias_ns);
|
// Definition of sign for full_bias_ns & bias_ns has been changed since N,
|
||||||
SET_IF(GNSS_CLOCK_HAS_BIAS_UNCERTAINTY,
|
// so flip signs here.
|
||||||
|
SET_IF(GPS_CLOCK_HAS_FULL_BIAS, FullBiasNanos, -(clock->full_bias_ns));
|
||||||
|
SET_IF(GPS_CLOCK_HAS_BIAS, BiasNanos, -(clock->bias_ns));
|
||||||
|
|
||||||
|
SET_IF(GPS_CLOCK_HAS_BIAS_UNCERTAINTY,
|
||||||
BiasUncertaintyNanos,
|
BiasUncertaintyNanos,
|
||||||
clock->bias_uncertainty_ns);
|
clock->bias_uncertainty_ns);
|
||||||
SET_IF(GNSS_CLOCK_HAS_DRIFT, DriftNanosPerSecond, clock->drift_nsps);
|
SET_IF(GPS_CLOCK_HAS_DRIFT, DriftNanosPerSecond, clock->drift_nsps);
|
||||||
SET_IF(GNSS_CLOCK_HAS_DRIFT_UNCERTAINTY,
|
SET_IF(GPS_CLOCK_HAS_DRIFT_UNCERTAINTY,
|
||||||
DriftUncertaintyNanosPerSecond,
|
DriftUncertaintyNanosPerSecond,
|
||||||
clock->drift_uncertainty_nsps);
|
clock->drift_uncertainty_nsps);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user