Addressed API review comments and updated JavaDoc
Bug: 27274532
Bug: 27948390
Change-Id: I0255d2511deab788dcab9815def9c1287a50b7f9
diff --git a/api/current.txt b/api/current.txt
index 18388b2..1c988dc 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -19214,7 +19214,7 @@
field public static final int ADR_STATE_VALID = 1; // 0x1
field public static final android.os.Parcelable.Creator<android.location.GnssMeasurement> CREATOR;
field public static final int MULTIPATH_INDICATOR_DETECTED = 1; // 0x1
- field public static final int MULTIPATH_INDICATOR_NOT_USED = 2; // 0x2
+ 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_BDS_D2_BIT_SYNC = 256; // 0x100
field public static final int STATE_BDS_D2_SUBFRAME_SYNC = 512; // 0x200
@@ -19234,21 +19234,20 @@
}
public final class GnssMeasurementsEvent implements android.os.Parcelable {
- ctor public GnssMeasurementsEvent(android.location.GnssClock, android.location.GnssMeasurement[]);
method public int describeContents();
method public android.location.GnssClock getClock();
method public java.util.Collection<android.location.GnssMeasurement> getMeasurements();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.location.GnssMeasurementsEvent> CREATOR;
- field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2
- field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
- field public static final int STATUS_READY = 1; // 0x1
}
public static abstract class GnssMeasurementsEvent.Callback {
ctor public GnssMeasurementsEvent.Callback();
method public void onGnssMeasurementsReceived(android.location.GnssMeasurementsEvent);
method public void onStatusChanged(int);
+ field public static final int STATUS_LOCATION_DISABLED = 2; // 0x2
+ field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
+ field public static final int STATUS_READY = 1; // 0x1
}
public final class GnssNavigationMessage implements android.os.Parcelable {
@@ -19276,36 +19275,24 @@
field public static final int TYPE_UNKNOWN = 0; // 0x0
}
- public final class GnssNavigationMessageEvent implements android.os.Parcelable {
- ctor public GnssNavigationMessageEvent(android.location.GnssNavigationMessage);
- method public int describeContents();
- method public android.location.GnssNavigationMessage getNavigationMessage();
- method public void writeToParcel(android.os.Parcel, int);
- field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessageEvent> CREATOR;
- field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2
+ public static abstract class GnssNavigationMessage.Callback {
+ ctor public GnssNavigationMessage.Callback();
+ method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessage);
+ method public void onStatusChanged(int);
+ field public static final int STATUS_LOCATION_DISABLED = 2; // 0x2
field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
field public static final int STATUS_READY = 1; // 0x1
}
- public static abstract class GnssNavigationMessageEvent.Callback {
- ctor public GnssNavigationMessageEvent.Callback();
- method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessageEvent);
- method public void onStatusChanged(int);
- }
-
- public abstract interface GnssNmeaListener {
- method public abstract void onNmeaReceived(long, java.lang.String);
- }
-
public final class GnssStatus {
method public float getAzimuthDegrees(int);
method public float getCn0DbHz(int);
method public int getConstellationType(int);
method public float getElevationDegrees(int);
- method public int getNumSatellites();
+ method public int getSatelliteCount();
method public int getSvid(int);
- method public boolean hasAlmanac(int);
- method public boolean hasEphemeris(int);
+ method public boolean hasAlmanacData(int);
+ method public boolean hasEphemerisData(int);
method public boolean usedInFix(int);
field public static final int CONSTELLATION_BEIDOU = 5; // 0x5
field public static final int CONSTELLATION_GALILEO = 6; // 0x6
@@ -19316,15 +19303,15 @@
field public static final int CONSTELLATION_UNKNOWN = 0; // 0x0
}
- public abstract class GnssStatusCallback {
- ctor public GnssStatusCallback();
+ public static abstract class GnssStatus.Callback {
+ ctor public GnssStatus.Callback();
method public void onFirstFix(int);
method public void onSatelliteStatusChanged(android.location.GnssStatus);
method public void onStarted();
method public void onStopped();
}
- public final class GpsSatellite {
+ public final deprecated class GpsSatellite {
method public float getAzimuth();
method public float getElevation();
method public int getPrn();
@@ -19334,7 +19321,7 @@
method public boolean usedInFix();
}
- public final class GpsStatus {
+ public final deprecated class GpsStatus {
method public int getMaxSatellites();
method public java.lang.Iterable<android.location.GpsSatellite> getSatellites();
method public int getTimeToFirstFix();
@@ -19344,11 +19331,11 @@
field public static final int GPS_EVENT_STOPPED = 2; // 0x2
}
- public static abstract interface GpsStatus.Listener {
+ public static abstract deprecated interface GpsStatus.Listener {
method public abstract void onGpsStatusChanged(int);
}
- public static abstract interface GpsStatus.NmeaListener {
+ public static abstract deprecated interface GpsStatus.NmeaListener {
method public abstract void onNmeaReceived(long, java.lang.String);
}
@@ -19410,8 +19397,8 @@
public class LocationManager {
method public deprecated boolean addGpsStatusListener(android.location.GpsStatus.Listener);
method public deprecated boolean addNmeaListener(android.location.GpsStatus.NmeaListener);
- method public boolean addNmeaListener(android.location.GnssNmeaListener);
- method public boolean addNmeaListener(android.location.GnssNmeaListener, android.os.Handler);
+ method public boolean addNmeaListener(android.location.OnNmeaMessageListener);
+ method public boolean addNmeaListener(android.location.OnNmeaMessageListener, android.os.Handler);
method public void addProximityAlert(double, double, float, long, android.app.PendingIntent);
method public void addTestProvider(java.lang.String, boolean, boolean, boolean, boolean, boolean, boolean, boolean, int, int);
method public void clearTestProviderEnabled(java.lang.String);
@@ -19427,13 +19414,13 @@
method public boolean isProviderEnabled(java.lang.String);
method public boolean registerGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback);
method public boolean registerGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback, android.os.Handler);
- method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
- method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback, android.os.Handler);
- method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback);
- method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback, android.os.Handler);
+ method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback);
+ method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback, android.os.Handler);
+ method public boolean registerGnssStatusCallback(android.location.GnssStatus.Callback);
+ method public boolean registerGnssStatusCallback(android.location.GnssStatus.Callback, android.os.Handler);
method public deprecated void removeGpsStatusListener(android.location.GpsStatus.Listener);
method public deprecated void removeNmeaListener(android.location.GpsStatus.NmeaListener);
- method public void removeNmeaListener(android.location.GnssNmeaListener);
+ method public void removeNmeaListener(android.location.OnNmeaMessageListener);
method public void removeProximityAlert(android.app.PendingIntent);
method public void removeTestProvider(java.lang.String);
method public void removeUpdates(android.location.LocationListener);
@@ -19452,8 +19439,8 @@
method public void setTestProviderLocation(java.lang.String, android.location.Location);
method public void setTestProviderStatus(java.lang.String, int, android.os.Bundle, long);
method public void unregisterGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback);
- method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
- method public void unregisterGnssStatusCallback(android.location.GnssStatusCallback);
+ method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback);
+ method public void unregisterGnssStatusCallback(android.location.GnssStatus.Callback);
field public static final java.lang.String GPS_PROVIDER = "gps";
field public static final java.lang.String KEY_LOCATION_CHANGED = "location";
field public static final java.lang.String KEY_PROVIDER_ENABLED = "providerEnabled";
@@ -19482,6 +19469,10 @@
field public static final int TEMPORARILY_UNAVAILABLE = 1; // 0x1
}
+ public abstract interface OnNmeaMessageListener {
+ method public abstract void onNmeaMessage(java.lang.String, long);
+ }
+
public abstract class SettingInjectorService extends android.app.Service {
ctor public SettingInjectorService(java.lang.String);
method public final android.os.IBinder onBind(android.content.Intent);
diff --git a/api/removed.txt b/api/removed.txt
index 3f16bca..8c6abdc 100644
--- a/api/removed.txt
+++ b/api/removed.txt
@@ -84,6 +84,67 @@
}
+package android.location {
+
+ public final class GnssMeasurement implements android.os.Parcelable {
+ field public static final int MULTIPATH_INDICATOR_NOT_USED = 2; // 0x2
+ }
+
+ public final class GnssMeasurementsEvent implements android.os.Parcelable {
+ field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2
+ field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
+ field public static final int STATUS_READY = 1; // 0x1
+ }
+
+ public final class GnssNavigationMessageEvent implements android.os.Parcelable {
+ ctor public GnssNavigationMessageEvent(android.location.GnssNavigationMessage);
+ method public int describeContents();
+ method public android.location.GnssNavigationMessage getNavigationMessage();
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessageEvent> CREATOR;
+ field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2
+ field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
+ field public static final int STATUS_READY = 1; // 0x1
+ }
+
+ public static abstract class GnssNavigationMessageEvent.Callback {
+ ctor public GnssNavigationMessageEvent.Callback();
+ method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessageEvent);
+ method public void onStatusChanged(int);
+ }
+
+ public abstract interface GnssNmeaListener {
+ method public abstract void onNmeaReceived(long, java.lang.String);
+ }
+
+ public final class GnssStatus {
+ method public int getNumSatellites();
+ method public boolean hasAlmanac(int);
+ method public boolean hasEphemeris(int);
+ }
+
+ public abstract class GnssStatusCallback {
+ ctor public GnssStatusCallback();
+ method public void onFirstFix(int);
+ method public void onSatelliteStatusChanged(android.location.GnssStatus);
+ method public void onStarted();
+ method public void onStopped();
+ }
+
+ public class LocationManager {
+ method public boolean addNmeaListener(android.location.GnssNmeaListener);
+ method public boolean addNmeaListener(android.location.GnssNmeaListener, android.os.Handler);
+ method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
+ method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback, android.os.Handler);
+ method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback);
+ method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback, android.os.Handler);
+ method public void removeNmeaListener(android.location.GnssNmeaListener);
+ method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
+ method public void unregisterGnssStatusCallback(android.location.GnssStatusCallback);
+ }
+
+}
+
package android.media {
public final class AudioFormat implements android.os.Parcelable {
diff --git a/api/system-current.txt b/api/system-current.txt
index 051ed04..c4b074b 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -20374,7 +20374,7 @@
field public static final int ADR_STATE_VALID = 1; // 0x1
field public static final android.os.Parcelable.Creator<android.location.GnssMeasurement> CREATOR;
field public static final int MULTIPATH_INDICATOR_DETECTED = 1; // 0x1
- field public static final int MULTIPATH_INDICATOR_NOT_USED = 2; // 0x2
+ 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_BDS_D2_BIT_SYNC = 256; // 0x100
field public static final int STATE_BDS_D2_SUBFRAME_SYNC = 512; // 0x200
@@ -20394,21 +20394,20 @@
}
public final class GnssMeasurementsEvent implements android.os.Parcelable {
- ctor public GnssMeasurementsEvent(android.location.GnssClock, android.location.GnssMeasurement[]);
method public int describeContents();
method public android.location.GnssClock getClock();
method public java.util.Collection<android.location.GnssMeasurement> getMeasurements();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.location.GnssMeasurementsEvent> CREATOR;
- field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2
- field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
- field public static final int STATUS_READY = 1; // 0x1
}
public static abstract class GnssMeasurementsEvent.Callback {
ctor public GnssMeasurementsEvent.Callback();
method public void onGnssMeasurementsReceived(android.location.GnssMeasurementsEvent);
method public void onStatusChanged(int);
+ field public static final int STATUS_LOCATION_DISABLED = 2; // 0x2
+ field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
+ field public static final int STATUS_READY = 1; // 0x1
}
public final class GnssNavigationMessage implements android.os.Parcelable {
@@ -20436,36 +20435,24 @@
field public static final int TYPE_UNKNOWN = 0; // 0x0
}
- public final class GnssNavigationMessageEvent implements android.os.Parcelable {
- ctor public GnssNavigationMessageEvent(android.location.GnssNavigationMessage);
- method public int describeContents();
- method public android.location.GnssNavigationMessage getNavigationMessage();
- method public void writeToParcel(android.os.Parcel, int);
- field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessageEvent> CREATOR;
- field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2
+ public static abstract class GnssNavigationMessage.Callback {
+ ctor public GnssNavigationMessage.Callback();
+ method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessage);
+ method public void onStatusChanged(int);
+ field public static final int STATUS_LOCATION_DISABLED = 2; // 0x2
field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
field public static final int STATUS_READY = 1; // 0x1
}
- public static abstract class GnssNavigationMessageEvent.Callback {
- ctor public GnssNavigationMessageEvent.Callback();
- method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessageEvent);
- method public void onStatusChanged(int);
- }
-
- public abstract interface GnssNmeaListener {
- method public abstract void onNmeaReceived(long, java.lang.String);
- }
-
public final class GnssStatus {
method public float getAzimuthDegrees(int);
method public float getCn0DbHz(int);
method public int getConstellationType(int);
method public float getElevationDegrees(int);
- method public int getNumSatellites();
+ method public int getSatelliteCount();
method public int getSvid(int);
- method public boolean hasAlmanac(int);
- method public boolean hasEphemeris(int);
+ method public boolean hasAlmanacData(int);
+ method public boolean hasEphemerisData(int);
method public boolean usedInFix(int);
field public static final int CONSTELLATION_BEIDOU = 5; // 0x5
field public static final int CONSTELLATION_GALILEO = 6; // 0x6
@@ -20476,8 +20463,8 @@
field public static final int CONSTELLATION_UNKNOWN = 0; // 0x0
}
- public abstract class GnssStatusCallback {
- ctor public GnssStatusCallback();
+ public static abstract class GnssStatus.Callback {
+ ctor public GnssStatus.Callback();
method public void onFirstFix(int);
method public void onSatelliteStatusChanged(android.location.GnssStatus);
method public void onStarted();
@@ -20709,7 +20696,7 @@
method public abstract void onStatusChanged(int);
}
- public final class GpsSatellite {
+ public final deprecated class GpsSatellite {
method public float getAzimuth();
method public float getElevation();
method public int getPrn();
@@ -20719,7 +20706,7 @@
method public boolean usedInFix();
}
- public final class GpsStatus {
+ public final deprecated class GpsStatus {
method public int getMaxSatellites();
method public java.lang.Iterable<android.location.GpsSatellite> getSatellites();
method public int getTimeToFirstFix();
@@ -20729,11 +20716,11 @@
field public static final int GPS_EVENT_STOPPED = 2; // 0x2
}
- public static abstract interface GpsStatus.Listener {
+ public static abstract deprecated interface GpsStatus.Listener {
method public abstract void onGpsStatusChanged(int);
}
- public static abstract interface GpsStatus.NmeaListener {
+ public static abstract deprecated interface GpsStatus.NmeaListener {
method public abstract void onNmeaReceived(long, java.lang.String);
}
@@ -20817,8 +20804,8 @@
method public deprecated boolean addGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
method public deprecated boolean addGpsStatusListener(android.location.GpsStatus.Listener);
method public deprecated boolean addNmeaListener(android.location.GpsStatus.NmeaListener);
- method public boolean addNmeaListener(android.location.GnssNmeaListener);
- method public boolean addNmeaListener(android.location.GnssNmeaListener, android.os.Handler);
+ method public boolean addNmeaListener(android.location.OnNmeaMessageListener);
+ method public boolean addNmeaListener(android.location.OnNmeaMessageListener, android.os.Handler);
method public void addProximityAlert(double, double, float, long, android.app.PendingIntent);
method public void addTestProvider(java.lang.String, boolean, boolean, boolean, boolean, boolean, boolean, boolean, int, int);
method public void clearTestProviderEnabled(java.lang.String);
@@ -20834,15 +20821,15 @@
method public boolean isProviderEnabled(java.lang.String);
method public boolean registerGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback);
method public boolean registerGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback, android.os.Handler);
- method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
- method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback, android.os.Handler);
- method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback);
- method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback, android.os.Handler);
+ method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback);
+ method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback, android.os.Handler);
+ method public boolean registerGnssStatusCallback(android.location.GnssStatus.Callback);
+ method public boolean registerGnssStatusCallback(android.location.GnssStatus.Callback, android.os.Handler);
method public deprecated void removeGpsMeasurementListener(android.location.GpsMeasurementsEvent.Listener);
method public deprecated void removeGpsNavigationMessageListener(android.location.GpsNavigationMessageEvent.Listener);
method public deprecated void removeGpsStatusListener(android.location.GpsStatus.Listener);
method public deprecated void removeNmeaListener(android.location.GpsStatus.NmeaListener);
- method public void removeNmeaListener(android.location.GnssNmeaListener);
+ method public void removeNmeaListener(android.location.OnNmeaMessageListener);
method public void removeProximityAlert(android.app.PendingIntent);
method public void removeTestProvider(java.lang.String);
method public void removeUpdates(android.location.LocationListener);
@@ -20863,8 +20850,8 @@
method public void setTestProviderLocation(java.lang.String, android.location.Location);
method public void setTestProviderStatus(java.lang.String, int, android.os.Bundle, long);
method public void unregisterGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback);
- method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
- method public void unregisterGnssStatusCallback(android.location.GnssStatusCallback);
+ method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback);
+ method public void unregisterGnssStatusCallback(android.location.GnssStatus.Callback);
field public static final java.lang.String GPS_PROVIDER = "gps";
field public static final java.lang.String KEY_LOCATION_CHANGED = "location";
field public static final java.lang.String KEY_PROVIDER_ENABLED = "providerEnabled";
@@ -20927,6 +20914,10 @@
field public static final int POWER_NONE = 200; // 0xc8
}
+ public abstract interface OnNmeaMessageListener {
+ method public abstract void onNmeaMessage(java.lang.String, long);
+ }
+
public abstract class SettingInjectorService extends android.app.Service {
ctor public SettingInjectorService(java.lang.String);
method public final android.os.IBinder onBind(android.content.Intent);
diff --git a/api/system-removed.txt b/api/system-removed.txt
index 03cf8b0..95734c1 100644
--- a/api/system-removed.txt
+++ b/api/system-removed.txt
@@ -82,6 +82,67 @@
}
+package android.location {
+
+ public final class GnssMeasurement implements android.os.Parcelable {
+ field public static final int MULTIPATH_INDICATOR_NOT_USED = 2; // 0x2
+ }
+
+ public final class GnssMeasurementsEvent implements android.os.Parcelable {
+ field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2
+ field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
+ field public static final int STATUS_READY = 1; // 0x1
+ }
+
+ public final class GnssNavigationMessageEvent implements android.os.Parcelable {
+ ctor public GnssNavigationMessageEvent(android.location.GnssNavigationMessage);
+ method public int describeContents();
+ method public android.location.GnssNavigationMessage getNavigationMessage();
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessageEvent> CREATOR;
+ field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2
+ field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
+ field public static final int STATUS_READY = 1; // 0x1
+ }
+
+ public static abstract class GnssNavigationMessageEvent.Callback {
+ ctor public GnssNavigationMessageEvent.Callback();
+ method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessageEvent);
+ method public void onStatusChanged(int);
+ }
+
+ public abstract interface GnssNmeaListener {
+ method public abstract void onNmeaReceived(long, java.lang.String);
+ }
+
+ public final class GnssStatus {
+ method public int getNumSatellites();
+ method public boolean hasAlmanac(int);
+ method public boolean hasEphemeris(int);
+ }
+
+ public abstract class GnssStatusCallback {
+ ctor public GnssStatusCallback();
+ method public void onFirstFix(int);
+ method public void onSatelliteStatusChanged(android.location.GnssStatus);
+ method public void onStarted();
+ method public void onStopped();
+ }
+
+ public class LocationManager {
+ method public boolean addNmeaListener(android.location.GnssNmeaListener);
+ method public boolean addNmeaListener(android.location.GnssNmeaListener, android.os.Handler);
+ method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
+ method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback, android.os.Handler);
+ method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback);
+ method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback, android.os.Handler);
+ method public void removeNmeaListener(android.location.GnssNmeaListener);
+ method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
+ method public void unregisterGnssStatusCallback(android.location.GnssStatusCallback);
+ }
+
+}
+
package android.media {
public final class AudioFormat implements android.os.Parcelable {
diff --git a/api/test-current.txt b/api/test-current.txt
index fe7b4d3..fed977a 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -19269,7 +19269,7 @@
field public static final int ADR_STATE_VALID = 1; // 0x1
field public static final android.os.Parcelable.Creator<android.location.GnssMeasurement> CREATOR;
field public static final int MULTIPATH_INDICATOR_DETECTED = 1; // 0x1
- field public static final int MULTIPATH_INDICATOR_NOT_USED = 2; // 0x2
+ 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_BDS_D2_BIT_SYNC = 256; // 0x100
field public static final int STATE_BDS_D2_SUBFRAME_SYNC = 512; // 0x200
@@ -19295,15 +19295,15 @@
method public java.util.Collection<android.location.GnssMeasurement> getMeasurements();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.location.GnssMeasurementsEvent> CREATOR;
- field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2
- field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
- field public static final int STATUS_READY = 1; // 0x1
}
public static abstract class GnssMeasurementsEvent.Callback {
ctor public GnssMeasurementsEvent.Callback();
method public void onGnssMeasurementsReceived(android.location.GnssMeasurementsEvent);
method public void onStatusChanged(int);
+ field public static final int STATUS_LOCATION_DISABLED = 2; // 0x2
+ field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
+ field public static final int STATUS_READY = 1; // 0x1
}
public final class GnssNavigationMessage implements android.os.Parcelable {
@@ -19340,36 +19340,24 @@
field public static final int TYPE_UNKNOWN = 0; // 0x0
}
- public final class GnssNavigationMessageEvent implements android.os.Parcelable {
- ctor public GnssNavigationMessageEvent(android.location.GnssNavigationMessage);
- method public int describeContents();
- method public android.location.GnssNavigationMessage getNavigationMessage();
- method public void writeToParcel(android.os.Parcel, int);
- field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessageEvent> CREATOR;
- field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2
+ public static abstract class GnssNavigationMessage.Callback {
+ ctor public GnssNavigationMessage.Callback();
+ method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessage);
+ method public void onStatusChanged(int);
+ field public static final int STATUS_LOCATION_DISABLED = 2; // 0x2
field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
field public static final int STATUS_READY = 1; // 0x1
}
- public static abstract class GnssNavigationMessageEvent.Callback {
- ctor public GnssNavigationMessageEvent.Callback();
- method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessageEvent);
- method public void onStatusChanged(int);
- }
-
- public abstract interface GnssNmeaListener {
- method public abstract void onNmeaReceived(long, java.lang.String);
- }
-
public final class GnssStatus {
method public float getAzimuthDegrees(int);
method public float getCn0DbHz(int);
method public int getConstellationType(int);
method public float getElevationDegrees(int);
- method public int getNumSatellites();
+ method public int getSatelliteCount();
method public int getSvid(int);
- method public boolean hasAlmanac(int);
- method public boolean hasEphemeris(int);
+ method public boolean hasAlmanacData(int);
+ method public boolean hasEphemerisData(int);
method public boolean usedInFix(int);
field public static final int CONSTELLATION_BEIDOU = 5; // 0x5
field public static final int CONSTELLATION_GALILEO = 6; // 0x6
@@ -19380,15 +19368,15 @@
field public static final int CONSTELLATION_UNKNOWN = 0; // 0x0
}
- public abstract class GnssStatusCallback {
- ctor public GnssStatusCallback();
+ public static abstract class GnssStatus.Callback {
+ ctor public GnssStatus.Callback();
method public void onFirstFix(int);
method public void onSatelliteStatusChanged(android.location.GnssStatus);
method public void onStarted();
method public void onStopped();
}
- public final class GpsSatellite {
+ public final deprecated class GpsSatellite {
method public float getAzimuth();
method public float getElevation();
method public int getPrn();
@@ -19398,7 +19386,7 @@
method public boolean usedInFix();
}
- public final class GpsStatus {
+ public final deprecated class GpsStatus {
method public int getMaxSatellites();
method public java.lang.Iterable<android.location.GpsSatellite> getSatellites();
method public int getTimeToFirstFix();
@@ -19408,11 +19396,11 @@
field public static final int GPS_EVENT_STOPPED = 2; // 0x2
}
- public static abstract interface GpsStatus.Listener {
+ public static abstract deprecated interface GpsStatus.Listener {
method public abstract void onGpsStatusChanged(int);
}
- public static abstract interface GpsStatus.NmeaListener {
+ public static abstract deprecated interface GpsStatus.NmeaListener {
method public abstract void onNmeaReceived(long, java.lang.String);
}
@@ -19474,8 +19462,8 @@
public class LocationManager {
method public deprecated boolean addGpsStatusListener(android.location.GpsStatus.Listener);
method public deprecated boolean addNmeaListener(android.location.GpsStatus.NmeaListener);
- method public boolean addNmeaListener(android.location.GnssNmeaListener);
- method public boolean addNmeaListener(android.location.GnssNmeaListener, android.os.Handler);
+ method public boolean addNmeaListener(android.location.OnNmeaMessageListener);
+ method public boolean addNmeaListener(android.location.OnNmeaMessageListener, android.os.Handler);
method public void addProximityAlert(double, double, float, long, android.app.PendingIntent);
method public void addTestProvider(java.lang.String, boolean, boolean, boolean, boolean, boolean, boolean, boolean, int, int);
method public void clearTestProviderEnabled(java.lang.String);
@@ -19492,13 +19480,13 @@
method public boolean isProviderEnabled(java.lang.String);
method public boolean registerGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback);
method public boolean registerGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback, android.os.Handler);
- method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
- method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback, android.os.Handler);
- method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback);
- method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback, android.os.Handler);
+ method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback);
+ method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback, android.os.Handler);
+ method public boolean registerGnssStatusCallback(android.location.GnssStatus.Callback);
+ method public boolean registerGnssStatusCallback(android.location.GnssStatus.Callback, android.os.Handler);
method public deprecated void removeGpsStatusListener(android.location.GpsStatus.Listener);
method public deprecated void removeNmeaListener(android.location.GpsStatus.NmeaListener);
- method public void removeNmeaListener(android.location.GnssNmeaListener);
+ method public void removeNmeaListener(android.location.OnNmeaMessageListener);
method public void removeProximityAlert(android.app.PendingIntent);
method public void removeTestProvider(java.lang.String);
method public void removeUpdates(android.location.LocationListener);
@@ -19517,8 +19505,8 @@
method public void setTestProviderLocation(java.lang.String, android.location.Location);
method public void setTestProviderStatus(java.lang.String, int, android.os.Bundle, long);
method public void unregisterGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback);
- method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
- method public void unregisterGnssStatusCallback(android.location.GnssStatusCallback);
+ method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback);
+ method public void unregisterGnssStatusCallback(android.location.GnssStatus.Callback);
field public static final java.lang.String GPS_PROVIDER = "gps";
field public static final java.lang.String KEY_LOCATION_CHANGED = "location";
field public static final java.lang.String KEY_PROVIDER_ENABLED = "providerEnabled";
@@ -19547,6 +19535,10 @@
field public static final int TEMPORARILY_UNAVAILABLE = 1; // 0x1
}
+ public abstract interface OnNmeaMessageListener {
+ method public abstract void onNmeaMessage(java.lang.String, long);
+ }
+
public abstract class SettingInjectorService extends android.app.Service {
ctor public SettingInjectorService(java.lang.String);
method public final android.os.IBinder onBind(android.content.Intent);
diff --git a/api/test-removed.txt b/api/test-removed.txt
index 3f16bca..8c6abdc 100644
--- a/api/test-removed.txt
+++ b/api/test-removed.txt
@@ -84,6 +84,67 @@
}
+package android.location {
+
+ public final class GnssMeasurement implements android.os.Parcelable {
+ field public static final int MULTIPATH_INDICATOR_NOT_USED = 2; // 0x2
+ }
+
+ public final class GnssMeasurementsEvent implements android.os.Parcelable {
+ field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2
+ field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
+ field public static final int STATUS_READY = 1; // 0x1
+ }
+
+ public final class GnssNavigationMessageEvent implements android.os.Parcelable {
+ ctor public GnssNavigationMessageEvent(android.location.GnssNavigationMessage);
+ method public int describeContents();
+ method public android.location.GnssNavigationMessage getNavigationMessage();
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessageEvent> CREATOR;
+ field public static final int STATUS_GNSS_LOCATION_DISABLED = 2; // 0x2
+ field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
+ field public static final int STATUS_READY = 1; // 0x1
+ }
+
+ public static abstract class GnssNavigationMessageEvent.Callback {
+ ctor public GnssNavigationMessageEvent.Callback();
+ method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessageEvent);
+ method public void onStatusChanged(int);
+ }
+
+ public abstract interface GnssNmeaListener {
+ method public abstract void onNmeaReceived(long, java.lang.String);
+ }
+
+ public final class GnssStatus {
+ method public int getNumSatellites();
+ method public boolean hasAlmanac(int);
+ method public boolean hasEphemeris(int);
+ }
+
+ public abstract class GnssStatusCallback {
+ ctor public GnssStatusCallback();
+ method public void onFirstFix(int);
+ method public void onSatelliteStatusChanged(android.location.GnssStatus);
+ method public void onStarted();
+ method public void onStopped();
+ }
+
+ public class LocationManager {
+ method public boolean addNmeaListener(android.location.GnssNmeaListener);
+ method public boolean addNmeaListener(android.location.GnssNmeaListener, android.os.Handler);
+ method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
+ method public boolean registerGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback, android.os.Handler);
+ method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback);
+ method public boolean registerGnssStatusCallback(android.location.GnssStatusCallback, android.os.Handler);
+ method public void removeNmeaListener(android.location.GnssNmeaListener);
+ method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
+ method public void unregisterGnssStatusCallback(android.location.GnssStatusCallback);
+ }
+
+}
+
package android.media {
public final class AudioFormat implements android.os.Parcelable {
diff --git a/location/java/android/location/GnssClock.java b/location/java/android/location/GnssClock.java
index df42a73..d1b1be9 100644
--- a/location/java/android/location/GnssClock.java
+++ b/location/java/android/location/GnssClock.java
@@ -22,7 +22,8 @@
/**
* A class containing a GPS clock timestamp.
- * It represents a measurement of the GPS receiver's clock.
+ *
+ * <p>It represents a measurement of the GPS receiver's clock.
*/
public final class GnssClock implements Parcelable {
// The following enumerations must be in sync with the values declared in gps.h
@@ -85,7 +86,7 @@
}
/**
- * Returns true if {@link #getLeapSecond()} is available, false otherwise.
+ * Returns {@code true} if {@link #getLeapSecond()} is available, {@code false} otherwise.
*/
public boolean hasLeapSecond() {
return isFlagSet(HAS_LEAP_SECOND);
@@ -93,10 +94,12 @@
/**
* Gets the leap second associated with the clock's time.
- * The sign of the value is defined by the following equation:
- * utc_time_ns = time_ns + (full_bias_ns + bias_ns) - leap_second * 1,000,000,000
*
- * The value is only available if {@link #hasLeapSecond()} is true.
+ * <p>The sign of the value is defined by the following equation:
+ * <pre>
+ * UtcTimeNanos = TimeNanos + (FullBiasNanos + BiasNanos) - LeapSecond * 1,000,000,000</pre>
+ *
+ * <p>The value is only available if {@link #hasLeapSecond()} is {@code true}.
*/
public int getLeapSecond() {
return mLeapSecond;
@@ -123,18 +126,15 @@
}
/**
- * Gets the GNSS receiver internal clock value in nanoseconds.
+ * Gets the GNSS receiver internal hardware clock value in nanoseconds.
*
- * For 'local hardware clock' this value is expected to be monotonically increasing during the
- * reporting session. The real GPS time can be derived by compensating
- * {@link #getFullBiasNanos()} (when it is available) from this value.
+ * <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
+ * {@link #getHardwareClockDiscontinuityCount} field. The GPS time can be derived by adding
+ * {@link #getFullBiasNanos()} and {@link #getBiasNanos()} (when they are available) to this
+ * value. Sub-nanosecond accuracy can be provided by means of {@link #getBiasNanos()}.
*
- * For 'GPS time' this value is expected to be the best estimation of current GPS time that GPS
- * receiver can achieve. {@link #getTimeUncertaintyNanos()} should be available when GPS time is
- * specified.
- *
- * Sub-nanosecond accuracy can be provided by means of {@link #getBiasNanos()}.
- * The reported time includes {@link #getTimeUncertaintyNanos()}.
+ * <p>The error estimate for this value (if applicable) is {@link #getTimeUncertaintyNanos()}.
*/
public long getTimeNanos() {
return mTimeNanos;
@@ -150,7 +150,8 @@
}
/**
- * Returns true if {@link #getTimeUncertaintyNanos()} is available, false otherwise.
+ * Returns {@code true} if {@link #getTimeUncertaintyNanos()} is available, {@code false}
+ * otherwise.
*/
public boolean hasTimeUncertaintyNanos() {
return isFlagSet(HAS_TIME_UNCERTAINTY);
@@ -158,9 +159,13 @@
/**
* Gets the clock's time Uncertainty (1-Sigma) in nanoseconds.
- * The uncertainty is represented as an absolute (single sided) value.
*
- * The value is only available if {@link #hasTimeUncertaintyNanos()} is true.
+ * <p>The uncertainty is represented as an absolute (single sided) value.
+ *
+ * <p>The value is only available if {@link #hasTimeUncertaintyNanos()} is {@code true}.
+ *
+ * <p>This value is often effectively zero (it is the reference clock by which all other times
+ * and time uncertainties are measured), and thus this field may often be 0, or not provided.
*/
public double getTimeUncertaintyNanos() {
return mTimeUncertaintyNanos;
@@ -187,7 +192,7 @@
}
/**
- * Returns true if {@link #getFullBiasNanos()} is available, false otherwise.
+ * Returns {@code true} if {@link #getFullBiasNanos()} is available, {@code false} otherwise.
*/
public boolean hasFullBiasNanos() {
return isFlagSet(HAS_FULL_BIAS);
@@ -197,14 +202,18 @@
* Gets the difference between hardware clock ({@link #getTimeNanos()}) inside GPS receiver and
* the true GPS time since 0000Z, January 6, 1980, in nanoseconds.
*
- * This value is available if the receiver has estimated GPS time. If the computed time is for a
- * non-GPS constellation, the time offset of that constellation to GPS has to be applied to fill
- * this value. The value contains the 'bias uncertainty' {@link #getBiasUncertaintyNanos()} in
- * it, and it should be used for quality check. The value is only available if
- * {@link #hasFullBiasNanos()} is true.
+ * <p>This value is available if the receiver has estimated GPS time. If the computed time is
+ * for a non-GPS constellation, the time offset of that constellation to GPS has to be applied
+ * to fill this value. The value is only available if {@link #hasFullBiasNanos()} is
+ * {@code true}.
*
- * The sign of the value is defined by the following equation:
- * local estimate of GPS time = time_ns + (full_bias_ns + bias_ns)
+ * <p>The error estimate for the sum of this field and {@link #getBiasNanos} is
+ * {@link #getBiasUncertaintyNanos()}.
+ *
+ * <p>The sign of the value is defined by the following equation:
+ *
+ * <pre>
+ * local estimate of GPS time = TimeNanos + (FullBiasNanos + BiasNanos)</pre>
*/
public long getFullBiasNanos() {
return mFullBiasNanos;
@@ -231,7 +240,7 @@
}
/**
- * Returns true if {@link #getBiasNanos()} is available, false otherwise.
+ * Returns {@code true} if {@link #getBiasNanos()} is available, {@code false} otherwise.
*/
public boolean hasBiasNanos() {
return isFlagSet(HAS_BIAS);
@@ -239,9 +248,14 @@
/**
* Gets the clock's sub-nanosecond bias.
- * The reported bias includes {@link #getBiasUncertaintyNanos()}.
*
- * The value is only available if {@link #hasBiasNanos()} is true.
+ * <p>See the description of how this field is part of converting from hardware clock time, to
+ * GPS time, in {@link #getFullBiasNanos()}.
+ *
+ * <p>The error estimate for the sum of this field and {@link #getFullBiasNanos} is
+ * {@link #getBiasUncertaintyNanos()}.
+ *
+ * <p>The value is only available if {@link #hasBiasNanos()} is {@code true}.
*/
public double getBiasNanos() {
return mBiasNanos;
@@ -268,7 +282,8 @@
}
/**
- * Returns true if {@link #getBiasUncertaintyNanos()} is available, false otherwise.
+ * Returns {@code true} if {@link #getBiasUncertaintyNanos()} is available, {@code false}
+ * otherwise.
*/
public boolean hasBiasUncertaintyNanos() {
return isFlagSet(HAS_BIAS_UNCERTAINTY);
@@ -277,7 +292,10 @@
/**
* Gets the clock's Bias Uncertainty (1-Sigma) in nanoseconds.
*
- * The value is only available if {@link #hasBiasUncertaintyNanos()} is true.
+ * <p>See the description of how this field provides the error estimate in the conversion from
+ * hardware clock time, to GPS time, in {@link #getFullBiasNanos()}.
+ *
+ * <p>The value is only available if {@link #hasBiasUncertaintyNanos()} is {@code true}.
*/
public double getBiasUncertaintyNanos() {
return mBiasUncertaintyNanos;
@@ -304,7 +322,8 @@
}
/**
- * Returns true if {@link #getDriftNanosPerSecond()} is available, false otherwise.
+ * Returns {@code true} if {@link #getDriftNanosPerSecond()} is available, {@code false}
+ * otherwise.
*/
public boolean hasDriftNanosPerSecond() {
return isFlagSet(HAS_DRIFT);
@@ -312,10 +331,12 @@
/**
* Gets the clock's Drift in nanoseconds per second.
- * A positive value indicates that the frequency is higher than the nominal frequency.
- * The reported drift includes {@link #getDriftUncertaintyNanosPerSecond()}.
*
- * The value is only available if {@link #hasDriftNanosPerSecond()} is true.
+ * <p>A positive value indicates that the frequency is higher than the nominal (e.g. GPS master
+ * clock) frequency. The error estimate for this reported drift is
+ * {@link #getDriftUncertaintyNanosPerSecond()}.
+ *
+ * <p>The value is only available if {@link #hasDriftNanosPerSecond()} is {@code true}.
*/
public double getDriftNanosPerSecond() {
return mDriftNanosPerSecond;
@@ -342,7 +363,8 @@
}
/**
- * Returns true if {@link #getDriftUncertaintyNanosPerSecond()} is available, false otherwise.
+ * Returns {@code true} if {@link #getDriftUncertaintyNanosPerSecond()} is available,
+ * {@code false} otherwise.
*/
public boolean hasDriftUncertaintyNanosPerSecond() {
return isFlagSet(HAS_DRIFT_UNCERTAINTY);
@@ -351,7 +373,8 @@
/**
* Gets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
*
- * The value is only available if {@link #hasDriftUncertaintyNanosPerSecond()} is true.
+ * <p>The value is only available if {@link #hasDriftUncertaintyNanosPerSecond()} is
+ * {@code true}.
*/
public double getDriftUncertaintyNanosPerSecond() {
return mDriftUncertaintyNanosPerSecond;
@@ -368,7 +391,29 @@
}
/**
- * Gets count of last hardware clock discontinuity.
+ * Resets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
+ * @hide
+ */
+ @TestApi
+ public void resetDriftUncertaintyNanosPerSecond() {
+ resetFlag(HAS_DRIFT_UNCERTAINTY);
+ mDriftUncertaintyNanosPerSecond = Double.NaN;
+ }
+
+ /**
+ * Gets count of hardware clock discontinuities.
+ *
+ * <p>When this value stays the same, vs. a value in a previously reported {@link GnssClock}, it
+ * can be safely assumed that the {@code TimeNanos} value has been derived from a clock that has
+ * been running continuously - e.g. a single continuously powered crystal oscillator, and thus
+ * the {@code (FullBiasNanos + BiasNanos)} offset can be modelled with traditional clock bias
+ * & drift models.
+ *
+ * <p>Each time this value changes, vs. the value in a previously reported {@link GnssClock},
+ * that suggests the hardware clock may have experienced a discontinuity (e.g. a power cycle or
+ * other anomaly), so that any assumptions about modelling a smoothly changing
+ * {@code (FullBiasNanos + BiasNanos)} offset, and a smoothly growing {@code (TimeNanos)}
+ * between this and the previously reported {@code GnssClock}, should be reset.
*/
public int getHardwareClockDiscontinuityCount() {
return mHardwareClockDiscontinuityCount;
@@ -383,16 +428,6 @@
mHardwareClockDiscontinuityCount = value;
}
- /**
- * Resets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
- * @hide
- */
- @TestApi
- public void resetDriftUncertaintyNanosPerSecond() {
- resetFlag(HAS_DRIFT_UNCERTAINTY);
- mDriftUncertaintyNanosPerSecond = Double.NaN;
- }
-
public static final Creator<GnssClock> CREATOR = new Creator<GnssClock>() {
@Override
public GnssClock createFromParcel(Parcel parcel) {
diff --git a/location/java/android/location/GnssMeasurement.java b/location/java/android/location/GnssMeasurement.java
index d78ccee..761ee22 100644
--- a/location/java/android/location/GnssMeasurement.java
+++ b/location/java/android/location/GnssMeasurement.java
@@ -67,18 +67,21 @@
public @interface MultipathIndicator {}
/**
- * The indicator is not available or it is unknown.
+ * The indicator is not available or the presence or absence of multipath is unknown.
*/
public static final int MULTIPATH_INDICATOR_UNKNOWN = 0;
/**
- * The measurement has been indicated to use multi-path.
+ * The measurement shows signs of multi-path.
*/
public static final int MULTIPATH_INDICATOR_DETECTED = 1;
/**
- * The measurement has been indicated not tu use multi-path.
+ * The measurement shows no signs of multi-path.
*/
+ public static final int MULTIPATH_INDICATOR_NOT_DETECTED = 2;
+
+ /** @removed */
public static final int MULTIPATH_INDICATOR_NOT_USED = 2;
/** This GNSS measurement's tracking state is invalid or unknown. */
@@ -192,15 +195,17 @@
}
/**
- * Gets the Pseudo-random number (PRN).
- * Range: [1, 32]
+ * Gets the satellite ID.
+ *
+ * <p>Interpretation depends on {@link #getConstellationType()}.
+ * See {@link GnssStatus#getSvid(int)}.
*/
public int getSvid() {
return mSvid;
}
/**
- * Sets the Pseud-random number (PRN).
+ * Sets the Satellite ID.
* @hide
*/
@TestApi
@@ -209,7 +214,10 @@
}
/**
- * Getst the constellation type.
+ * Gets the constellation type.
+ *
+ * <p>The return value is one of those constants with {@code CONSTELLATION_} prefix in
+ * {@link GnssStatus}.
*/
@GnssStatus.ConstellationType
public int getConstellationType() {
@@ -228,13 +236,14 @@
/**
* Gets the time offset at which the measurement was taken in nanoseconds.
*
- * The reference receiver's time from which this is offset is specified by
+ * <p>The reference receiver's time from which this is offset is specified by
* {@link GnssClock#getTimeNanos()}.
*
- * The sign of this value is given by the following equation:
- * measurement time = time_ns + time_offset_ns
+ * <p>The sign of this value is given by the following equation:
+ * <pre>
+ * measurement time = TimeNanos + TimeOffsetNanos</pre>
*
- * The value provides an individual time-stamp for the measurement, and allows sub-nanosecond
+ * <p>The value provides an individual time-stamp for the measurement, and allows sub-nanosecond
* accuracy.
*/
public double getTimeOffsetNanos() {
@@ -252,9 +261,10 @@
/**
* Gets per-satellite sync state.
- * It represents the current sync state for the associated satellite.
*
- * This value helps interpret {@link #getReceivedSvTimeNanos()}.
+ * <p>It represents the current sync state for the associated satellite.
+ *
+ * <p>This value helps interpret {@link #getReceivedSvTimeNanos()}.
*/
public int getState() {
return mState;
@@ -271,7 +281,8 @@
/**
* Gets a string representation of the 'sync state'.
- * For internal and logging use only.
+ *
+ * <p>For internal and logging use only.
*/
private String getStateString() {
if (mState == STATE_UNKNOWN) {
@@ -335,66 +346,79 @@
/**
* Gets the received GNSS satellite time, at the measurement time, in nanoseconds.
*
- * For GPS & QZSS, this is:
- * Received GPS Time-of-Week at the measurement time, in nanoseconds.
- * The value is relative to the beginning of the current GPS week.
+ * <p>For GPS & 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>
*
- * Given the highest sync state that can be achieved, per each satellite, valid range
- * for this field can be:
+ * <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 decoded : [ 0 1week ] : STATE_TOW_DECODED is set</pre>
*
- * Note well: if there is any ambiguity in integer millisecond,
- * STATE_MSEC_AMBIGUOUS should be set accordingly, in the 'state' field.
+ * <p>Note well: if there is any ambiguity in integer millisecond, {@code STATE_MSEC_AMBIGUOUS}
+ * should be set accordingly, in the 'state' field.
*
- * This value must be populated if 'state' != STATE_UNKNOWN.
+ * <p>This value must be populated if 'state' != {@code STATE_UNKNOWN}.
*
- * For Glonass, this is:
- * Received Glonass time of day, at the measurement time in nanoseconds.
+ * <p>For Glonass, this is:
+ * <ul>
+ * <li>Received Glonass time of day, at the measurement time in nanoseconds.</li>
+ * </ul>
*
- * Given the highest sync state that can be achieved, per each satellite, valid range for
- * this field can be:
+ * <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 : [ 0 1day ] : STATE_GLO_TOD_DECODED 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 : [ 0 1day ] : STATE_GLO_TOD_DECODED is set</pre>
*
- * For Beidou, this is:
- * Received Beidou time of week, at the measurement time in nanoseconds.
+ * <p>For Beidou, this is:
+ * <ul>
+ * <li>Received Beidou time of week, at the measurement time in nanoseconds.</li>
+ * </ul>
*
- * Given the highest sync state that can be achieved, per each satellite, valid range for
- * this field can be:
+ * <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 : [ 0 1week ] : STATE_TOW_DECODED is set
+ * Time of week : [ 0 1week ] : STATE_TOW_DECODED is set</pre>
*
- * For Galileo, this is:
- * Received Galileo time of week, at the measurement time in nanoseconds.
+ * <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 : [ 0 1week ] : STATE_GAL_TOW_DECODED is set</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
+ * <p>For SBAS, this is:
+ * <ul>
+ * <li>Received SBAS time, at the measurement time in nanoseconds.</li>
+ * </ul>
*
- * E1B page : [ 0 2s ] : STATE_GAL_E1B_PAGE_SYNC is set
- * Time of week : [ 0 1week ] : STATE_GAL_TOW_DECODED is set
- *
- * For SBAS, this is:
- * Received SBAS time, at the measurement time in nanoseconds.
- *
- * Given the highest sync state that can be achieved, per each satellite, valid range for
- * this field can be:
+ * <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
+ * Message : [ 0 1s ] : STATE_SBAS_SYNC is set</pre>
*/
public long getReceivedSvTimeNanos() {
return mReceivedSvTimeNanos;
@@ -410,7 +434,7 @@
}
/**
- * Gets the received GNSS time uncertainty (1-Sigma) in nanoseconds.
+ * Gets the error estimate (1-sigma) for the received GNSS time, in nanoseconds.
*/
public long getReceivedSvTimeUncertaintyNanos() {
return mReceivedSvTimeUncertaintyNanos;
@@ -427,9 +451,10 @@
/**
* Gets the Carrier-to-noise density in dB-Hz.
- * Range: [0, 63].
*
- * The value contains the measured C/N0 for the signal at the antenna input.
+ * <p>Typical range: 10-50 db-Hz.
+ *
+ * <p>The value contains the measured C/N0 for the signal at the antenna input.
*/
public double getCn0DbHz() {
return mCn0DbHz;
@@ -447,16 +472,18 @@
/**
* Gets the Pseudorange rate at the timestamp in m/s.
*
- * The reported value includes {@link #getPseudorangeRateUncertaintyMetersPerSecond()}.
+ * <p>The error estimate for this value is
+ * {@link #getPseudorangeRateUncertaintyMetersPerSecond()}.
*
- * The value is uncorrected, hence corrections for receiver and satellite clock frequency errors
- * should not be included.
+ * <p>The value is uncorrected, i.e. corrections for receiver and satellite clock frequency
+ * errors are not included.
*
- * A positive 'uncorrected' value indicates that the SV is moving away from the receiver. The
+ * <p>A positive 'uncorrected' value indicates that the SV is moving away from the receiver. The
* sign of the 'uncorrected' 'pseudorange rate' and its relation to the sign of 'doppler shift'
* is given by the equation:
*
- * pseudorange rate = -k * doppler shift (where k is a constant)
+ * <pre>
+ * pseudorange rate = -k * doppler shift (where k is a constant)</pre>
*/
public double getPseudorangeRateMetersPerSecond() {
return mPseudorangeRateMetersPerSecond;
@@ -473,7 +500,8 @@
/**
* Gets the pseudorange's rate uncertainty (1-Sigma) in m/s.
- * The uncertainty is represented as an absolute (single sided) value.
+ *
+ * <p>The uncertainty is represented as an absolute (single sided) value.
*/
public double getPseudorangeRateUncertaintyMetersPerSecond() {
return mPseudorangeRateUncertaintyMetersPerSecond;
@@ -490,7 +518,8 @@
/**
* Gets 'Accumulated Delta Range' state.
- * It indicates whether {@link #getAccumulatedDeltaRangeMeters()} is reset or there is a
+ *
+ * <p>It indicates whether {@link #getAccumulatedDeltaRangeMeters()} is reset or there is a
* cycle slip (indicating 'loss of lock').
*/
public int getAccumulatedDeltaRangeState() {
@@ -508,7 +537,8 @@
/**
* Gets a string representation of the 'Accumulated Delta Range state'.
- * For internal and logging use only.
+ *
+ * <p>For internal and logging use only.
*/
private String getAccumulatedDeltaRangeStateString() {
if (mAccumulatedDeltaRangeState == ADR_STATE_UNKNOWN) {
@@ -536,14 +566,17 @@
/**
* Gets the accumulated delta range since the last channel reset, in meters.
- * The reported value includes {@link #getAccumulatedDeltaRangeUncertaintyMeters()}.
*
- * The availability of the value is represented by {@link #getAccumulatedDeltaRangeState()}.
+ * <p>The error estimate for this value is {@link #getAccumulatedDeltaRangeUncertaintyMeters()}.
*
- * A positive value indicates that the SV is moving away from the receiver.
+ * <p>The availability of the value is represented by {@link #getAccumulatedDeltaRangeState()}.
+ *
+ * <p>A positive value indicates that the SV is moving away from the receiver.
* The sign of {@link #getAccumulatedDeltaRangeMeters()} and its relation to the sign of
* {@link #getCarrierPhase()} is given by the equation:
- * accumulated delta range = -k * carrier phase (where k is a constant)
+ *
+ * <pre>
+ * accumulated delta range = -k * carrier phase (where k is a constant)</pre>
*/
public double getAccumulatedDeltaRangeMeters() {
return mAccumulatedDeltaRangeMeters;
@@ -560,9 +593,10 @@
/**
* Gets the accumulated delta range's uncertainty (1-Sigma) in meters.
- * The uncertainty is represented as an absolute (single sided) value.
*
- * The status of the value is represented by {@link #getAccumulatedDeltaRangeState()}.
+ * <p>The uncertainty is represented as an absolute (single sided) value.
+ *
+ * <p>The status of the value is represented by {@link #getAccumulatedDeltaRangeState()}.
*/
public double getAccumulatedDeltaRangeUncertaintyMeters() {
return mAccumulatedDeltaRangeUncertaintyMeters;
@@ -571,7 +605,7 @@
/**
* Sets the accumulated delta range's uncertainty (1-sigma) in meters.
*
- * The status of the value is represented by {@link #getAccumulatedDeltaRangeState()}.
+ * <p>The status of the value is represented by {@link #getAccumulatedDeltaRangeState()}.
*
* @hide
*/
@@ -581,17 +615,20 @@
}
/**
- * Returns true if {@link #getCarrierFrequencyHz()} is available, false otherwise.
+ * Returns {@code true} if {@link #getCarrierFrequencyHz()} is available, {@code false}
+ * otherwise.
*/
public boolean hasCarrierFrequencyHz() {
return isFlagSet(HAS_CARRIER_FREQUENCY);
}
/**
- * Gets the carrier frequency at which codes and messages are modulated, it can be L1 or L2.
- * If the field is not set, the carrier frequency corresponds to L1.
+ * Gets the carrier frequency at which codes and messages are modulated.
*
- * The value is only available if {@link #hasCarrierFrequencyHz()} is true.
+ * <p>For GPS, e.g., it can be L1 or L2. If the field is not set, it is the primary common use
+ * frequency, e.g. L1 for GPS.
+ *
+ * <p>The value is only available if {@link #hasCarrierFrequencyHz()} is {@code true}.
*/
public float getCarrierFrequencyHz() {
return mCarrierFrequencyHz;
@@ -618,7 +655,7 @@
}
/**
- * Returns true if {@link #getCarrierCycles()} is available, false otherwise.
+ * Returns {@code true} if {@link #getCarrierCycles()} is available, {@code false} otherwise.
*/
public boolean hasCarrierCycles() {
return isFlagSet(HAS_CARRIER_CYCLES);
@@ -626,9 +663,10 @@
/**
* The number of full carrier cycles between the satellite and the receiver.
- * The reference frequency is given by the value of {@link #getCarrierFrequencyHz()}.
*
- * The value is only available if {@link #hasCarrierCycles()} is true.
+ * <p>The reference frequency is given by the value of {@link #getCarrierFrequencyHz()}.
+ *
+ * <p>The value is only available if {@link #hasCarrierCycles()} is {@code true}.
*/
public long getCarrierCycles() {
return mCarrierCycles;
@@ -655,7 +693,7 @@
}
/**
- * Returns true if {@link #getCarrierPhase()} is available, false otherwise.
+ * Returns {@code true} if {@link #getCarrierPhase()} is available, {@code false} otherwise.
*/
public boolean hasCarrierPhase() {
return isFlagSet(HAS_CARRIER_PHASE);
@@ -663,13 +701,16 @@
/**
* Gets the RF phase detected by the receiver.
- * Range: [0.0, 1.0].
- * This is usually the fractional part of the complete carrier phase measurement.
*
- * The reference frequency is given by the value of {@link #getCarrierFrequencyHz()}.
- * The reported carrier-phase includes {@link #getCarrierPhaseUncertainty()}.
+ * <p>Range: [0.0, 1.0].
*
- * The value is only available if {@link #hasCarrierPhase()} is true.
+ * <p>This is the fractional part of the complete carrier phase measurement.
+ *
+ * <p>The reference frequency is given by the value of {@link #getCarrierFrequencyHz()}.
+ *
+ * <p>The error estimate for this value is {@link #getCarrierPhaseUncertainty()}.
+ *
+ * <p>The value is only available if {@link #hasCarrierPhase()} is {@code true}.
*/
public double getCarrierPhase() {
return mCarrierPhase;
@@ -696,7 +737,8 @@
}
/**
- * Returns true if {@link #getCarrierPhaseUncertainty()} is available, false otherwise.
+ * Returns {@code true} if {@link #getCarrierPhaseUncertainty()} is available, {@code false}
+ * otherwise.
*/
public boolean hasCarrierPhaseUncertainty() {
return isFlagSet(HAS_CARRIER_PHASE_UNCERTAINTY);
@@ -704,9 +746,10 @@
/**
* Gets the carrier-phase's uncertainty (1-Sigma).
- * The uncertainty is represented as an absolute (single sided) value.
*
- * The value is only available if {@link #hasCarrierPhaseUncertainty()} is true.
+ * <p>The uncertainty is represented as an absolute (single sided) value.
+ *
+ * <p>The value is only available if {@link #hasCarrierPhaseUncertainty()} is {@code true}.
*/
public double getCarrierPhaseUncertainty() {
return mCarrierPhaseUncertainty;
@@ -751,7 +794,8 @@
/**
* Gets a string representation of the 'multi-path indicator'.
- * For internal and logging use only.
+ *
+ * <p>For internal and logging use only.
*/
private String getMultipathIndicatorString() {
switch(mMultipathIndicator) {
@@ -767,7 +811,7 @@
}
/**
- * Returns true if {@link #getSnrInDb()} is available, false otherwise.
+ * Returns {@code true} if {@link #getSnrInDb()} is available, {@code false} otherwise.
*/
public boolean hasSnrInDb() {
return isFlagSet(HAS_SNR);
@@ -776,7 +820,7 @@
/**
* Gets the Signal-to-Noise ratio (SNR) in dB.
*
- * The value is only available if {@link #hasSnrInDb()} is true.
+ * <p>The value is only available if {@link #hasSnrInDb()} is {@code true}.
*/
public double getSnrInDb() {
return mSnrInDb;
diff --git a/location/java/android/location/GnssMeasurementsEvent.java b/location/java/android/location/GnssMeasurementsEvent.java
index ec252a8..3151694 100644
--- a/location/java/android/location/GnssMeasurementsEvent.java
+++ b/location/java/android/location/GnssMeasurementsEvent.java
@@ -16,6 +16,7 @@
package android.location;
+import android.annotation.TestApi;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.os.Parcel;
@@ -33,29 +34,11 @@
* Events are delivered to registered instances of {@link Callback}.
*/
public final class GnssMeasurementsEvent implements Parcelable {
- /**
- * The status of the GNSS measurements event.
- * @hide
- */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({STATUS_NOT_SUPPORTED, STATUS_READY, STATUS_GNSS_LOCATION_DISABLED})
- public @interface GnssMeasurementsStatus {}
-
- /**
- * The system does not support tracking of GNSS Measurements. This status will not change in the
- * future.
- */
+ /** @removed */
public static final int STATUS_NOT_SUPPORTED = 0;
-
- /**
- * GNSS Measurements are successfully being tracked, it will receive updates once they are
- * available.
- */
+ /** @removed */
public static final int STATUS_READY = 1;
-
- /**
- * GNSS provider or Location is disabled, updates will not be received until they are enabled.
- */
+ /** @removed */
public static final int STATUS_GNSS_LOCATION_DISABLED = 2;
private final GnssClock mClock;
@@ -68,6 +51,32 @@
* {@link LocationManager#registerGnssMeasurementsCallback}.
*/
public static abstract class Callback {
+ /**
+ * The status of the GNSS measurements event.
+ * @hide
+ */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({STATUS_NOT_SUPPORTED, STATUS_READY, STATUS_LOCATION_DISABLED})
+ public @interface GnssMeasurementsStatus {}
+
+ /**
+ * The system does not support tracking of GNSS Measurements.
+ *
+ * <p>This status will not change in the future.
+ */
+ public static final int STATUS_NOT_SUPPORTED = 0;
+
+ /**
+ * GNSS Measurements are successfully being tracked, it will receive updates once they are
+ * available.
+ */
+ public static final int STATUS_READY = 1;
+
+ /**
+ * GPS provider or Location is disabled, updates will not be received until they are
+ * enabled.
+ */
+ public static final int STATUS_LOCATION_DISABLED = 2;
/**
* Reports the latest collected GNSS Measurements.
@@ -80,6 +89,10 @@
public void onStatusChanged(@GnssMeasurementsStatus int status) {}
}
+ /**
+ * @hide
+ */
+ @TestApi
public GnssMeasurementsEvent(GnssClock clock, GnssMeasurement[] measurements) {
if (clock == null) {
throw new InvalidParameterException("Parameter 'clock' must not be null.");
@@ -94,6 +107,10 @@
mReadOnlyMeasurements = Collections.unmodifiableCollection(measurementCollection);
}
+ /**
+ * Gets the GNSS receiver clock information associated with the measurements for the current
+ * event.
+ */
@NonNull
public GnssClock getClock() {
return mClock;
diff --git a/location/java/android/location/GnssNavigationMessage.aidl b/location/java/android/location/GnssNavigationMessage.aidl
new file mode 100644
index 0000000..1cdd510
--- /dev/null
+++ b/location/java/android/location/GnssNavigationMessage.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2016, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.location;
+
+parcelable GnssNavigationMessage;
diff --git a/location/java/android/location/GnssNavigationMessage.java b/location/java/android/location/GnssNavigationMessage.java
index a5eace8..aa26111 100644
--- a/location/java/android/location/GnssNavigationMessage.java
+++ b/location/java/android/location/GnssNavigationMessage.java
@@ -34,7 +34,7 @@
private static final byte[] EMPTY_ARRAY = new byte[0];
/**
- * The type of the GPS Clock.
+ * The type of the GNSS Navigation Message
* @hide
*/
@Retention(RetentionPolicy.SOURCE)
@@ -81,6 +81,51 @@
*/
public static final int STATUS_PARITY_REBUILT = (1<<1);
+ /**
+ * Used for receiving GNSS satellite Navigation Messages from the GNSS engine.
+ *
+ * <p>You can implement this interface and call
+ * {@link LocationManager#registerGnssNavigationMessageCallback}.
+ */
+ public static abstract class Callback {
+ /**
+ * The status of GNSS measurements event.
+ * @hide
+ */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({STATUS_NOT_SUPPORTED, STATUS_READY, STATUS_LOCATION_DISABLED})
+ public @interface GnssNavigationMessageStatus {}
+
+ /**
+ * The system does not support tracking of GNSS Navigation Messages.
+ *
+ * This status will not change in the future.
+ */
+ public static final int STATUS_NOT_SUPPORTED = 0;
+
+ /**
+ * GNSS Navigation Messages are successfully being tracked, it will receive updates once
+ * they are available.
+ */
+ public static final int STATUS_READY = 1;
+
+ /**
+ * GNSS provider or Location is disabled, updated will not be received until they are
+ * enabled.
+ */
+ public static final int STATUS_LOCATION_DISABLED = 2;
+
+ /**
+ * Returns the latest collected GNSS Navigation Message.
+ */
+ public void onGnssNavigationMessageReceived(GnssNavigationMessage event) {}
+
+ /**
+ * Returns the latest status of the GNSS Navigation Messages sub-system.
+ */
+ public void onStatusChanged(@GnssNavigationMessageStatus int status) {}
+ }
+
// End enumerations in sync with gps.h
private int mType;
@@ -170,15 +215,16 @@
}
/**
- * Gets the Pseudo-random number.
- * Range: [1, 32].
+ * Gets the satellite ID.
+ *
+ * <p>Range varies by constellation. See definition at {@code GnssStatus#getSvid(int)}
*/
public int getSvid() {
return mSvid;
}
/**
- * Sets the Pseud-random number.
+ * Sets the satellite ID.
* @hide
*/
@TestApi
@@ -187,10 +233,25 @@
}
/**
- * Gets the Message Identifier.
- * It provides an index so the complete Navigation Message can be assembled. i.e. for L1 C/A
- * subframe 4 and 5, this value corresponds to the 'frame id' of the navigation message.
- * Subframe 1, 2, 3 does not contain a 'frame id' and this might be reported as -1.
+ * Gets the Message identifier.
+ *
+ * <p>This provides an index to help with complete Navigation Message assembly. Similar
+ * identifiers within the data bits themselves often supplement this information, in ways even
+ * more specific to each message type; see the relevant satellite constellation ICDs for
+ * details.
+ *
+ * <ul>
+ * <li> For GPS L1 C/A subframe 4 and 5, this value corresponds to the 'frame id' of the
+ * 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.)</li>
+ * <li> For Glonass L1 C/A, this refers to the frame ID, in the range of 1-5.</li>
+ * <li> For BeiDou D1, this refers to the frame number in the range of 1-24</li>
+ * <li> For Beidou D2, this refers to the frame number, in the range of 1-120</li>
+ * <li> For Galileo F/NAV nominal frame structure, this refers to the subframe number, in the
+ * range of 1-12</li>
+ * <li> For Galileo I/NAV nominal frame structure, this refers to the subframe number in the
+ * range of 1-24</li>
+ * </ul>
*/
public int getMessageId() {
return mMessageId;
@@ -206,10 +267,18 @@
}
/**
- * Gets the Sub-message Identifier.
- * If required by {@link #getType()}, this value contains a sub-index within the current message
- * (or frame) that is being transmitted. i.e. for L1 C/A the sub-message identifier corresponds
- * to the sub-frame Id of the navigation message.
+ * Gets the sub-message identifier, relevant to the {@link #getType()} of the message.
+ *
+ * <ul>
+ * <li> For GPS L1 C/A, BeiDou D1 & BeiDou D2, the submessage id corresponds to the subframe
+ * number of the navigation message, in the range of 1-5.</li>
+ * <li>For Glonass L1 C/A, this refers to the String number, in the range from 1-15</li>
+ * <li>For Galileo F/NAV, this refers to the page type in the range 1-6</li>
+ * <li>For Galileo I/NAV, this refers to the word type in the range 1-10+</li>
+ * <li>For Galileo in particular, the type information embedded within the data bits may be even
+ * more useful in interpretation, than the nominal page and word types provided in this
+ * field.</li>
+ * </ul>
*/
public int getSubmessageId() {
return mSubmessageId;
@@ -225,8 +294,25 @@
}
/**
- * Gets the data associated with the Navigation Message.
- * The bytes (or words) specified using big endian format (MSB first).
+ * Gets the data of the reported GPS message.
+ *
+ * <p>The bytes (or words) specified using big endian format (MSB first).
+ *
+ * <ul>
+ * <li>For GPS L1 C/A, Beidou D1 & Beidou D2, each subframe contains 10 30-bit words. Each
+ * word (30 bits) should be fit into the last 30 bits in a 4-byte word (skip B31 and B32), with
+ * MSB first, for a total of 40 bytes, covering a time period of 6, 6, and 0.6 seconds,
+ * respectively.</li>
+ * <li>For Glonass L1 C/A, each string contains 85 data bits, including the checksum. These
+ * bits should be fit into 11 bytes, with MSB first (skip B86-B88), covering a time period of 2
+ * seconds.</li>
+ * <li>For Galileo F/NAV, each word consists of 238-bit (sync & tail symbols excluded). Each
+ * word should be fit into 30-bytes, with MSB first (skip B239, B240), covering a time period of
+ * 10 seconds.</li>
+ * <li>For Galileo I/NAV, each page contains 2 page parts, even and odd, with a total of 2x114 =
+ * 228 bits, (sync & tail excluded) that should be fit into 29 bytes, with MSB first (skip
+ * B229-B232).</li>
+ * </ul>
*/
@NonNull
public byte[] getData() {
diff --git a/location/java/android/location/GnssNavigationMessageCallbackTransport.java b/location/java/android/location/GnssNavigationMessageCallbackTransport.java
index 4204b99..1eafd02 100644
--- a/location/java/android/location/GnssNavigationMessageCallbackTransport.java
+++ b/location/java/android/location/GnssNavigationMessageCallbackTransport.java
@@ -20,12 +20,12 @@
import android.os.RemoteException;
/**
- * A handler class to manage transport callback for {@link GnssNavigationMessageEvent.Callback}.
+ * A handler class to manage transport callback for {@link GnssNavigationMessage.Callback}.
*
* @hide
*/
class GnssNavigationMessageCallbackTransport
- extends LocalListenerHelper<GnssNavigationMessageEvent.Callback> {
+ extends LocalListenerHelper<GnssNavigationMessage.Callback> {
private final ILocationManager mLocationManager;
private final IGnssNavigationMessageListener mListenerTransport = new ListenerTransport();
@@ -51,11 +51,11 @@
private class ListenerTransport extends IGnssNavigationMessageListener.Stub {
@Override
- public void onGnssNavigationMessageReceived(final GnssNavigationMessageEvent event) {
- ListenerOperation<GnssNavigationMessageEvent.Callback> operation =
- new ListenerOperation<GnssNavigationMessageEvent.Callback>() {
+ public void onGnssNavigationMessageReceived(final GnssNavigationMessage event) {
+ ListenerOperation<GnssNavigationMessage.Callback> operation =
+ new ListenerOperation<GnssNavigationMessage.Callback>() {
@Override
- public void execute(GnssNavigationMessageEvent.Callback callback)
+ public void execute(GnssNavigationMessage.Callback callback)
throws RemoteException {
callback.onGnssNavigationMessageReceived(event);
}
@@ -65,10 +65,10 @@
@Override
public void onStatusChanged(final int status) {
- ListenerOperation<GnssNavigationMessageEvent.Callback> operation =
- new ListenerOperation<GnssNavigationMessageEvent.Callback>() {
+ ListenerOperation<GnssNavigationMessage.Callback> operation =
+ new ListenerOperation<GnssNavigationMessage.Callback>() {
@Override
- public void execute(GnssNavigationMessageEvent.Callback callback)
+ public void execute(GnssNavigationMessage.Callback callback)
throws RemoteException {
callback.onStatusChanged(status);
}
diff --git a/location/java/android/location/GnssNavigationMessageEvent.java b/location/java/android/location/GnssNavigationMessageEvent.java
index 992dfc3..f7e5665 100644
--- a/location/java/android/location/GnssNavigationMessageEvent.java
+++ b/location/java/android/location/GnssNavigationMessageEvent.java
@@ -28,10 +28,11 @@
/**
* A class implementing a container for data associated with a navigation message event.
* Events are delivered to registered instances of {@link Callback}.
+ * @removed
*/
public final class GnssNavigationMessageEvent implements Parcelable {
/**
- * The status of GPS measurements event.
+ * The status of GNSS measurements event.
* @hide
*/
@Retention(RetentionPolicy.SOURCE)
@@ -39,38 +40,40 @@
public @interface GnssNavigationMessageStatus {}
/**
- * The system does not support tracking of GPS Navigation Messages. This status will not change
- * in the future.
+ * The system does not support tracking of GNSS Navigation Messages.
+ *
+ * This status will not change in the future.
*/
public static final int STATUS_NOT_SUPPORTED = 0;
/**
- * GPS Navigation Messages are successfully being tracked, it will receive updates once they are
- * available.
+ * GNSS Navigation Messages are successfully being tracked, it will receive updates once they
+ * are available.
*/
public static final int STATUS_READY = 1;
/**
- * GPS provider or Location is disabled, updated will not be received until they are enabled.
+ * GNSS provider or Location is disabled, updated will not be received until they are enabled.
*/
public static final int STATUS_GNSS_LOCATION_DISABLED = 2;
private final GnssNavigationMessage mNavigationMessage;
/**
- * Used for receiving GPS satellite Navigation Messages from the GPS engine.
- * You can implement this interface and call
+ * Used for receiving GNSS satellite Navigation Messages from the GNSS engine.
+ *
+ * <p>You can implement this interface and call
* {@link LocationManager#registerGnssNavigationMessageCallback}.
*/
public static abstract class Callback {
/**
- * Returns the latest collected GPS Navigation Message.
+ * Returns the latest collected GNSS Navigation Message.
*/
public void onGnssNavigationMessageReceived(GnssNavigationMessageEvent event) {}
/**
- * Returns the latest status of the GPS Navigation Messages sub-system.
+ * Returns the latest status of the GNSS Navigation Messages sub-system.
*/
public void onStatusChanged(@GnssNavigationMessageStatus int status) {}
}
diff --git a/location/java/android/location/GnssNmeaListener.java b/location/java/android/location/GnssNmeaListener.java
index 6c9b08a..756ae49 100644
--- a/location/java/android/location/GnssNmeaListener.java
+++ b/location/java/android/location/GnssNmeaListener.java
@@ -23,8 +23,9 @@
* See <a href="http://en.wikipedia.org/wiki/NMEA_0183">NMEA 0183</a> for more details.
* You can implement this interface and call {@link LocationManager#addNmeaListener}
* to receive NMEA data from the GNSS engine.
+* @removed
*/
public interface GnssNmeaListener {
/** Called when an NMEA message is received. */
void onNmeaReceived(long timestamp, String nmea);
-}
\ No newline at end of file
+}
diff --git a/location/java/android/location/GnssStatus.java b/location/java/android/location/GnssStatus.java
index d76feec..e834c30 100644
--- a/location/java/android/location/GnssStatus.java
+++ b/location/java/android/location/GnssStatus.java
@@ -23,9 +23,11 @@
/**
* This class represents the current state of the GNSS engine.
- * This class is used in conjunction with the {@link GnssStatusCallback}.
+ * This class is used in conjunction with the {@link GnssStatus.Callback}.
*/
public final class GnssStatus {
+ // these must match the definitions in gps.h
+
/** Unknown constellation type. */
public static final int CONSTELLATION_UNKNOWN = 0;
/** Constellation type constant for GPS. */
@@ -41,16 +43,6 @@
/** Constellation type constant for Galileo. */
public static final int CONSTELLATION_GALILEO = 6;
- /**
- * Constellation type.
- * @hide
- */
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({CONSTELLATION_UNKNOWN, CONSTELLATION_GPS, CONSTELLATION_SBAS, CONSTELLATION_GLONASS,
- CONSTELLATION_QZSS, CONSTELLATION_BEIDOU, CONSTELLATION_GALILEO})
- public @interface ConstellationType {}
-
- // these must match the definitions in gps.h
/** @hide */
public static final int GNSS_SV_FLAGS_NONE = 0;
/** @hide */
@@ -67,6 +59,42 @@
/** @hide */
public static final int CONSTELLATION_TYPE_MASK = 0xf;
+ /**
+ * Used for receiving notifications when GNSS events happen.
+ */
+ public static abstract class Callback {
+ /**
+ * Called when GNSS system has started.
+ */
+ public void onStarted() {}
+
+ /**
+ * Called when GNSS system has stopped.
+ */
+ public void onStopped() {}
+
+ /**
+ * Called when the GNSS system has received its first fix since starting.
+ * @param ttffMillis the time from start to first fix in milliseconds.
+ */
+ public void onFirstFix(int ttffMillis) {}
+
+ /**
+ * Called periodically to report GNSS satellite status.
+ * @param status the current status of all satellites.
+ */
+ public void onSatelliteStatusChanged(GnssStatus status) {}
+ }
+
+ /**
+ * Constellation type.
+ * @hide
+ */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({CONSTELLATION_UNKNOWN, CONSTELLATION_GPS, CONSTELLATION_SBAS, CONSTELLATION_GLONASS,
+ CONSTELLATION_QZSS, CONSTELLATION_BEIDOU, CONSTELLATION_GALILEO})
+ public @interface ConstellationType {}
+
/* These package private values are modified by the LocationManager class */
/* package */ int[] mSvidWithFlags;
/* package */ float[] mCn0DbHz;
@@ -83,15 +111,21 @@
mAzimuths = azimuths;
}
+ /** @removed */
+ public int getNumSatellites() {
+ return getSatelliteCount();
+ }
+
/**
* Gets the total number of satellites in satellite list.
*/
- public int getNumSatellites() {
+ public int getSatelliteCount() {
return mSvCount;
}
/**
- * Retrieves the constellation type of the satellite at the specified position.
+ * Retrieves the constellation type of the satellite at the specified index.
+ *
* @param satIndex the index of the satellite in the list.
*/
@ConstellationType
@@ -101,7 +135,30 @@
}
/**
- * Retrieves the pseudo-random number of the satellite at the specified position.
+ * Gets the identification number for the satellite at the specific index.
+ *
+ * <p>This svid is pseudo-random number for most constellations. It is FCN & OSN number for
+ * Glonass.
+ *
+ * <p>The distinction is made by looking at constellation field
+ * {@link #getConstellationType(int)} Expected values are in the range of:
+ *
+ * <ul>
+ * <li>GPS: 1-32</li>
+ * <li>SBAS: 120-151, 183-192</li>
+ * <li>GLONASS:
+ * <ul>
+ * <li>The least significant 8 bits, signed, are the orbital slot number (OSN) in the range
+ * from 1-24, if known, or -127 if unknown</li>
+ * <li>The next least signficant 8 bits, signed, are the frequency channel number (FCN) in the
+ * range from -7 to +6, if known, and -127, if unknown</li>
+ * <li>At least one of the two (FCN & OSN) shall be set to a known value</li>
+ * </ul></li>
+ * <li>QZSS: 193-200</li>
+ * <li>Galileo: 1-36</li>
+ * <li>Beidou: 1-37</li>
+ * </ul>
+ *
* @param satIndex the index of the satellite in the list.
*/
public int getSvid(int satIndex) {
@@ -109,7 +166,9 @@
}
/**
- * Retrieves the signal-noise ration of the satellite at the specified position.
+ * Retrieves the carrier-to-noise density at the antenna of the satellite at the specified index
+ * in dB-Hz.
+ *
* @param satIndex the index of the satellite in the list.
*/
public float getCn0DbHz(int satIndex) {
@@ -117,7 +176,8 @@
}
/**
- * Retrieves the elevation of the satellite at the specified position.
+ * Retrieves the elevation of the satellite at the specified index.
+ *
* @param satIndex the index of the satellite in the list.
*/
public float getElevationDegrees(int satIndex) {
@@ -125,31 +185,46 @@
}
/**
- * Retrieves the azimuth the satellite at the specified position.
+ * Retrieves the azimuth the satellite at the specified index.
+ *
* @param satIndex the index of the satellite in the list.
*/
public float getAzimuthDegrees(int satIndex) {
return mAzimuths[satIndex];
}
- /**
- * Detects whether the satellite at the specified position has ephemeris data.
- * @param satIndex the index of the satellite in the list.
- */
+ /** @removed */
public boolean hasEphemeris(int satIndex) {
- return (mSvidWithFlags[satIndex] & GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA) != 0;
+ return hasEphemerisData(satIndex);
}
/**
- * Detects whether the satellite at the specified position has almanac data.
+ * Reports whether the satellite at the specified index has ephemeris data.
+ *
* @param satIndex the index of the satellite in the list.
*/
+ public boolean hasEphemerisData(int satIndex) {
+ return (mSvidWithFlags[satIndex] & GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA) != 0;
+ }
+
+ /** @removed */
public boolean hasAlmanac(int satIndex) {
+ return hasAlmanacData(satIndex);
+ }
+
+ /**
+ * Reports whether the satellite at the specified index has almanac data.
+ *
+ * @param satIndex the index of the satellite in the list.
+ */
+ public boolean hasAlmanacData(int satIndex) {
return (mSvidWithFlags[satIndex] & GNSS_SV_FLAGS_HAS_ALMANAC_DATA) != 0;
}
/**
- * Detects whether the satellite at the specified position is used in fix.
+ * Reports whether the satellite at the specified index was used in the calculation of the most
+ * recent position fix.
+ *
* @param satIndex the index of the satellite in the list.
*/
public boolean usedInFix(int satIndex) {
diff --git a/location/java/android/location/GnssStatusCallback.java b/location/java/android/location/GnssStatusCallback.java
index 0d2955a..bf295ef 100644
--- a/location/java/android/location/GnssStatusCallback.java
+++ b/location/java/android/location/GnssStatusCallback.java
@@ -18,6 +18,7 @@
/**
* Used for receiving notifications when GNSS events happen.
+ * @removed
*/
public abstract class GnssStatusCallback {
/**
diff --git a/location/java/android/location/GpsSatellite.java b/location/java/android/location/GpsSatellite.java
index 820f5746..788d01e 100644
--- a/location/java/android/location/GpsSatellite.java
+++ b/location/java/android/location/GpsSatellite.java
@@ -18,8 +18,12 @@
/**
* This class represents the current state of a GPS satellite.
+ *
* This class is used in conjunction with the {@link GpsStatus} class.
+ *
+ * @deprecated use {@link GnssStatus} and {@link GnssStatus.Callback}.
*/
+@Deprecated
public final class GpsSatellite {
/* These package private values are modified by the GpsStatus class */
boolean mValid;
diff --git a/location/java/android/location/GpsStatus.java b/location/java/android/location/GpsStatus.java
index bc518f9..038247b 100644
--- a/location/java/android/location/GpsStatus.java
+++ b/location/java/android/location/GpsStatus.java
@@ -24,8 +24,12 @@
/**
* This class represents the current state of the GPS engine.
- * This class is used in conjunction with the {@link Listener} interface.
+ *
+ * <p>This class is used in conjunction with the {@link Listener} interface.
+ *
+ * @deprecated use {@link GnssStatus} and {@link GnssStatus.Callback}.
*/
+@Deprecated
public final class GpsStatus {
private static final int NUM_SATELLITES = 255;
@@ -102,7 +106,9 @@
/**
* Used for receiving notifications when GPS status has changed.
+ * @deprecated use {@link GnssStatus.Callback} instead.
*/
+ @Deprecated
public interface Listener {
/**
* Called to report changes in the GPS status.
@@ -130,7 +136,9 @@
* See <a href="http://en.wikipedia.org/wiki/NMEA_0183">NMEA 0183</a> for more details.
* You can implement this interface and call {@link LocationManager#addNmeaListener}
* to receive NMEA data from the GPS engine.
+ * @deprecated use {@link OnNmeaMessageListener} instead.
*/
+ @Deprecated
public interface NmeaListener {
void onNmeaReceived(long timestamp, String nmea);
}
diff --git a/location/java/android/location/IGnssNavigationMessageListener.aidl b/location/java/android/location/IGnssNavigationMessageListener.aidl
index de6129c..3e49b5b 100644
--- a/location/java/android/location/IGnssNavigationMessageListener.aidl
+++ b/location/java/android/location/IGnssNavigationMessageListener.aidl
@@ -16,12 +16,12 @@
package android.location;
-import android.location.GnssNavigationMessageEvent;
+import android.location.GnssNavigationMessage;
/**
* {@hide}
*/
oneway interface IGnssNavigationMessageListener {
- void onGnssNavigationMessageReceived(in GnssNavigationMessageEvent event);
+ void onGnssNavigationMessageReceived(in GnssNavigationMessage event);
void onStatusChanged(in int status);
}
diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java
index 28db099..b246360 100644
--- a/location/java/android/location/LocationManager.java
+++ b/location/java/android/location/LocationManager.java
@@ -70,10 +70,16 @@
new HashMap<>();
private final HashMap<GpsStatus.NmeaListener, GnssStatusListenerTransport> mGpsNmeaListeners =
new HashMap<>();
- private final HashMap<GnssStatusCallback, GnssStatusListenerTransport> mGnssStatusListeners =
+ private final HashMap<GnssStatusCallback, GnssStatusListenerTransport>
+ mOldGnssStatusListeners = new HashMap<>();
+ private final HashMap<GnssStatus.Callback, GnssStatusListenerTransport> mGnssStatusListeners =
new HashMap<>();
- private final HashMap<GnssNmeaListener, GnssStatusListenerTransport> mGnssNmeaListeners =
+ private final HashMap<GnssNmeaListener, GnssStatusListenerTransport> mOldGnssNmeaListeners =
new HashMap<>();
+ private final HashMap<OnNmeaMessageListener, GnssStatusListenerTransport> mGnssNmeaListeners =
+ new HashMap<>();
+ private final HashMap<GnssNavigationMessageEvent.Callback, GnssNavigationMessage.Callback>
+ mNavigationMessageBridge = new HashMap<>();
private GnssStatus mGnssStatus;
private int mTimeToFirstFix;
@@ -1392,8 +1398,10 @@
private final GpsStatus.Listener mGpsListener;
private final GpsStatus.NmeaListener mGpsNmeaListener;
- private final GnssStatusCallback mGnssCallback;
- private final GnssNmeaListener mGnssNmeaListener;
+ private final GnssStatusCallback mOldGnssCallback;
+ private final GnssStatus.Callback mGnssCallback;
+ private final GnssNmeaListener mOldGnssNmeaListener;
+ private final OnNmeaMessageListener mGnssNmeaListener;
private class GnssHandler extends Handler {
public GnssHandler(Handler handler) {
@@ -1408,7 +1416,7 @@
int length = mNmeaBuffer.size();
for (int i = 0; i < length; i++) {
Nmea nmea = mNmeaBuffer.get(i);
- mGnssNmeaListener.onNmeaReceived(nmea.mTimestamp, nmea.mNmea);
+ mGnssNmeaListener.onNmeaMessage(nmea.mNmea, nmea.mTimestamp);
}
mNmeaBuffer.clear();
}
@@ -1456,7 +1464,8 @@
mGnssHandler = new GnssHandler(handler);
mGpsNmeaListener = null;
mNmeaBuffer = null;
- mGnssCallback = new GnssStatusCallback() {
+ mOldGnssCallback = null;
+ mGnssCallback = new GnssStatus.Callback() {
@Override
public void onStarted() {
mGpsListener.onGpsStatusChanged(GpsStatus.GPS_EVENT_STARTED);
@@ -1477,6 +1486,7 @@
mGpsListener.onGpsStatusChanged(GpsStatus.GPS_EVENT_SATELLITE_STATUS);
}
};
+ mOldGnssNmeaListener = null;
mGnssNmeaListener = null;
}
@@ -1489,10 +1499,12 @@
mGnssHandler = new GnssHandler(handler);
mGpsNmeaListener = listener;
mNmeaBuffer = new ArrayList<Nmea>();
+ mOldGnssCallback = null;
mGnssCallback = null;
- mGnssNmeaListener = new GnssNmeaListener() {
+ mOldGnssNmeaListener = null;
+ mGnssNmeaListener = new OnNmeaMessageListener() {
@Override
- public void onNmeaReceived(long timestamp, String nmea) {
+ public void onNmeaMessage(String nmea, long timestamp) {
mGpsNmeaListener.onNmeaReceived(timestamp, nmea);
}
};
@@ -1503,8 +1515,45 @@
}
GnssStatusListenerTransport(GnssStatusCallback callback, Handler handler) {
+ mOldGnssCallback = callback;
+ mGnssCallback = new GnssStatus.Callback() {
+ @Override
+ public void onStarted() {
+ mOldGnssCallback.onStarted();
+ }
+
+ @Override
+ public void onStopped() {
+ mOldGnssCallback.onStopped();
+ }
+
+ @Override
+ public void onFirstFix(int ttff) {
+ mOldGnssCallback.onFirstFix(ttff);
+ }
+
+ @Override
+ public void onSatelliteStatusChanged(GnssStatus status) {
+ mOldGnssCallback.onSatelliteStatusChanged(status);
+ }
+ };
+ mGnssHandler = new GnssHandler(handler);
+ mOldGnssNmeaListener = null;
+ mGnssNmeaListener = null;
+ mNmeaBuffer = null;
+ mGpsListener = null;
+ mGpsNmeaListener = null;
+ }
+
+ GnssStatusListenerTransport(GnssStatus.Callback callback) {
+ this(callback, null);
+ }
+
+ GnssStatusListenerTransport(GnssStatus.Callback callback, Handler handler) {
+ mOldGnssCallback = null;
mGnssCallback = callback;
mGnssHandler = new GnssHandler(handler);
+ mOldGnssNmeaListener = null;
mGnssNmeaListener = null;
mNmeaBuffer = null;
mGpsListener = null;
@@ -1517,7 +1566,29 @@
GnssStatusListenerTransport(GnssNmeaListener listener, Handler handler) {
mGnssCallback = null;
+ mOldGnssCallback = null;
mGnssHandler = new GnssHandler(handler);
+ mOldGnssNmeaListener = listener;
+ mGnssNmeaListener = new OnNmeaMessageListener() {
+ @Override
+ public void onNmeaMessage(String message, long timestamp) {
+ mOldGnssNmeaListener.onNmeaReceived(timestamp, message);
+ }
+ };
+ mGpsListener = null;
+ mGpsNmeaListener = null;
+ mNmeaBuffer = new ArrayList<Nmea>();
+ }
+
+ GnssStatusListenerTransport(OnNmeaMessageListener listener) {
+ this(listener, null);
+ }
+
+ GnssStatusListenerTransport(OnNmeaMessageListener listener, Handler handler) {
+ mOldGnssCallback = null;
+ mGnssCallback = null;
+ mGnssHandler = new GnssHandler(handler);
+ mOldGnssNmeaListener = null;
mGnssNmeaListener = listener;
mGpsListener = null;
mGpsNmeaListener = null;
@@ -1589,7 +1660,7 @@
* @return true if the listener was successfully added
*
* @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
- * @deprecated use {@link #registerGnssStatusCallback(GnssStatusCallback)} instead.
+ * @deprecated use {@link #registerGnssStatusCallback(GnssStatus.Callback)} instead.
*/
@Deprecated
@RequiresPermission(ACCESS_FINE_LOCATION)
@@ -1617,6 +1688,7 @@
* Removes a GPS status listener.
*
* @param listener GPS status listener object to remove
+ * @deprecated use {@link #unregisterGnssStatusCallback(GnssStatus.Callback)} instead.
*/
@Deprecated
public void removeGpsStatusListener(GpsStatus.Listener listener) {
@@ -1630,7 +1702,6 @@
}
}
-
/**
* Registers a GNSS status listener.
*
@@ -1639,6 +1710,7 @@
* @return true if the listener was successfully added
*
* @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
+ * @removed
*/
@RequiresPermission(ACCESS_FINE_LOCATION)
public boolean registerGnssStatusCallback(GnssStatusCallback callback) {
@@ -1654,10 +1726,73 @@
* @return true if the listener was successfully added
*
* @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
+ * @removed
*/
@RequiresPermission(ACCESS_FINE_LOCATION)
public boolean registerGnssStatusCallback(GnssStatusCallback callback, Handler handler) {
boolean result;
+ if (mOldGnssStatusListeners.get(callback) != null) {
+ // listener is already registered
+ return true;
+ }
+ try {
+ GnssStatusListenerTransport transport =
+ new GnssStatusListenerTransport(callback, handler);
+ result = mService.registerGnssStatusCallback(transport, mContext.getPackageName());
+ if (result) {
+ mOldGnssStatusListeners.put(callback, transport);
+ }
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+
+ return result;
+ }
+
+ /**
+ * Removes a GNSS status listener.
+ *
+ * @param callback GNSS status listener object to remove
+ * @removed
+ */
+ public void unregisterGnssStatusCallback(GnssStatusCallback callback) {
+ try {
+ GnssStatusListenerTransport transport = mOldGnssStatusListeners.remove(callback);
+ if (transport != null) {
+ mService.unregisterGnssStatusCallback(transport);
+ }
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Registers a GNSS status listener.
+ *
+ * @param callback GNSS status listener object to register
+ *
+ * @return true if the listener was successfully added
+ *
+ * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
+ */
+ @RequiresPermission(ACCESS_FINE_LOCATION)
+ public boolean registerGnssStatusCallback(GnssStatus.Callback callback) {
+ return registerGnssStatusCallback(callback, null);
+ }
+
+ /**
+ * Registers a GNSS status listener.
+ *
+ * @param callback GNSS status listener object to register
+ * @param handler the handler that the callback runs on.
+ *
+ * @return true if the listener was successfully added
+ *
+ * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
+ */
+ @RequiresPermission(ACCESS_FINE_LOCATION)
+ public boolean registerGnssStatusCallback(GnssStatus.Callback callback, Handler handler) {
+ boolean result;
if (mGnssStatusListeners.get(callback) != null) {
// listener is already registered
return true;
@@ -1681,7 +1816,7 @@
*
* @param callback GNSS status listener object to remove
*/
- public void unregisterGnssStatusCallback(GnssStatusCallback callback) {
+ public void unregisterGnssStatusCallback(GnssStatus.Callback callback) {
try {
GnssStatusListenerTransport transport = mGnssStatusListeners.remove(callback);
if (transport != null) {
@@ -1700,7 +1835,7 @@
* @return true if the listener was successfully added
*
* @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
- * @deprecated use {@link #addNmeaListener(GnssNmeaListener)} instead.
+ * @deprecated use {@link #addNmeaListener(OnNmeaMessageListener)} instead.
*/
@Deprecated
@RequiresPermission(ACCESS_FINE_LOCATION)
@@ -1728,6 +1863,7 @@
* Removes an NMEA listener.
*
* @param listener a {@link GpsStatus.NmeaListener} object to remove
+ * @deprecated use {@link #removeNmeaListener(OnNmeaMessageListener)} instead.
*/
@Deprecated
public void removeNmeaListener(GpsStatus.NmeaListener listener) {
@@ -1749,6 +1885,7 @@
* @return true if the listener was successfully added
*
* @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
+ * @removed
*/
@RequiresPermission(ACCESS_FINE_LOCATION)
public boolean addNmeaListener(GnssNmeaListener listener) {
@@ -1764,6 +1901,7 @@
* @return true if the listener was successfully added
*
* @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
+ * @removed
*/
@RequiresPermission(ACCESS_FINE_LOCATION)
public boolean addNmeaListener(GnssNmeaListener listener, Handler handler) {
@@ -1778,6 +1916,69 @@
new GnssStatusListenerTransport(listener, handler);
result = mService.registerGnssStatusCallback(transport, mContext.getPackageName());
if (result) {
+ mOldGnssNmeaListeners.put(listener, transport);
+ }
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+
+ return result;
+ }
+
+ /**
+ * Removes an NMEA listener.
+ *
+ * @param listener a {@link GnssNmeaListener} object to remove
+ * @removed
+ */
+ public void removeNmeaListener(GnssNmeaListener listener) {
+ try {
+ GnssStatusListenerTransport transport = mOldGnssNmeaListeners.remove(listener);
+ if (transport != null) {
+ mService.unregisterGnssStatusCallback(transport);
+ }
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Adds an NMEA listener.
+ *
+ * @param listener a {@link OnNmeaMessageListener} object to register
+ *
+ * @return true if the listener was successfully added
+ *
+ * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
+ */
+ @RequiresPermission(ACCESS_FINE_LOCATION)
+ public boolean addNmeaListener(OnNmeaMessageListener listener) {
+ return addNmeaListener(listener, null);
+ }
+
+ /**
+ * Adds an NMEA listener.
+ *
+ * @param listener a {@link OnNmeaMessageListener} object to register
+ * @param handler the handler that the listener runs on.
+ *
+ * @return true if the listener was successfully added
+ *
+ * @throws SecurityException if the ACCESS_FINE_LOCATION permission is not present
+ */
+ @RequiresPermission(ACCESS_FINE_LOCATION)
+ public boolean addNmeaListener(OnNmeaMessageListener listener, Handler handler) {
+ boolean result;
+
+ if (mGpsNmeaListeners.get(listener) != null) {
+ // listener is already registered
+ return true;
+ }
+ try {
+ GnssStatusListenerTransport transport =
+ new GnssStatusListenerTransport(listener, handler);
+ result = mService.registerGnssStatusCallback(transport, mContext.getPackageName());
+ if (result) {
mGnssNmeaListeners.put(listener, transport);
}
} catch (RemoteException e) {
@@ -1790,9 +1991,9 @@
/**
* Removes an NMEA listener.
*
- * @param listener a {@link GnssNmeaListener} object to remove
+ * @param listener a {@link OnNmeaMessageListener} object to remove
*/
- public void removeNmeaListener(GnssNmeaListener listener) {
+ public void removeNmeaListener(OnNmeaMessageListener listener) {
try {
GnssStatusListenerTransport transport = mGnssNmeaListeners.remove(listener);
if (transport != null) {
@@ -1843,7 +2044,8 @@
* No-op method to keep backward-compatibility.
* Don't use it. Use {@link #unregisterGnssMeasurementsCallback} instead.
* @hide
- * @deprecated
+ * @deprecated use {@link #unregisterGnssMeasurementsCallback(GnssMeasurementsEvent.Callback)}
+ * instead.
*/
@Deprecated
@SystemApi
@@ -1872,10 +2074,23 @@
}
/**
- * Registers a GPS Navigation Message callback.
+ * No-op method to keep backward-compatibility.
+ * Don't use it. Use {@link #unregisterGnssNavigationMessageCallback} instead.
+ * @hide
+ * @deprecated use {@link #unregisterGnssNavigationMessageCallback(GnssMeasurements.Callback)}
+ * instead
+ */
+ @Deprecated
+ @SystemApi
+ public void removeGpsNavigationMessageListener(GpsNavigationMessageEvent.Listener listener) {
+ }
+
+ /**
+ * Registers a GNSS Navigation Message callback.
*
* @param callback a {@link GnssNavigationMessageEvent.Callback} object to register.
* @return {@code true} if the callback was added successfully, {@code false} otherwise.
+ * @removed
*/
public boolean registerGnssNavigationMessageCallback(
GnssNavigationMessageEvent.Callback callback) {
@@ -1883,40 +2098,80 @@
}
/**
- * Registers a GPS Navigation Message callback.
+ * Registers a GNSS Navigation Message callback.
*
* @param callback a {@link GnssNavigationMessageEvent.Callback} object to register.
* @param handler the handler that the callback runs on.
* @return {@code true} if the callback was added successfully, {@code false} otherwise.
+ * @removed
+ */
+ @RequiresPermission(ACCESS_FINE_LOCATION)
+ public boolean registerGnssNavigationMessageCallback(
+ final GnssNavigationMessageEvent.Callback callback, Handler handler) {
+ GnssNavigationMessage.Callback bridge = new GnssNavigationMessage.Callback() {
+ @Override
+ public void onGnssNavigationMessageReceived(GnssNavigationMessage message) {
+ GnssNavigationMessageEvent event = new GnssNavigationMessageEvent(message);
+ callback.onGnssNavigationMessageReceived(event);
+ }
+
+ @Override
+ public void onStatusChanged(int status) {
+ callback.onStatusChanged(status);
+ }
+ };
+ mNavigationMessageBridge.put(callback, bridge);
+ return mGnssNavigationMessageCallbackTransport.add(bridge, handler);
+ }
+
+ /**
+ * Unregisters a GNSS Navigation Message callback.
+ *
+ * @param callback a {@link GnssNavigationMessageEvent.Callback} object to remove.
+ * @removed
+ */
+ public void unregisterGnssNavigationMessageCallback(
+ GnssNavigationMessageEvent.Callback callback) {
+ mGnssNavigationMessageCallbackTransport.remove(
+ mNavigationMessageBridge.remove(
+ callback));
+ }
+
+ /**
+ * Registers a GNSS Navigation Message callback.
+ *
+ * @param callback a {@link GnssNavigationMessage.Callback} object to register.
+ * @return {@code true} if the callback was added successfully, {@code false} otherwise.
+ */
+ public boolean registerGnssNavigationMessageCallback(
+ GnssNavigationMessage.Callback callback) {
+ return registerGnssNavigationMessageCallback(callback, null);
+ }
+
+ /**
+ * Registers a GNSS Navigation Message callback.
+ *
+ * @param callback a {@link GnssNavigationMessage.Callback} object to register.
+ * @param handler the handler that the callback runs on.
+ * @return {@code true} if the callback was added successfully, {@code false} otherwise.
*/
@RequiresPermission(ACCESS_FINE_LOCATION)
public boolean registerGnssNavigationMessageCallback(
- GnssNavigationMessageEvent.Callback callback, Handler handler) {
+ GnssNavigationMessage.Callback callback, Handler handler) {
return mGnssNavigationMessageCallbackTransport.add(callback, handler);
}
/**
- * Unregisters a GPS Navigation Message callback.
+ * Unregisters a GNSS Navigation Message callback.
*
- * @param callback a {@link GnssNavigationMessageEvent.Callback} object to remove.
+ * @param callback a {@link GnssNavigationMessage.Callback} object to remove.
*/
public void unregisterGnssNavigationMessageCallback(
- GnssNavigationMessageEvent.Callback callback) {
+ GnssNavigationMessage.Callback callback) {
mGnssNavigationMessageCallbackTransport.remove(callback);
}
/**
- * No-op method to keep backward-compatibility.
- * Don't use it. Use {@link #unregisterGnssNavigationMessageCallback} instead.
- * @hide
- * @deprecated
- */
- @Deprecated
- @SystemApi
- public void removeGpsNavigationMessageListener(GpsNavigationMessageEvent.Listener listener) {
- }
-
- /**
* Retrieves information about the current status of the GPS engine.
* This should only be called from the {@link GpsStatus.Listener#onGpsStatusChanged}
* callback to ensure that the data is copied atomically.
diff --git a/location/java/android/location/OnNmeaMessageListener.java b/location/java/android/location/OnNmeaMessageListener.java
new file mode 100644
index 0000000..ccf6ce8
--- /dev/null
+++ b/location/java/android/location/OnNmeaMessageListener.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.location;
+
+/**
+* Used for receiving NMEA sentences from the GNSS.
+* NMEA 0183 is a standard for communicating with marine electronic devices
+* and is a common method for receiving data from a GNSS, typically over a serial port.
+* See <a href="http://en.wikipedia.org/wiki/NMEA_0183">NMEA 0183</a> for more details.
+* You can implement this interface and call {@link LocationManager#addNmeaListener}
+* to receive NMEA data from the GNSS engine.
+*/
+public interface OnNmeaMessageListener {
+ /**
+ * Called when an NMEA message is received.
+ * @param message NMEA message
+ * @param timestamp milliseconds since January 1, 1970.
+ */
+ void onNmeaMessage(String message, long timestamp);
+}
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index e08fad4..6b916be 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -39,7 +39,7 @@
import android.location.IGnssStatusListener;
import android.location.IGnssStatusProvider;
import android.location.GnssMeasurementsEvent;
-import android.location.GnssNavigationMessageEvent;
+import android.location.GnssNavigationMessage;
import android.location.IGpsGeofenceHardware;
import android.location.ILocationManager;
import android.location.INetInitiatedListener;
@@ -1662,7 +1662,7 @@
/**
* called from native code - GPS navigation message callback
*/
- private void reportNavigationMessage(GnssNavigationMessageEvent event) {
+ private void reportNavigationMessage(GnssNavigationMessage event) {
mGnssNavigationMessageProvider.onNavigationMessageAvailable(event);
}
diff --git a/services/core/java/com/android/server/location/GnssMeasurementsProvider.java b/services/core/java/com/android/server/location/GnssMeasurementsProvider.java
index 734a8d4..caf1d6c 100644
--- a/services/core/java/com/android/server/location/GnssMeasurementsProvider.java
+++ b/services/core/java/com/android/server/location/GnssMeasurementsProvider.java
@@ -64,15 +64,15 @@
int status;
switch (result) {
case RESULT_SUCCESS:
- status = GnssMeasurementsEvent.STATUS_READY;
+ status = GnssMeasurementsEvent.Callback.STATUS_READY;
break;
case RESULT_NOT_AVAILABLE:
case RESULT_NOT_SUPPORTED:
case RESULT_INTERNAL_ERROR:
- status = GnssMeasurementsEvent.STATUS_NOT_SUPPORTED;
+ status = GnssMeasurementsEvent.Callback.STATUS_NOT_SUPPORTED;
break;
case RESULT_GPS_LOCATION_DISABLED:
- status = GnssMeasurementsEvent.STATUS_GNSS_LOCATION_DISABLED;
+ status = GnssMeasurementsEvent.Callback.STATUS_LOCATION_DISABLED;
break;
case RESULT_UNKNOWN:
return null;
diff --git a/services/core/java/com/android/server/location/GnssNavigationMessageProvider.java b/services/core/java/com/android/server/location/GnssNavigationMessageProvider.java
index fdef31f..8d21928 100644
--- a/services/core/java/com/android/server/location/GnssNavigationMessageProvider.java
+++ b/services/core/java/com/android/server/location/GnssNavigationMessageProvider.java
@@ -16,7 +16,7 @@
package com.android.server.location;
-import android.location.GnssNavigationMessageEvent;
+import android.location.GnssNavigationMessage;
import android.location.IGnssNavigationMessageListener;
import android.os.Handler;
import android.os.RemoteException;
@@ -37,7 +37,7 @@
super(handler, TAG);
}
- public void onNavigationMessageAvailable(final GnssNavigationMessageEvent event) {
+ public void onNavigationMessageAvailable(final GnssNavigationMessage event) {
ListenerOperation<IGnssNavigationMessageListener> operation =
new ListenerOperation<IGnssNavigationMessageListener>() {
@Override
@@ -65,16 +65,15 @@
int status;
switch (result) {
case RESULT_SUCCESS:
- status = GnssNavigationMessageEvent.STATUS_READY;
+ status = GnssNavigationMessage.Callback.STATUS_READY;
break;
case RESULT_NOT_AVAILABLE:
case RESULT_NOT_SUPPORTED:
case RESULT_INTERNAL_ERROR:
- status = GnssNavigationMessageEvent.STATUS_NOT_SUPPORTED;
+ status = GnssNavigationMessage.Callback.STATUS_NOT_SUPPORTED;
break;
case RESULT_GPS_LOCATION_DISABLED:
- status = GnssNavigationMessageEvent
- .STATUS_GNSS_LOCATION_DISABLED;
+ status = GnssNavigationMessage.Callback.STATUS_LOCATION_DISABLED;
break;
case RESULT_UNKNOWN:
return null;