diff --git a/api/current.txt b/api/current.txt index 0db96fabf30a2..d6f0955dbca9b 100644 --- a/api/current.txt +++ b/api/current.txt @@ -22620,6 +22620,7 @@ package android.location { method public int getCodeType(); method public int getConstellationType(); method public int getMultipathIndicator(); + method @NonNull public String getOtherCodeTypeName(); method public double getPseudorangeRateMetersPerSecond(); method public double getPseudorangeRateUncertaintyMetersPerSecond(); method public long getReceivedSvTimeNanos(); @@ -22645,10 +22646,11 @@ package android.location { field public static final int CODE_TYPE_A = 0; // 0x0 field public static final int CODE_TYPE_B = 1; // 0x1 field public static final int CODE_TYPE_C = 2; // 0x2 - field public static final int CODE_TYPE_CODELESS = 13; // 0xd field public static final int CODE_TYPE_I = 3; // 0x3 field public static final int CODE_TYPE_L = 4; // 0x4 field public static final int CODE_TYPE_M = 5; // 0x5 + field public static final int CODE_TYPE_N = 13; // 0xd + field public static final int CODE_TYPE_OTHER = 255; // 0xff field public static final int CODE_TYPE_P = 6; // 0x6 field public static final int CODE_TYPE_Q = 7; // 0x7 field public static final int CODE_TYPE_S = 8; // 0x8 diff --git a/api/test-current.txt b/api/test-current.txt index 1f351d566b849..2c8d08c49fdba 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -767,6 +767,7 @@ package android.location { method public void setCodeType(int); method public void setConstellationType(int); method public void setMultipathIndicator(int); + method public void setOtherCodeTypeName(@NonNull String); method public void setPseudorangeRateMetersPerSecond(double); method public void setPseudorangeRateUncertaintyMetersPerSecond(double); method public void setReceivedSvTimeNanos(long); diff --git a/location/java/android/location/GnssMeasurement.java b/location/java/android/location/GnssMeasurement.java index 602cc3e6d0fdb..59eff6401debb 100644 --- a/location/java/android/location/GnssMeasurement.java +++ b/location/java/android/location/GnssMeasurement.java @@ -17,6 +17,7 @@ package android.location; import android.annotation.IntDef; +import android.annotation.NonNull; import android.annotation.TestApi; import android.os.Parcel; import android.os.Parcelable; @@ -49,6 +50,7 @@ public final class GnssMeasurement implements Parcelable { private double mSnrInDb; private double mAutomaticGainControlLevelInDb; private int mCodeType; + private String mOtherCodeTypeName; // The following enumerations must be in sync with the values declared in gps.h @@ -209,8 +211,8 @@ public final class GnssMeasurement implements Parcelable { */ @IntDef(prefix = { "CODE_TYPE_" }, value = { CODE_TYPE_UNKNOWN, CODE_TYPE_A, CODE_TYPE_B, CODE_TYPE_C, CODE_TYPE_I, CODE_TYPE_L, - CODE_TYPE_M, CODE_TYPE_P, CODE_TYPE_Q, CODE_TYPE_S, CODE_TYPE_W, CODE_TYPE_X, - CODE_TYPE_Y, CODE_TYPE_Z, CODE_TYPE_CODELESS + CODE_TYPE_M, CODE_TYPE_N, CODE_TYPE_P, CODE_TYPE_Q, CODE_TYPE_S, CODE_TYPE_W, + CODE_TYPE_X, CODE_TYPE_Y, CODE_TYPE_Z, CODE_TYPE_OTHER }) @Retention(RetentionPolicy.SOURCE) public @interface CodeType {} @@ -299,7 +301,16 @@ public final class GnssMeasurement implements Parcelable { /** * The GNSS Measurement's code type is one of the following: GPS L1 codeless, GPS L2 codeless. */ - public static final int CODE_TYPE_CODELESS = 13; + public static final int CODE_TYPE_N = 13; + + /** + * Other code type that does not belong to any of the above code types. + * + * This code type is used in the case that the code type being tracked in this measurement, as + * classified by RINEX standards, does not fit into one of the existing enumerated values. When + * this code type is set, the field otherCodeTypeName must specify the new code type. + */ + public static final int CODE_TYPE_OTHER = 255; /** * All the 'Accumulated Delta Range' flags. @@ -349,6 +360,7 @@ public final class GnssMeasurement implements Parcelable { mSnrInDb = measurement.mSnrInDb; mAutomaticGainControlLevelInDb = measurement.mAutomaticGainControlLevelInDb; mCodeType = measurement.mCodeType; + mOtherCodeTypeName = measurement.mOtherCodeTypeName; } /** @@ -1175,8 +1187,8 @@ public final class GnssMeasurement implements Parcelable { /** * Gets the GNSS measurement's code type. * - *
Similar to the Attribute field described in Rinex 3.03, e.g., in Tables 4-10, and Table - * A2 at the Rinex 3.03 Update 1 Document. + *
Similar to the Attribute field described in RINEX 3.03, e.g., in Tables 4-10, and Table + * A2 at the RINEX 3.03 Update 1 Document. */ @CodeType public int getCodeType() { @@ -1205,6 +1217,29 @@ public final class GnssMeasurement implements Parcelable { mCodeType = CODE_TYPE_UNKNOWN; } + /** + * Gets the GNSS measurement's code type name when the code type is {@link #CODE_TYPE_OTHER}. + * + *
This is used to specify the observation descriptor defined in GNSS Observation Data File
+ * Header Section Description in the RINEX standard (Version 3.XX), in cases where the code type
+ * does not align with an existing Android enumerated value. For example, if a code type "G" is
+ * added, this string shall be set to "G".
+ */
+ @NonNull
+ public String getOtherCodeTypeName() {
+ return mOtherCodeTypeName;
+ }
+
+ /**
+ * Sets the GNSS measurement's code type name when the code type is {@link #CODE_TYPE_OTHER}.
+ *
+ * @hide
+ */
+ @TestApi
+ public void setOtherCodeTypeName(@NonNull String otherCodeTypeName) {
+ mOtherCodeTypeName = otherCodeTypeName;
+ }
+
/**
* Gets a string representation of the 'code type'.
*
@@ -1226,6 +1261,8 @@ public final class GnssMeasurement implements Parcelable {
return "CODE_TYPE_L";
case CODE_TYPE_M:
return "CODE_TYPE_M";
+ case CODE_TYPE_N:
+ return "CODE_TYPE_N";
case CODE_TYPE_P:
return "CODE_TYPE_P";
case CODE_TYPE_Q:
@@ -1240,8 +1277,8 @@ public final class GnssMeasurement implements Parcelable {
return "CODE_TYPE_Y";
case CODE_TYPE_Z:
return "CODE_TYPE_Z";
- case CODE_TYPE_CODELESS:
- return "CODE_TYPE_CODELESS";
+ case CODE_TYPE_OTHER:
+ return "CODE_TYPE_OTHER";
default:
return "