summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2019-02-12 23:22:05 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-02-12 23:22:05 +0000
commitb40df137041625dec1b70d61403275ff028eec91 (patch)
tree2159d77510abbf62116ba014876e00c025291cdb
parent44426e214251f9ce09b5a9211e387be35d78ff77 (diff)
parent786a2bd7466743ab0c91262ddcc79a34888b3ee3 (diff)
Merge "Add GnssMeasurementState::STATE_2ND_CODE_LOCK to GnssMeasurement API"
-rw-r--r--api/current.txt1
-rw-r--r--location/java/android/location/GnssMeasurement.java397
-rw-r--r--services/core/jni/com_android_server_location_GnssLocationProvider.cpp5
3 files changed, 316 insertions, 87 deletions
diff --git a/api/current.txt b/api/current.txt
index 6f2751d58dbe..1afe1beaff63 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -22676,6 +22676,7 @@ package android.location {
field public static final int MULTIPATH_INDICATOR_DETECTED = 1; // 0x1
field public static final int MULTIPATH_INDICATOR_NOT_DETECTED = 2; // 0x2
field public static final int MULTIPATH_INDICATOR_UNKNOWN = 0; // 0x0
+ field public static final int STATE_2ND_CODE_LOCK = 65536; // 0x10000
field public static final int STATE_BDS_D2_BIT_SYNC = 256; // 0x100
field public static final int STATE_BDS_D2_SUBFRAME_SYNC = 512; // 0x200
field public static final int STATE_BIT_SYNC = 2; // 0x2
diff --git a/location/java/android/location/GnssMeasurement.java b/location/java/android/location/GnssMeasurement.java
index 59eff6401deb..a545f2edd1bf 100644
--- a/location/java/android/location/GnssMeasurement.java
+++ b/location/java/android/location/GnssMeasurement.java
@@ -96,7 +96,7 @@ public final class GnssMeasurement implements Parcelable {
STATE_TOW_DECODED, STATE_MSEC_AMBIGUOUS, STATE_SYMBOL_SYNC, STATE_GLO_STRING_SYNC,
STATE_GLO_TOD_DECODED, STATE_BDS_D2_BIT_SYNC, STATE_BDS_D2_SUBFRAME_SYNC,
STATE_GAL_E1BC_CODE_LOCK, STATE_GAL_E1C_2ND_CODE_LOCK, STATE_GAL_E1B_PAGE_SYNC,
- STATE_SBAS_SYNC, STATE_TOW_KNOWN, STATE_GLO_TOD_KNOWN
+ STATE_SBAS_SYNC, STATE_TOW_KNOWN, STATE_GLO_TOD_KNOWN, STATE_2ND_CODE_LOCK
})
@Retention(RetentionPolicy.SOURCE)
public @interface State {}
@@ -144,6 +144,9 @@ public final class GnssMeasurement implements Parcelable {
*/
public static final int STATE_GLO_TOD_KNOWN = (1<<15);
+ /** This GNSS measurement's tracking state has secondary code lock. */
+ public static final int STATE_2ND_CODE_LOCK = (1 << 16);
+
/**
* All the GNSS receiver state flags, for bit masking purposes (not a sensible state for any
* individual measurement.)
@@ -517,6 +520,9 @@ public final class GnssMeasurement implements Parcelable {
if ((mState & STATE_SBAS_SYNC) != 0) {
builder.append("SbasSync|");
}
+ if ((mState & STATE_2ND_CODE_LOCK) != 0) {
+ builder.append("2ndCodeLock|");
+ }
int remainingStates = mState & ~STATE_ALL;
if (remainingStates > 0) {
@@ -531,96 +537,315 @@ public final class GnssMeasurement implements Parcelable {
/**
* Gets the received GNSS satellite time, at the measurement time, in nanoseconds.
*
- * <p>For GPS &amp; QZSS, this is:
- * <ul>
- * <li>Received GPS Time-of-Week at the measurement time, in nanoseconds.</li>
- * <li>The value is relative to the beginning of the current GPS week.</li>
- * </ul>
- *
- * <p>Given the highest sync state that can be achieved, per each satellite, valid range
- * for this field can be:
- * <pre>
- * Searching : [ 0 ] : STATE_UNKNOWN
- * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK is set
- * Bit sync : [ 0 20ms ] : STATE_BIT_SYNC is set
- * Subframe sync : [ 0 6s ] : STATE_SUBFRAME_SYNC is set
- * TOW decoded : [ 0 1week ] : STATE_TOW_DECODED is set
- * TOW Known : [ 0 1week ] : STATE_TOW_KNOWN set</pre>
- *
- * Note: TOW Known refers to the case where TOW is possibly not decoded over the air but has
+ * <p>The received satellite time is relative to the beginning of the system week for all
+ * constellations except for Glonass where it is relative to the beginning of the Glonass
+ * system day.
+ *
+ * <p>The table below indicates the valid range of the received GNSS satellite time. These
+ * ranges depend on the constellation and code being tracked and the state of the tracking
+ * algorithms given by the {@link #getState} method. The minimum value of this field is zero.
+ * The maximum value of this field is determined by looking across all of the state flags
+ * that are set, for the given constellation and code type, and finding the the maximum value
+ * in this table.
+ *
+ * <p>For example, for GPS L1 C/A, if STATE_TOW_KNOWN is set, this field can be any value from 0
+ * to 1 week (in nanoseconds), and for GAL E1B code, if only STATE_GAL_E1BC_CODE_LOCK is set,
+ * then this field can be any value from 0 to 4 milliseconds (in nanoseconds.)
+ *
+ * <table border="1">
+ * <thead>
+ * <tr>
+ * <td />
+ * <td colspan="3"><strong>GPS/QZSS</strong></td>
+ * <td><strong>GLNS</strong></td>
+ * <td colspan="2"><strong>BDS</strong></td>
+ * <td colspan="3"><strong>GAL</strong></td>
+ * <td><strong>SBAS</strong></td>
+ * </tr>
+ * <tr>
+ * <td><strong>State Flag</strong></td>
+ * <td><strong>L1 C/A</strong></td>
+ * <td><strong>L5I</strong></td>
+ * <td><strong>L5Q</strong></td>
+ * <td><strong>L1OF</strong></td>
+ * <td><strong>B1I (D1)</strong></td>
+ * <td><strong>B1I &nbsp;(D2)</strong></td>
+ * <td><strong>E1B</strong></td>
+ * <td><strong>E1C</strong></td>
+ * <td><strong>E5AQ</strong></td>
+ * <td><strong>L1 C/A</strong></td>
+ * </tr>
+ * </thead>
+ * <tbody>
+ * <tr>
+ * <td>
+ * <strong>STATE_UNKNOWN</strong>
+ * </td>
+ * <td>0</td>
+ * <td>0</td>
+ * <td>0</td>
+ * <td>0</td>
+ * <td>0</td>
+ * <td>0</td>
+ * <td>0</td>
+ * <td>0</td>
+ * <td>0</td>
+ * <td>0</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_CODE_LOCK</strong>
+ * </td>
+ * <td>1 ms</td>
+ * <td>1 ms</td>
+ * <td>1 ms</td>
+ * <td>1 ms</td>
+ * <td>1 ms</td>
+ * <td>1 ms</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>1 ms</td>
+ * <td>1 ms</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_SYMBOL_SYNC</strong>
+ * </td>
+ * <td>20 ms (optional)</td>
+ * <td>10 ms</td>
+ * <td>1 ms (optional)</td>
+ * <td>10 ms</td>
+ * <td>20 ms (optional)</td>
+ * <td>2 ms</td>
+ * <td>4 ms (optional)</td>
+ * <td>4 ms (optional)</td>
+ * <td>1 ms (optional)</td>
+ * <td>2 ms</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_BIT_SYNC</strong>
+ * </td>
+ * <td>20 ms</td>
+ * <td>20 ms</td>
+ * <td>1 ms (optional)</td>
+ * <td>20 ms</td>
+ * <td>20 ms</td>
+ * <td>-</td>
+ * <td>8 ms</td>
+ * <td>-</td>
+ * <td>1 ms (optional)</td>
+ * <td>4 ms</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_SUBFRAME_SYNC</strong>
+ * </td>
+ * <td>6s</td>
+ * <td>6s</td>
+ * <td>-</td>
+ * <td>2 s</td>
+ * <td>6 s</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>100 ms</td>
+ * <td>-</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_TOW_DECODED</strong>
+ * </td>
+ * <td colspan="2">1 week</td>
+ * <td>-</td>
+ * <td>1 day</td>
+ * <td colspan="2">1 week</td>
+ * <td colspan="2">1 week</td>
+ * <td>-</td>
+ * <td>1 week</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_TOW_KNOWN</strong>
+ * </td>
+ * <td colspan="3">1 week</td>
+ * <td>1 day</td>
+ * <td colspan="2">1 week</td>
+ * <td colspan="3">1 week</td>
+ * <td>1 week</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_GLO_STRING_SYNC</strong>
+ * </td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>2 s</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_GLO_TOD_DECODED</strong>
+ * </td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>1 day</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_GLO_TOD_KNOWN</strong>
+ * </td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>1 day</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_BDS_D2_BIT_SYNC</strong>
+ * </td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>2 ms</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_BDS_D2_SUBFRAME_SYNC</strong>
+ * </td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>600 ms</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_GAL_E1BC_CODE_LOCK</strong>
+ * </td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>4 ms</td>
+ * <td>4 ms</td>
+ * <td>-</td>
+ * <td>-</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_GAL_E1C_2ND_CODE_LOCK</strong>
+ * </td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>100 ms</td>
+ * <td>-</td>
+ * <td>-</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_2ND_CODE_LOCK</strong>
+ * </td>
+ * <td>-</td>
+ * <td>10 ms (optional)</td>
+ * <td>20 ms</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>100 ms (optional)</td>
+ * <td>100 ms</td>
+ * <td>-</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_GAL_E1B_PAGE_SYNC</strong>
+ * </td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>2 s</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * </tr>
+ * <tr>
+ * <td>
+ * <strong>STATE_SBAS_SYNC</strong>
+ * </td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>-</td>
+ * <td>1 s</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ *
+ * <p>Note: TOW Known refers to the case where TOW is possibly not decoded over the air but has
* been determined from other sources. If TOW decoded is set then TOW Known must also be set.
*
- * <p>Note well: if there is any ambiguity in integer millisecond, {@code STATE_MSEC_AMBIGUOUS}
- * must be set accordingly, in the 'state' field.
- *
- * <p>This value must be populated if 'state' != {@code STATE_UNKNOWN}.
+ * <p>Note well: if there is any ambiguity in integer millisecond, STATE_MSEC_AMBIGUOUS must be
+ * set accordingly, in the 'state' field. This value must be populated, unless the 'state' ==
+ * STATE_UNKNOWN.
*
- * <p>For Glonass, this is:
+ * <p>Note on optional flags:
* <ul>
- * <li>Received Glonass time of day, at the measurement time in nanoseconds.</li>
+ * <li> For L1 C/A and B1I, STATE_SYMBOL_SYNC is optional since the symbol length is the
+ * same as the bit length.
+ * <li> For L5Q and E5aQ, STATE_BIT_SYNC and STATE_SYMBOL_SYNC are optional since they are
+ * implied by STATE_CODE_LOCK.
+ * <li> STATE_2ND_CODE_LOCK for L5I is optional since it is implied by STATE_SYMBOL_SYNC.
+ * <li> STATE_2ND_CODE_LOCK for E1C is optional since it is implied by
+ * STATE_GAL_E1C_2ND_CODE_LOCK.
+ * <li> For E1B and E1C, STATE_SYMBOL_SYNC is optional, because it is implied by
+ * STATE_GAL_E1BC_CODE_LOCK.
* </ul>
- *
- * <p>Given the highest sync state that can be achieved, per each satellite, valid range for
- * this field can be:
- * <pre>
- * Searching : [ 0 ] : STATE_UNKNOWN
- * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK is set
- * Symbol sync : [ 0 10ms ] : STATE_SYMBOL_SYNC is set
- * Bit sync : [ 0 20ms ] : STATE_BIT_SYNC is set
- * String sync : [ 0 2s ] : STATE_GLO_STRING_SYNC is set
- * Time of day decoded : [ 0 1day ] : STATE_GLO_TOD_DECODED is set
- * Time of day known : [ 0 1day ] : STATE_GLO_TOD_KNOWN set</pre>
- *
- * Note: Time of day known refers to the case where it is possibly not decoded over the air but
- * has been determined from other sources. If Time of day decoded is set then Time of day known
- * must also be set.
- *
- * <p>For Beidou, this is:
- * <ul>
- * <li>Received Beidou time of week, at the measurement time in nanoseconds.</li>
- * </ul>
- *
- * <p>Given the highest sync state that can be achieved, per each satellite, valid range for
- * this field can be:
- * <pre>
- * Searching : [ 0 ] : STATE_UNKNOWN
- * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK is set
- * Bit sync (D2) : [ 0 2ms ] : STATE_BDS_D2_BIT_SYNC is set
- * Bit sync (D1) : [ 0 20ms ] : STATE_BIT_SYNC is set
- * Subframe (D2) : [ 0 0.6s ] : STATE_BDS_D2_SUBFRAME_SYNC is set
- * Subframe (D1) : [ 0 6s ] : STATE_SUBFRAME_SYNC is set
- * Time of week decoded : [ 0 1week ] : STATE_TOW_DECODED is set
- * Time of week known : [ 0 1week ] : STATE_TOW_KNOWN set</pre>
- *
- * Note: TOW Known refers to the case where TOW is possibly not decoded over the air but has
- * been determined from other sources. If TOW decoded is set then TOW Known must also be set.
- *
- * <p>For Galileo, this is:
- * <ul>
- * <li>Received Galileo time of week, at the measurement time in nanoseconds.</li>
- * </ul>
- * <pre>
- * E1BC code lock : [ 0 4ms ] : STATE_GAL_E1BC_CODE_LOCK is set
- * E1C 2nd code lock : [ 0 100ms ] : STATE_GAL_E1C_2ND_CODE_LOCK is set
- * E1B page : [ 0 2s ] : STATE_GAL_E1B_PAGE_SYNC is set
- * Time of week decoded : [ 0 1week ] : STATE_TOW_DECODED is set
- * Time of week known : [ 0 1week ] : STATE_TOW_KNOWN set</pre>
- *
- * Note: TOW Known refers to the case where TOW is possibly not decoded over the air but has
- * been determined from other sources. If TOW decoded is set then TOW Known must also be set.
- *
- * <p>For SBAS, this is:
- * <ul>
- * <li>Received SBAS time, at the measurement time in nanoseconds.</li>
- * </ul>
- *
- * <p>Given the highest sync state that can be achieved, per each satellite, valid range for
- * this field can be:
- * <pre>
- * Searching : [ 0 ] : STATE_UNKNOWN
- * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK is set
- * Symbol sync : [ 0 2ms ] : STATE_SYMBOL_SYNC is set
- * Message : [ 0 1s ] : STATE_SBAS_SYNC is set</pre>
*/
public long getReceivedSvTimeNanos() {
return mReceivedSvTimeNanos;
diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
index cbc3791264bf..d178c3abc906 100644
--- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
+++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
@@ -973,7 +973,10 @@ void GnssMeasurementCallback::translateSingleGnssMeasurement
JavaObject& object) {
translateSingleGnssMeasurement(&(measurement_V2_0->v1_1), object);
- SET(CodeType, (static_cast<int32_t>(measurement_V2_0->codeType)));
+ SET(CodeType, static_cast<int32_t>(measurement_V2_0->codeType));
+
+ // Overwrite with v2_0.state since v2_0->v1_1->v1_0.state is deprecated.
+ SET(State, static_cast<int32_t>(measurement_V2_0->state));
}
jobject GnssMeasurementCallback::translateGnssClock(