From 30eecd45d2b03a32fcf6806130518f9931c1c8cb Mon Sep 17 00:00:00 2001 From: Yu-Han Yang Date: Thu, 12 Oct 2023 16:06:40 +0000 Subject: Add NavIC L1 support in GnssNavigationMessage Bug: 302199306 Test: atest GnssNavigationMessageTest Change-Id: I306ddf27c77899f3b61bd2ca7a2e574366597092 --- .../android/location/GnssNavigationMessage.java | 41 ++++++++++++++++++---- location/java/android/location/flags/gnss.aconfig | 8 +++++ 2 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 location/java/android/location/flags/gnss.aconfig (limited to 'location/java') diff --git a/location/java/android/location/GnssNavigationMessage.java b/location/java/android/location/GnssNavigationMessage.java index 637f90536125..32e636f8658b 100644 --- a/location/java/android/location/GnssNavigationMessage.java +++ b/location/java/android/location/GnssNavigationMessage.java @@ -16,10 +16,12 @@ package android.location; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.NonNull; import android.annotation.TestApi; +import android.location.flags.Flags; import android.os.Parcel; import android.os.Parcelable; @@ -41,7 +43,7 @@ public final class GnssNavigationMessage implements Parcelable { @Retention(RetentionPolicy.SOURCE) @IntDef({TYPE_UNKNOWN, TYPE_GPS_L1CA, TYPE_GPS_L2CNAV, TYPE_GPS_L5CNAV, TYPE_GPS_CNAV2, TYPE_SBS, TYPE_GLO_L1CA, TYPE_QZS_L1CA, TYPE_BDS_D1, TYPE_BDS_D2, TYPE_BDS_CNAV1, - TYPE_BDS_CNAV2, TYPE_GAL_I, TYPE_GAL_F, TYPE_IRN_L5CA}) + TYPE_BDS_CNAV2, TYPE_GAL_I, TYPE_GAL_F, TYPE_IRN_L5CA, TYPE_IRN_L5, TYPE_IRN_L1}) public @interface GnssNavigationMessageType {} // The following enumerations must be in sync with the values declared in gps.h @@ -74,8 +76,18 @@ public final class GnssNavigationMessage implements Parcelable { public static final int TYPE_GAL_I = 0x0601; /** Galileo F/NAV message contained in the structure. */ public static final int TYPE_GAL_F = 0x0602; - /** IRNSS L5 C/A message contained in the structure. */ + /** + * NavIC L5 C/A message contained in the structure. + * @deprecated Use {@link #TYPE_IRN_L5} instead. + */ + @Deprecated public static final int TYPE_IRN_L5CA = 0x0701; + /** NavIC L5 message contained in the structure. */ + @FlaggedApi(Flags.FLAG_GNSS_API_NAVIC_L1) + public static final int TYPE_IRN_L5 = 0x0702; + /** NavIC L1 message contained in the structure. */ + @FlaggedApi(Flags.FLAG_GNSS_API_NAVIC_L1) + public static final int TYPE_IRN_L1 = 0x0703; /** * The status of the GNSS Navigation Message @@ -254,8 +266,15 @@ public final class GnssNavigationMessage implements Parcelable { case TYPE_GAL_F: return "Galileo F"; case TYPE_IRN_L5CA: - return "IRNSS L5 C/A"; + return "NavIC L5 C/A"; default: + if (Flags.gnssApiNavicL1()) { + if (mType == TYPE_IRN_L5) { + return "NavIC L5"; + } else if (mType == TYPE_IRN_L1) { + return "NavIC L1"; + } + } return ""; } } @@ -303,9 +322,12 @@ public final class GnssNavigationMessage implements Parcelable { * navigation message, in the range of 1-25 (Subframe 1, 2, 3 does not contain a 'frame id' and * this value can be set to -1.) *
  • For Beidou CNAV1 this refers to the page type number in the range of 1-63.
  • - *
  • For IRNSS L5 C/A subframe 3 and 4, this value corresponds to the Message Id of the + *
  • For NavIC L5 subframe 3 and 4, this value corresponds to the Message Id of the * navigation message, in the range of 1-63. (Subframe 1 and 2 does not contain a message type * id and this value can be set to -1.)
  • + *
  • For NavIC L1 subframe 3, this value corresponds to the Message Id of the navigation + * message, in the range of 1-63. (Subframe 1 and 2 does not contain a message type id and this + * value can be set to -1.)
  • * */ @IntRange(from = -1, to = 120) @@ -339,8 +361,10 @@ public final class GnssNavigationMessage implements Parcelable { * navigation message, in the range of 1-3. *
  • For Beidou CNAV2, the submessage id corresponds to the message type, in the range * 1-63.
  • - *
  • For IRNSS L5 C/A, the submessage id corresponds to the subframe number of the - * navigation message, in the range of 1-4.
  • + *
  • For NavIC L5, the submessage id corresponds to the subframe number of the navigation + * message, in the range of 1-4.
  • + *
  • For NavIC L1, the submessage id corresponds to the subframe number of the navigation + * message, in the range of 1-3.
  • * */ @IntRange(from = 1) @@ -363,7 +387,7 @@ public final class GnssNavigationMessage implements Parcelable { *

    The bytes (or words) specified using big endian format (MSB first). * *

    */ @NonNull diff --git a/location/java/android/location/flags/gnss.aconfig b/location/java/android/location/flags/gnss.aconfig new file mode 100644 index 000000000000..c471a2749617 --- /dev/null +++ b/location/java/android/location/flags/gnss.aconfig @@ -0,0 +1,8 @@ +package: "android.location.flags" + +flag { + name: "gnss_api_navic_l1" + namespace: "location" + description: "Flag for GNSS API for NavIC L1" + bug: "302199306" +} \ No newline at end of file -- cgit v1.2.3-59-g8ed1b