Merge changes from topic 'API renaming'

* changes:
  Worked around the crash caused by API renaming
  Rename Gps to Gnss for measurement-related APIs
This commit is contained in:
Lifu Tang
2016-02-03 02:08:28 +00:00
committed by Android (Google) Code Review
27 changed files with 3429 additions and 634 deletions

View File

@ -336,8 +336,8 @@ LOCAL_SRC_FILES += \
location/java/android/location/IGeofenceProvider.aidl \
location/java/android/location/IGnssStatusListener.aidl \
location/java/android/location/IGnssStatusProvider.aidl \
location/java/android/location/IGpsMeasurementsListener.aidl \
location/java/android/location/IGpsNavigationMessageListener.aidl \
location/java/android/location/IGnssMeasurementsListener.aidl \
location/java/android/location/IGnssNavigationMessageListener.aidl \
location/java/android/location/ILocationListener.aidl \
location/java/android/location/ILocationManager.aidl \
location/java/android/location/IFusedGeofenceHardware.aidl \

View File

@ -19115,38 +19115,7 @@ package android.location {
method public static boolean isPresent();
}
public abstract interface GnssNmeaListener {
method public abstract void onNmeaReceived(long, java.lang.String);
}
public final class GnssStatus {
method public float getAzimuth(int);
method public int getConstellationType(int);
method public float getElevation(int);
method public int getNumSatellites();
method public int getPrn(int);
method public float getSnr(int);
method public boolean hasAlmanac(int);
method public boolean hasEphemeris(int);
method public boolean usedInFix(int);
field public static final int CONSTELLATION_BEIDOU = 5; // 0x5
field public static final int CONSTELLATION_GALILEO = 6; // 0x6
field public static final int CONSTELLATION_GLONASS = 3; // 0x3
field public static final int CONSTELLATION_GPS = 1; // 0x1
field public static final int CONSTELLATION_QZSS = 4; // 0x4
field public static final int CONSTELLATION_SBAS = 2; // 0x2
field public static final int CONSTELLATION_UNKNOWN = 0; // 0x0
}
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 final class GpsClock implements android.os.Parcelable {
public final class GnssClock implements android.os.Parcelable {
method public int describeContents();
method public double getBiasInNs();
method public double getBiasUncertaintyInNs();
@ -19173,7 +19142,7 @@ package android.location {
method public void resetFullBiasInNs();
method public void resetLeapSecond();
method public void resetTimeUncertaintyInNs();
method public void set(android.location.GpsClock);
method public void set(android.location.GnssClock);
method public void setBiasInNs(double);
method public void setBiasUncertaintyInNs(double);
method public void setDriftInNsPerSec(double);
@ -19188,13 +19157,13 @@ package android.location {
field public static final byte CLOCK_TYPE_GPS_TIME = 2; // 0x2
field public static final byte CLOCK_TYPE_LOCAL_HW_TIME = 1; // 0x1
field public static final byte CLOCK_TYPE_UNKNOWN = 0; // 0x0
field public static final android.os.Parcelable.Creator<android.location.GpsClock> CREATOR;
field public static final android.os.Parcelable.Creator<android.location.GnssClock> CREATOR;
}
public static abstract class GpsClock.GpsClockType implements java.lang.annotation.Annotation {
public static abstract class GnssClock.GnssClockType implements java.lang.annotation.Annotation {
}
public final class GpsMeasurement implements android.os.Parcelable {
public final class GnssMeasurement implements android.os.Parcelable {
method public int describeContents();
method public double getAccumulatedDeltaRangeInMeters();
method public short getAccumulatedDeltaRangeState();
@ -19265,7 +19234,7 @@ package android.location {
method public void resetPseudorangeUncertaintyInMeters();
method public void resetSnrInDb();
method public void resetTimeFromLastBitInMs();
method public void set(android.location.GpsMeasurement);
method public void set(android.location.GnssMeasurement);
method public void setAccumulatedDeltaRangeInMeters(double);
method public void setAccumulatedDeltaRangeState(short);
method public void setAccumulatedDeltaRangeUncertaintyInMeters(double);
@ -19304,7 +19273,7 @@ package android.location {
field public static final short ADR_STATE_RESET = 2; // 0x2
field public static final short ADR_STATE_UNKNOWN = 0; // 0x0
field public static final short ADR_STATE_VALID = 1; // 0x1
field public static final android.os.Parcelable.Creator<android.location.GpsMeasurement> CREATOR;
field public static final android.os.Parcelable.Creator<android.location.GnssMeasurement> CREATOR;
field public static final byte LOSS_OF_LOCK_CYCLE_SLIP = 2; // 0x2
field public static final byte LOSS_OF_LOCK_OK = 1; // 0x1
field public static final byte LOSS_OF_LOCK_UNKNOWN = 0; // 0x0
@ -19319,34 +19288,34 @@ package android.location {
field public static final short STATE_UNKNOWN = 0; // 0x0
}
public static abstract class GpsMeasurement.LossOfLockStatus implements java.lang.annotation.Annotation {
public static abstract class GnssMeasurement.LossOfLockStatus implements java.lang.annotation.Annotation {
}
public static abstract class GpsMeasurement.MultipathIndicator implements java.lang.annotation.Annotation {
public static abstract class GnssMeasurement.MultipathIndicator implements java.lang.annotation.Annotation {
}
public final class GpsMeasurementsEvent implements android.os.Parcelable {
ctor public GpsMeasurementsEvent(android.location.GpsClock, android.location.GpsMeasurement[]);
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.GpsClock getClock();
method public java.util.Collection<android.location.GpsMeasurement> getMeasurements();
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.GpsMeasurementsEvent> CREATOR;
field public static final android.os.Parcelable.Creator<android.location.GnssMeasurementsEvent> CREATOR;
field public static final int STATUS_GPS_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 GpsMeasurementsEvent.Callback {
ctor public GpsMeasurementsEvent.Callback();
method public void onGpsMeasurementsReceived(android.location.GpsMeasurementsEvent);
public static abstract class GnssMeasurementsEvent.Callback {
ctor public GnssMeasurementsEvent.Callback();
method public void onGnssMeasurementsReceived(android.location.GnssMeasurementsEvent);
method public void onStatusChanged(int);
}
public static abstract class GpsMeasurementsEvent.GpsMeasurementsStatus implements java.lang.annotation.Annotation {
public static abstract class GnssMeasurementsEvent.GnssMeasurementsStatus implements java.lang.annotation.Annotation {
}
public final class GpsNavigationMessage implements android.os.Parcelable {
public final class GnssNavigationMessage implements android.os.Parcelable {
method public int describeContents();
method public byte[] getData();
method public short getMessageId();
@ -19355,7 +19324,7 @@ package android.location {
method public short getSubmessageId();
method public byte getType();
method public void reset();
method public void set(android.location.GpsNavigationMessage);
method public void set(android.location.GnssNavigationMessage);
method public void setData(byte[]);
method public void setMessageId(short);
method public void setPrn(byte);
@ -19363,7 +19332,7 @@ package android.location {
method public void setSubmessageId(short);
method public void setType(byte);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.location.GpsNavigationMessage> CREATOR;
field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessage> CREATOR;
field public static final byte MESSAGE_TYPE_CNAV2 = 4; // 0x4
field public static final byte MESSAGE_TYPE_L1CA = 1; // 0x1
field public static final byte MESSAGE_TYPE_L2CNAV = 2; // 0x2
@ -19374,27 +19343,58 @@ package android.location {
field public static final short STATUS_UNKNOWN = 0; // 0x0
}
public static abstract class GpsNavigationMessage.GpsNavigationMessageType implements java.lang.annotation.Annotation {
public static abstract class GnssNavigationMessage.GnssNavigationMessageType implements java.lang.annotation.Annotation {
}
public final class GpsNavigationMessageEvent implements android.os.Parcelable {
ctor public GpsNavigationMessageEvent(android.location.GpsNavigationMessage);
public final class GnssNavigationMessageEvent implements android.os.Parcelable {
ctor public GnssNavigationMessageEvent(android.location.GnssNavigationMessage);
method public int describeContents();
method public android.location.GpsNavigationMessage getNavigationMessage();
method public android.location.GnssNavigationMessage getNavigationMessage();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.location.GpsNavigationMessageEvent> CREATOR;
field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessageEvent> CREATOR;
field public static final int STATUS_GPS_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 GpsNavigationMessageEvent.Callback {
ctor public GpsNavigationMessageEvent.Callback();
method public void onGpsNavigationMessageReceived(android.location.GpsNavigationMessageEvent);
public static abstract class GnssNavigationMessageEvent.Callback {
ctor public GnssNavigationMessageEvent.Callback();
method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessageEvent);
method public void onStatusChanged(int);
}
public static abstract class GpsNavigationMessageEvent.GpsNavigationMessageStatus implements java.lang.annotation.Annotation {
public static abstract class GnssNavigationMessageEvent.GnssNavigationMessageStatus implements java.lang.annotation.Annotation {
}
public abstract interface GnssNmeaListener {
method public abstract void onNmeaReceived(long, java.lang.String);
}
public final class GnssStatus {
method public float getAzimuth(int);
method public int getConstellationType(int);
method public float getElevation(int);
method public int getNumSatellites();
method public int getPrn(int);
method public float getSnr(int);
method public boolean hasAlmanac(int);
method public boolean hasEphemeris(int);
method public boolean usedInFix(int);
field public static final int CONSTELLATION_BEIDOU = 5; // 0x5
field public static final int CONSTELLATION_GALILEO = 6; // 0x6
field public static final int CONSTELLATION_GLONASS = 3; // 0x3
field public static final int CONSTELLATION_GPS = 1; // 0x1
field public static final int CONSTELLATION_QZSS = 4; // 0x4
field public static final int CONSTELLATION_SBAS = 2; // 0x2
field public static final int CONSTELLATION_UNKNOWN = 0; // 0x0
}
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 final class GpsSatellite {
@ -19498,12 +19498,12 @@ package android.location {
method public java.util.List<java.lang.String> getProviders(boolean);
method public java.util.List<java.lang.String> getProviders(android.location.Criteria, boolean);
method public boolean isProviderEnabled(java.lang.String);
method public boolean registerGnssMeasurementCallback(android.location.GnssMeasurementsEvent.Callback);
method public boolean registerGnssMeasurementCallback(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 registerGpsMeasurementCallback(android.location.GpsMeasurementsEvent.Callback);
method public boolean registerGpsMeasurementCallback(android.location.GpsMeasurementsEvent.Callback, android.os.Handler);
method public boolean registerGpsNavigationMessageCallback(android.location.GpsNavigationMessageEvent.Callback);
method public boolean registerGpsNavigationMessageCallback(android.location.GpsNavigationMessageEvent.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);
@ -19524,9 +19524,9 @@ package android.location {
method public void setTestProviderEnabled(java.lang.String, boolean);
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 unregisterGnssMeasurementCallback(android.location.GnssMeasurementsEvent.Callback);
method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
method public void unregisterGnssStatusCallback(android.location.GnssStatusCallback);
method public void unregisterGpsMeasurementCallback(android.location.GpsMeasurementsEvent.Callback);
method public void unregisterGpsNavigationMessageCallback(android.location.GpsNavigationMessageEvent.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";

View File

@ -20296,38 +20296,7 @@ package android.location {
method public static boolean isPresent();
}
public abstract interface GnssNmeaListener {
method public abstract void onNmeaReceived(long, java.lang.String);
}
public final class GnssStatus {
method public float getAzimuth(int);
method public int getConstellationType(int);
method public float getElevation(int);
method public int getNumSatellites();
method public int getPrn(int);
method public float getSnr(int);
method public boolean hasAlmanac(int);
method public boolean hasEphemeris(int);
method public boolean usedInFix(int);
field public static final int CONSTELLATION_BEIDOU = 5; // 0x5
field public static final int CONSTELLATION_GALILEO = 6; // 0x6
field public static final int CONSTELLATION_GLONASS = 3; // 0x3
field public static final int CONSTELLATION_GPS = 1; // 0x1
field public static final int CONSTELLATION_QZSS = 4; // 0x4
field public static final int CONSTELLATION_SBAS = 2; // 0x2
field public static final int CONSTELLATION_UNKNOWN = 0; // 0x0
}
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 final class GpsClock implements android.os.Parcelable {
public final class GnssClock implements android.os.Parcelable {
method public int describeContents();
method public double getBiasInNs();
method public double getBiasUncertaintyInNs();
@ -20354,7 +20323,7 @@ package android.location {
method public void resetFullBiasInNs();
method public void resetLeapSecond();
method public void resetTimeUncertaintyInNs();
method public void set(android.location.GpsClock);
method public void set(android.location.GnssClock);
method public void setBiasInNs(double);
method public void setBiasUncertaintyInNs(double);
method public void setDriftInNsPerSec(double);
@ -20369,13 +20338,13 @@ package android.location {
field public static final byte CLOCK_TYPE_GPS_TIME = 2; // 0x2
field public static final byte CLOCK_TYPE_LOCAL_HW_TIME = 1; // 0x1
field public static final byte CLOCK_TYPE_UNKNOWN = 0; // 0x0
field public static final android.os.Parcelable.Creator<android.location.GpsClock> CREATOR;
field public static final android.os.Parcelable.Creator<android.location.GnssClock> CREATOR;
}
public static abstract class GpsClock.GpsClockType implements java.lang.annotation.Annotation {
public static abstract class GnssClock.GnssClockType implements java.lang.annotation.Annotation {
}
public final class GpsMeasurement implements android.os.Parcelable {
public final class GnssMeasurement implements android.os.Parcelable {
method public int describeContents();
method public double getAccumulatedDeltaRangeInMeters();
method public short getAccumulatedDeltaRangeState();
@ -20446,7 +20415,7 @@ package android.location {
method public void resetPseudorangeUncertaintyInMeters();
method public void resetSnrInDb();
method public void resetTimeFromLastBitInMs();
method public void set(android.location.GpsMeasurement);
method public void set(android.location.GnssMeasurement);
method public void setAccumulatedDeltaRangeInMeters(double);
method public void setAccumulatedDeltaRangeState(short);
method public void setAccumulatedDeltaRangeUncertaintyInMeters(double);
@ -20485,6 +20454,279 @@ package android.location {
field public static final short ADR_STATE_RESET = 2; // 0x2
field public static final short ADR_STATE_UNKNOWN = 0; // 0x0
field public static final short ADR_STATE_VALID = 1; // 0x1
field public static final android.os.Parcelable.Creator<android.location.GnssMeasurement> CREATOR;
field public static final byte LOSS_OF_LOCK_CYCLE_SLIP = 2; // 0x2
field public static final byte LOSS_OF_LOCK_OK = 1; // 0x1
field public static final byte LOSS_OF_LOCK_UNKNOWN = 0; // 0x0
field public static final byte MULTIPATH_INDICATOR_DETECTED = 1; // 0x1
field public static final byte MULTIPATH_INDICATOR_NOT_USED = 2; // 0x2
field public static final byte MULTIPATH_INDICATOR_UNKNOWN = 0; // 0x0
field public static final short STATE_BIT_SYNC = 2; // 0x2
field public static final short STATE_CODE_LOCK = 1; // 0x1
field public static final short STATE_MSEC_AMBIGUOUS = 16; // 0x10
field public static final short STATE_SUBFRAME_SYNC = 4; // 0x4
field public static final short STATE_TOW_DECODED = 8; // 0x8
field public static final short STATE_UNKNOWN = 0; // 0x0
}
public static abstract class GnssMeasurement.LossOfLockStatus implements java.lang.annotation.Annotation {
}
public static abstract class GnssMeasurement.MultipathIndicator implements java.lang.annotation.Annotation {
}
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_GPS_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);
}
public static abstract class GnssMeasurementsEvent.GnssMeasurementsStatus implements java.lang.annotation.Annotation {
}
public final class GnssNavigationMessage implements android.os.Parcelable {
method public int describeContents();
method public byte[] getData();
method public short getMessageId();
method public byte getPrn();
method public short getStatus();
method public short getSubmessageId();
method public byte getType();
method public void reset();
method public void set(android.location.GnssNavigationMessage);
method public void setData(byte[]);
method public void setMessageId(short);
method public void setPrn(byte);
method public void setStatus(short);
method public void setSubmessageId(short);
method public void setType(byte);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessage> CREATOR;
field public static final byte MESSAGE_TYPE_CNAV2 = 4; // 0x4
field public static final byte MESSAGE_TYPE_L1CA = 1; // 0x1
field public static final byte MESSAGE_TYPE_L2CNAV = 2; // 0x2
field public static final byte MESSAGE_TYPE_L5CNAV = 3; // 0x3
field public static final byte MESSAGE_TYPE_UNKNOWN = 0; // 0x0
field public static final short STATUS_PARITY_PASSED = 1; // 0x1
field public static final short STATUS_PARITY_REBUILT = 2; // 0x2
field public static final short STATUS_UNKNOWN = 0; // 0x0
}
public static abstract class GnssNavigationMessage.GnssNavigationMessageType implements java.lang.annotation.Annotation {
}
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_GPS_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 static abstract class GnssNavigationMessageEvent.GnssNavigationMessageStatus implements java.lang.annotation.Annotation {
}
public abstract interface GnssNmeaListener {
method public abstract void onNmeaReceived(long, java.lang.String);
}
public final class GnssStatus {
method public float getAzimuth(int);
method public int getConstellationType(int);
method public float getElevation(int);
method public int getNumSatellites();
method public int getPrn(int);
method public float getSnr(int);
method public boolean hasAlmanac(int);
method public boolean hasEphemeris(int);
method public boolean usedInFix(int);
field public static final int CONSTELLATION_BEIDOU = 5; // 0x5
field public static final int CONSTELLATION_GALILEO = 6; // 0x6
field public static final int CONSTELLATION_GLONASS = 3; // 0x3
field public static final int CONSTELLATION_GPS = 1; // 0x1
field public static final int CONSTELLATION_QZSS = 4; // 0x4
field public static final int CONSTELLATION_SBAS = 2; // 0x2
field public static final int CONSTELLATION_UNKNOWN = 0; // 0x0
}
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 GpsClock implements android.os.Parcelable {
method public int describeContents();
method public double getBiasInNs();
method public double getBiasUncertaintyInNs();
method public double getDriftInNsPerSec();
method public double getDriftUncertaintyInNsPerSec();
method public long getFullBiasInNs();
method public short getLeapSecond();
method public long getTimeInNs();
method public double getTimeUncertaintyInNs();
method public byte getType();
method public boolean hasBiasInNs();
method public boolean hasBiasUncertaintyInNs();
method public boolean hasDriftInNsPerSec();
method public boolean hasDriftUncertaintyInNsPerSec();
method public boolean hasFullBiasInNs();
method public boolean hasLeapSecond();
method public boolean hasTimeUncertaintyInNs();
method public void reset();
method public void resetBiasInNs();
method public void resetBiasUncertaintyInNs();
method public void resetDriftInNsPerSec();
method public void resetDriftUncertaintyInNsPerSec();
method public void resetFullBiasInNs();
method public void resetLeapSecond();
method public void resetTimeUncertaintyInNs();
method public void set(android.location.GpsClock);
method public void setBiasInNs(double);
method public void setBiasUncertaintyInNs(double);
method public void setDriftInNsPerSec(double);
method public void setDriftUncertaintyInNsPerSec(double);
method public void setFullBiasInNs(long);
method public void setLeapSecond(short);
method public void setTimeInNs(long);
method public void setTimeUncertaintyInNs(double);
method public void setType(byte);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.location.GpsClock> CREATOR;
field public static final byte TYPE_GPS_TIME = 2; // 0x2
field public static final byte TYPE_LOCAL_HW_TIME = 1; // 0x1
field public static final byte TYPE_UNKNOWN = 0; // 0x0
}
public class GpsMeasurement implements android.os.Parcelable {
method public int describeContents();
method public double getAccumulatedDeltaRangeInMeters();
method public short getAccumulatedDeltaRangeState();
method public double getAccumulatedDeltaRangeUncertaintyInMeters();
method public double getAzimuthInDeg();
method public double getAzimuthUncertaintyInDeg();
method public int getBitNumber();
method public long getCarrierCycles();
method public float getCarrierFrequencyInHz();
method public double getCarrierPhase();
method public double getCarrierPhaseUncertainty();
method public double getCn0InDbHz();
method public double getCodePhaseInChips();
method public double getCodePhaseUncertaintyInChips();
method public double getDopplerShiftInHz();
method public double getDopplerShiftUncertaintyInHz();
method public double getElevationInDeg();
method public double getElevationUncertaintyInDeg();
method public byte getLossOfLock();
method public byte getMultipathIndicator();
method public byte getPrn();
method public double getPseudorangeInMeters();
method public double getPseudorangeRateInMetersPerSec();
method public double getPseudorangeRateUncertaintyInMetersPerSec();
method public double getPseudorangeUncertaintyInMeters();
method public long getReceivedGpsTowInNs();
method public long getReceivedGpsTowUncertaintyInNs();
method public double getSnrInDb();
method public short getState();
method public short getTimeFromLastBitInMs();
method public double getTimeOffsetInNs();
method public boolean hasAzimuthInDeg();
method public boolean hasAzimuthUncertaintyInDeg();
method public boolean hasBitNumber();
method public boolean hasCarrierCycles();
method public boolean hasCarrierFrequencyInHz();
method public boolean hasCarrierPhase();
method public boolean hasCarrierPhaseUncertainty();
method public boolean hasCodePhaseInChips();
method public boolean hasCodePhaseUncertaintyInChips();
method public boolean hasDopplerShiftInHz();
method public boolean hasDopplerShiftUncertaintyInHz();
method public boolean hasElevationInDeg();
method public boolean hasElevationUncertaintyInDeg();
method public boolean hasPseudorangeInMeters();
method public boolean hasPseudorangeUncertaintyInMeters();
method public boolean hasSnrInDb();
method public boolean hasTimeFromLastBitInMs();
method public boolean isPseudorangeRateCorrected();
method public boolean isUsedInFix();
method public void reset();
method public void resetAzimuthInDeg();
method public void resetAzimuthUncertaintyInDeg();
method public void resetBitNumber();
method public void resetCarrierCycles();
method public void resetCarrierFrequencyInHz();
method public void resetCarrierPhase();
method public void resetCarrierPhaseUncertainty();
method public void resetCodePhaseInChips();
method public void resetCodePhaseUncertaintyInChips();
method public void resetDopplerShiftInHz();
method public void resetDopplerShiftUncertaintyInHz();
method public void resetElevationInDeg();
method public void resetElevationUncertaintyInDeg();
method public void resetPseudorangeInMeters();
method public void resetPseudorangeUncertaintyInMeters();
method public void resetSnrInDb();
method public void resetTimeFromLastBitInMs();
method public void set(android.location.GpsMeasurement);
method public void setAccumulatedDeltaRangeInMeters(double);
method public void setAccumulatedDeltaRangeState(short);
method public void setAccumulatedDeltaRangeUncertaintyInMeters(double);
method public void setAzimuthInDeg(double);
method public void setAzimuthUncertaintyInDeg(double);
method public void setBitNumber(int);
method public void setCarrierCycles(long);
method public void setCarrierFrequencyInHz(float);
method public void setCarrierPhase(double);
method public void setCarrierPhaseUncertainty(double);
method public void setCn0InDbHz(double);
method public void setCodePhaseInChips(double);
method public void setCodePhaseUncertaintyInChips(double);
method public void setDopplerShiftInHz(double);
method public void setDopplerShiftUncertaintyInHz(double);
method public void setElevationInDeg(double);
method public void setElevationUncertaintyInDeg(double);
method public void setLossOfLock(byte);
method public void setMultipathIndicator(byte);
method public void setPrn(byte);
method public void setPseudorangeInMeters(double);
method public void setPseudorangeRateInMetersPerSec(double);
method public void setPseudorangeRateUncertaintyInMetersPerSec(double);
method public void setPseudorangeUncertaintyInMeters(double);
method public void setReceivedGpsTowInNs(long);
method public void setReceivedGpsTowUncertaintyInNs(long);
method public void setSnrInDb(double);
method public void setState(short);
method public void setTimeFromLastBitInMs(short);
method public void setTimeOffsetInNs(double);
method public void setUsedInFix(boolean);
method public void writeToParcel(android.os.Parcel, int);
field public static final short ADR_STATE_CYCLE_SLIP = 4; // 0x4
field public static final short ADR_STATE_RESET = 2; // 0x2
field public static final short ADR_STATE_UNKNOWN = 0; // 0x0
field public static final short ADR_STATE_VALID = 1; // 0x1
field public static final android.os.Parcelable.Creator<android.location.GpsMeasurement> CREATOR;
field public static final byte LOSS_OF_LOCK_CYCLE_SLIP = 2; // 0x2
field public static final byte LOSS_OF_LOCK_OK = 1; // 0x1
@ -20500,13 +20742,7 @@ package android.location {
field public static final short STATE_UNKNOWN = 0; // 0x0
}
public static abstract class GpsMeasurement.LossOfLockStatus implements java.lang.annotation.Annotation {
}
public static abstract class GpsMeasurement.MultipathIndicator implements java.lang.annotation.Annotation {
}
public final class GpsMeasurementsEvent implements android.os.Parcelable {
public class GpsMeasurementsEvent implements android.os.Parcelable {
ctor public GpsMeasurementsEvent(android.location.GpsClock, android.location.GpsMeasurement[]);
method public int describeContents();
method public android.location.GpsClock getClock();
@ -20518,16 +20754,12 @@ package android.location {
field public static final int STATUS_READY = 1; // 0x1
}
public static abstract class GpsMeasurementsEvent.Callback {
ctor public GpsMeasurementsEvent.Callback();
method public void onGpsMeasurementsReceived(android.location.GpsMeasurementsEvent);
method public void onStatusChanged(int);
public static abstract interface GpsMeasurementsEvent.Listener {
method public abstract void onGpsMeasurementsReceived(android.location.GpsMeasurementsEvent);
method public abstract void onStatusChanged(int);
}
public static abstract class GpsMeasurementsEvent.GpsMeasurementsStatus implements java.lang.annotation.Annotation {
}
public final class GpsNavigationMessage implements android.os.Parcelable {
public class GpsNavigationMessage implements android.os.Parcelable {
method public int describeContents();
method public byte[] getData();
method public short getMessageId();
@ -20545,37 +20777,30 @@ package android.location {
method public void setType(byte);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.location.GpsNavigationMessage> CREATOR;
field public static final byte MESSAGE_TYPE_CNAV2 = 4; // 0x4
field public static final byte MESSAGE_TYPE_L1CA = 1; // 0x1
field public static final byte MESSAGE_TYPE_L2CNAV = 2; // 0x2
field public static final byte MESSAGE_TYPE_L5CNAV = 3; // 0x3
field public static final byte MESSAGE_TYPE_UNKNOWN = 0; // 0x0
field public static final short STATUS_PARITY_PASSED = 1; // 0x1
field public static final short STATUS_PARITY_REBUILT = 2; // 0x2
field public static final short STATUS_UNKNOWN = 0; // 0x0
field public static final byte TYPE_CNAV2 = 4; // 0x4
field public static final byte TYPE_L1CA = 1; // 0x1
field public static final byte TYPE_L2CNAV = 2; // 0x2
field public static final byte TYPE_L5CNAV = 3; // 0x3
field public static final byte TYPE_UNKNOWN = 0; // 0x0
}
public static abstract class GpsNavigationMessage.GpsNavigationMessageType implements java.lang.annotation.Annotation {
}
public final class GpsNavigationMessageEvent implements android.os.Parcelable {
public class GpsNavigationMessageEvent implements android.os.Parcelable {
ctor public GpsNavigationMessageEvent(android.location.GpsNavigationMessage);
method public int describeContents();
method public android.location.GpsNavigationMessage getNavigationMessage();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.location.GpsNavigationMessageEvent> CREATOR;
field public static final int STATUS_GPS_LOCATION_DISABLED = 2; // 0x2
field public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
field public static final int STATUS_READY = 1; // 0x1
field public static int STATUS_GPS_LOCATION_DISABLED;
field public static int STATUS_NOT_SUPPORTED;
field public static int STATUS_READY;
}
public static abstract class GpsNavigationMessageEvent.Callback {
ctor public GpsNavigationMessageEvent.Callback();
method public void onGpsNavigationMessageReceived(android.location.GpsNavigationMessageEvent);
method public void onStatusChanged(int);
}
public static abstract class GpsNavigationMessageEvent.GpsNavigationMessageStatus implements java.lang.annotation.Annotation {
public static abstract interface GpsNavigationMessageEvent.Listener {
method public abstract void onGpsNavigationMessageReceived(android.location.GpsNavigationMessageEvent);
method public abstract void onStatusChanged(int);
}
public final class GpsSatellite {
@ -20682,6 +20907,8 @@ package android.location {
}
public class LocationManager {
method public deprecated boolean addGpsMeasurementListener(android.location.GpsMeasurementsEvent.Listener);
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);
@ -20699,12 +20926,14 @@ package android.location {
method public java.util.List<java.lang.String> getProviders(boolean);
method public java.util.List<java.lang.String> getProviders(android.location.Criteria, boolean);
method public boolean isProviderEnabled(java.lang.String);
method public boolean registerGnssMeasurementCallback(android.location.GnssMeasurementsEvent.Callback);
method public boolean registerGnssMeasurementCallback(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 registerGpsMeasurementCallback(android.location.GpsMeasurementsEvent.Callback);
method public boolean registerGpsMeasurementCallback(android.location.GpsMeasurementsEvent.Callback, android.os.Handler);
method public boolean registerGpsNavigationMessageCallback(android.location.GpsNavigationMessageEvent.Callback);
method public boolean registerGpsNavigationMessageCallback(android.location.GpsNavigationMessageEvent.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);
@ -20727,9 +20956,9 @@ package android.location {
method public void setTestProviderEnabled(java.lang.String, boolean);
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 unregisterGnssMeasurementCallback(android.location.GnssMeasurementsEvent.Callback);
method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
method public void unregisterGnssStatusCallback(android.location.GnssStatusCallback);
method public void unregisterGpsMeasurementCallback(android.location.GpsMeasurementsEvent.Callback);
method public void unregisterGpsNavigationMessageCallback(android.location.GpsNavigationMessageEvent.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";

View File

@ -19123,38 +19123,7 @@ package android.location {
method public static boolean isPresent();
}
public abstract interface GnssNmeaListener {
method public abstract void onNmeaReceived(long, java.lang.String);
}
public final class GnssStatus {
method public float getAzimuth(int);
method public int getConstellationType(int);
method public float getElevation(int);
method public int getNumSatellites();
method public int getPrn(int);
method public float getSnr(int);
method public boolean hasAlmanac(int);
method public boolean hasEphemeris(int);
method public boolean usedInFix(int);
field public static final int CONSTELLATION_BEIDOU = 5; // 0x5
field public static final int CONSTELLATION_GALILEO = 6; // 0x6
field public static final int CONSTELLATION_GLONASS = 3; // 0x3
field public static final int CONSTELLATION_GPS = 1; // 0x1
field public static final int CONSTELLATION_QZSS = 4; // 0x4
field public static final int CONSTELLATION_SBAS = 2; // 0x2
field public static final int CONSTELLATION_UNKNOWN = 0; // 0x0
}
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 final class GpsClock implements android.os.Parcelable {
public final class GnssClock implements android.os.Parcelable {
method public int describeContents();
method public double getBiasInNs();
method public double getBiasUncertaintyInNs();
@ -19181,7 +19150,7 @@ package android.location {
method public void resetFullBiasInNs();
method public void resetLeapSecond();
method public void resetTimeUncertaintyInNs();
method public void set(android.location.GpsClock);
method public void set(android.location.GnssClock);
method public void setBiasInNs(double);
method public void setBiasUncertaintyInNs(double);
method public void setDriftInNsPerSec(double);
@ -19196,13 +19165,13 @@ package android.location {
field public static final byte CLOCK_TYPE_GPS_TIME = 2; // 0x2
field public static final byte CLOCK_TYPE_LOCAL_HW_TIME = 1; // 0x1
field public static final byte CLOCK_TYPE_UNKNOWN = 0; // 0x0
field public static final android.os.Parcelable.Creator<android.location.GpsClock> CREATOR;
field public static final android.os.Parcelable.Creator<android.location.GnssClock> CREATOR;
}
public static abstract class GpsClock.GpsClockType implements java.lang.annotation.Annotation {
public static abstract class GnssClock.GnssClockType implements java.lang.annotation.Annotation {
}
public final class GpsMeasurement implements android.os.Parcelable {
public final class GnssMeasurement implements android.os.Parcelable {
method public int describeContents();
method public double getAccumulatedDeltaRangeInMeters();
method public short getAccumulatedDeltaRangeState();
@ -19273,7 +19242,7 @@ package android.location {
method public void resetPseudorangeUncertaintyInMeters();
method public void resetSnrInDb();
method public void resetTimeFromLastBitInMs();
method public void set(android.location.GpsMeasurement);
method public void set(android.location.GnssMeasurement);
method public void setAccumulatedDeltaRangeInMeters(double);
method public void setAccumulatedDeltaRangeState(short);
method public void setAccumulatedDeltaRangeUncertaintyInMeters(double);
@ -19312,7 +19281,7 @@ package android.location {
field public static final short ADR_STATE_RESET = 2; // 0x2
field public static final short ADR_STATE_UNKNOWN = 0; // 0x0
field public static final short ADR_STATE_VALID = 1; // 0x1
field public static final android.os.Parcelable.Creator<android.location.GpsMeasurement> CREATOR;
field public static final android.os.Parcelable.Creator<android.location.GnssMeasurement> CREATOR;
field public static final byte LOSS_OF_LOCK_CYCLE_SLIP = 2; // 0x2
field public static final byte LOSS_OF_LOCK_OK = 1; // 0x1
field public static final byte LOSS_OF_LOCK_UNKNOWN = 0; // 0x0
@ -19327,34 +19296,34 @@ package android.location {
field public static final short STATE_UNKNOWN = 0; // 0x0
}
public static abstract class GpsMeasurement.LossOfLockStatus implements java.lang.annotation.Annotation {
public static abstract class GnssMeasurement.LossOfLockStatus implements java.lang.annotation.Annotation {
}
public static abstract class GpsMeasurement.MultipathIndicator implements java.lang.annotation.Annotation {
public static abstract class GnssMeasurement.MultipathIndicator implements java.lang.annotation.Annotation {
}
public final class GpsMeasurementsEvent implements android.os.Parcelable {
ctor public GpsMeasurementsEvent(android.location.GpsClock, android.location.GpsMeasurement[]);
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.GpsClock getClock();
method public java.util.Collection<android.location.GpsMeasurement> getMeasurements();
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.GpsMeasurementsEvent> CREATOR;
field public static final android.os.Parcelable.Creator<android.location.GnssMeasurementsEvent> CREATOR;
field public static final int STATUS_GPS_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 GpsMeasurementsEvent.Callback {
ctor public GpsMeasurementsEvent.Callback();
method public void onGpsMeasurementsReceived(android.location.GpsMeasurementsEvent);
public static abstract class GnssMeasurementsEvent.Callback {
ctor public GnssMeasurementsEvent.Callback();
method public void onGnssMeasurementsReceived(android.location.GnssMeasurementsEvent);
method public void onStatusChanged(int);
}
public static abstract class GpsMeasurementsEvent.GpsMeasurementsStatus implements java.lang.annotation.Annotation {
public static abstract class GnssMeasurementsEvent.GnssMeasurementsStatus implements java.lang.annotation.Annotation {
}
public final class GpsNavigationMessage implements android.os.Parcelable {
public final class GnssNavigationMessage implements android.os.Parcelable {
method public int describeContents();
method public byte[] getData();
method public short getMessageId();
@ -19363,7 +19332,7 @@ package android.location {
method public short getSubmessageId();
method public byte getType();
method public void reset();
method public void set(android.location.GpsNavigationMessage);
method public void set(android.location.GnssNavigationMessage);
method public void setData(byte[]);
method public void setMessageId(short);
method public void setPrn(byte);
@ -19371,7 +19340,7 @@ package android.location {
method public void setSubmessageId(short);
method public void setType(byte);
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.location.GpsNavigationMessage> CREATOR;
field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessage> CREATOR;
field public static final byte MESSAGE_TYPE_CNAV2 = 4; // 0x4
field public static final byte MESSAGE_TYPE_L1CA = 1; // 0x1
field public static final byte MESSAGE_TYPE_L2CNAV = 2; // 0x2
@ -19382,27 +19351,58 @@ package android.location {
field public static final short STATUS_UNKNOWN = 0; // 0x0
}
public static abstract class GpsNavigationMessage.GpsNavigationMessageType implements java.lang.annotation.Annotation {
public static abstract class GnssNavigationMessage.GnssNavigationMessageType implements java.lang.annotation.Annotation {
}
public final class GpsNavigationMessageEvent implements android.os.Parcelable {
ctor public GpsNavigationMessageEvent(android.location.GpsNavigationMessage);
public final class GnssNavigationMessageEvent implements android.os.Parcelable {
ctor public GnssNavigationMessageEvent(android.location.GnssNavigationMessage);
method public int describeContents();
method public android.location.GpsNavigationMessage getNavigationMessage();
method public android.location.GnssNavigationMessage getNavigationMessage();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.location.GpsNavigationMessageEvent> CREATOR;
field public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessageEvent> CREATOR;
field public static final int STATUS_GPS_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 GpsNavigationMessageEvent.Callback {
ctor public GpsNavigationMessageEvent.Callback();
method public void onGpsNavigationMessageReceived(android.location.GpsNavigationMessageEvent);
public static abstract class GnssNavigationMessageEvent.Callback {
ctor public GnssNavigationMessageEvent.Callback();
method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessageEvent);
method public void onStatusChanged(int);
}
public static abstract class GpsNavigationMessageEvent.GpsNavigationMessageStatus implements java.lang.annotation.Annotation {
public static abstract class GnssNavigationMessageEvent.GnssNavigationMessageStatus implements java.lang.annotation.Annotation {
}
public abstract interface GnssNmeaListener {
method public abstract void onNmeaReceived(long, java.lang.String);
}
public final class GnssStatus {
method public float getAzimuth(int);
method public int getConstellationType(int);
method public float getElevation(int);
method public int getNumSatellites();
method public int getPrn(int);
method public float getSnr(int);
method public boolean hasAlmanac(int);
method public boolean hasEphemeris(int);
method public boolean usedInFix(int);
field public static final int CONSTELLATION_BEIDOU = 5; // 0x5
field public static final int CONSTELLATION_GALILEO = 6; // 0x6
field public static final int CONSTELLATION_GLONASS = 3; // 0x3
field public static final int CONSTELLATION_GPS = 1; // 0x1
field public static final int CONSTELLATION_QZSS = 4; // 0x4
field public static final int CONSTELLATION_SBAS = 2; // 0x2
field public static final int CONSTELLATION_UNKNOWN = 0; // 0x0
}
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 final class GpsSatellite {
@ -19507,12 +19507,12 @@ package android.location {
method public java.util.List<java.lang.String> getProviders(boolean);
method public java.util.List<java.lang.String> getProviders(android.location.Criteria, boolean);
method public boolean isProviderEnabled(java.lang.String);
method public boolean registerGnssMeasurementCallback(android.location.GnssMeasurementsEvent.Callback);
method public boolean registerGnssMeasurementCallback(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 registerGpsMeasurementCallback(android.location.GpsMeasurementsEvent.Callback);
method public boolean registerGpsMeasurementCallback(android.location.GpsMeasurementsEvent.Callback, android.os.Handler);
method public boolean registerGpsNavigationMessageCallback(android.location.GpsNavigationMessageEvent.Callback);
method public boolean registerGpsNavigationMessageCallback(android.location.GpsNavigationMessageEvent.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);
@ -19533,9 +19533,9 @@ package android.location {
method public void setTestProviderEnabled(java.lang.String, boolean);
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 unregisterGnssMeasurementCallback(android.location.GnssMeasurementsEvent.Callback);
method public void unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessageEvent.Callback);
method public void unregisterGnssStatusCallback(android.location.GnssStatusCallback);
method public void unregisterGpsMeasurementCallback(android.location.GpsMeasurementsEvent.Callback);
method public void unregisterGpsNavigationMessageCallback(android.location.GpsNavigationMessageEvent.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";

View File

@ -0,0 +1,532 @@
/*
* Copyright (C) 2014 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;
import android.annotation.IntDef;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* A class containing a GPS clock timestamp.
* 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
/** The type of the GPS Clock. */
@Retention(RetentionPolicy.SOURCE)
@IntDef({CLOCK_TYPE_UNKNOWN, CLOCK_TYPE_LOCAL_HW_TIME, CLOCK_TYPE_GPS_TIME})
public @interface GnssClockType {}
/**
* The type of the time stored is not available or it is unknown.
*/
public static final byte CLOCK_TYPE_UNKNOWN = 0;
/**
* The source of the time value reported by this class is the 'Local Hardware Clock'.
*/
public static final byte CLOCK_TYPE_LOCAL_HW_TIME = 1;
/**
* The source of the time value reported by this class is the 'GPS time' derived from
* satellites (epoch = Jan 6, 1980).
*/
public static final byte CLOCK_TYPE_GPS_TIME = 2;
private static final short HAS_NO_FLAGS = 0;
private static final short HAS_LEAP_SECOND = (1<<0);
private static final short HAS_TIME_UNCERTAINTY = (1<<1);
private static final short HAS_FULL_BIAS = (1<<2);
private static final short HAS_BIAS = (1<<3);
private static final short HAS_BIAS_UNCERTAINTY = (1<<4);
private static final short HAS_DRIFT = (1<<5);
private static final short HAS_DRIFT_UNCERTAINTY = (1<<6);
// End enumerations in sync with gps.h
private short mFlags;
private short mLeapSecond;
private byte mType;
private long mTimeInNs;
private double mTimeUncertaintyInNs;
private long mFullBiasInNs;
private double mBiasInNs;
private double mBiasUncertaintyInNs;
private double mDriftInNsPerSec;
private double mDriftUncertaintyInNsPerSec;
private long mTimeOfLastHwClockDiscontinuityInNs;
GnssClock() {
initialize();
}
/**
* Sets all contents to the values stored in the provided object.
*/
public void set(GnssClock clock) {
mFlags = clock.mFlags;
mLeapSecond = clock.mLeapSecond;
mType = clock.mType;
mTimeInNs = clock.mTimeInNs;
mTimeUncertaintyInNs = clock.mTimeUncertaintyInNs;
mFullBiasInNs = clock.mFullBiasInNs;
mBiasInNs = clock.mBiasInNs;
mBiasUncertaintyInNs = clock.mBiasUncertaintyInNs;
mDriftInNsPerSec = clock.mDriftInNsPerSec;
mDriftUncertaintyInNsPerSec = clock.mDriftUncertaintyInNsPerSec;
mTimeOfLastHwClockDiscontinuityInNs = clock.mTimeOfLastHwClockDiscontinuityInNs;
}
/**
* Resets all the contents to its original state.
*/
public void reset() {
initialize();
}
/**
* Gets the type of time reported by {@link #getTimeInNs()}.
*/
@GnssClockType
public byte getType() {
return mType;
}
/**
* Sets the type of time reported.
*/
public void setType(@GnssClockType byte value) {
mType = value;
}
/**
* Gets a string representation of the 'type'.
* For internal and logging use only.
*/
private String getTypeString() {
switch (mType) {
case CLOCK_TYPE_UNKNOWN:
return "Unknown";
case CLOCK_TYPE_GPS_TIME:
return "GpsTime";
case CLOCK_TYPE_LOCAL_HW_TIME:
return "LocalHwClock";
default:
return "<Invalid:" + mType + ">";
}
}
/**
* Returns true if {@link #getLeapSecond()} is available, false otherwise.
*/
public boolean hasLeapSecond() {
return isFlagSet(HAS_LEAP_SECOND);
}
/**
* 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.
*/
public short getLeapSecond() {
return mLeapSecond;
}
/**
* Sets the leap second associated with the clock's time.
*/
public void setLeapSecond(short leapSecond) {
setFlag(HAS_LEAP_SECOND);
mLeapSecond = leapSecond;
}
/**
* Resets the leap second associated with the clock's time.
*/
public void resetLeapSecond() {
resetFlag(HAS_LEAP_SECOND);
mLeapSecond = Short.MIN_VALUE;
}
/**
* Gets the GPS receiver internal clock value in nanoseconds.
* This can be either the 'local hardware clock' value ({@link #CLOCK_TYPE_LOCAL_HW_TIME}), or the
* current GPS time derived inside GPS receiver ({@link #CLOCK_TYPE_GPS_TIME}).
* {@link #getType()} defines the time reported.
*
* 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 #getFullBiasInNs()} (when it is available) from this value.
*
* For 'GPS time' this value is expected to be the best estimation of current GPS time that GPS
* receiver can achieve. {@link #getTimeUncertaintyInNs()} should be available when GPS time is
* specified.
*
* Sub-nanosecond accuracy can be provided by means of {@link #getBiasInNs()}.
* The reported time includes {@link #getTimeUncertaintyInNs()}.
*/
public long getTimeInNs() {
return mTimeInNs;
}
/**
* Sets the GPS receiver internal clock in nanoseconds.
*/
public void setTimeInNs(long timeInNs) {
mTimeInNs = timeInNs;
}
/**
* Returns true if {@link #getTimeUncertaintyInNs()} is available, false otherwise.
*/
public boolean hasTimeUncertaintyInNs() {
return isFlagSet(HAS_TIME_UNCERTAINTY);
}
/**
* 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 #hasTimeUncertaintyInNs()} is true.
*/
public double getTimeUncertaintyInNs() {
return mTimeUncertaintyInNs;
}
/**
* Sets the clock's Time Uncertainty (1-Sigma) in nanoseconds.
*/
public void setTimeUncertaintyInNs(double timeUncertaintyInNs) {
setFlag(HAS_TIME_UNCERTAINTY);
mTimeUncertaintyInNs = timeUncertaintyInNs;
}
/**
* Resets the clock's Time Uncertainty (1-Sigma) in nanoseconds.
*/
public void resetTimeUncertaintyInNs() {
resetFlag(HAS_TIME_UNCERTAINTY);
mTimeUncertaintyInNs = Double.NaN;
}
/**
* Returns true if {@link #getFullBiasInNs()} is available, false otherwise.
*/
public boolean hasFullBiasInNs() {
return isFlagSet(HAS_FULL_BIAS);
}
/**
* Gets the difference between hardware clock ({@link #getTimeInNs()}) inside GPS receiver and
* the true GPS time since 0000Z, January 6, 1980, in nanoseconds.
*
* This value is available if {@link #CLOCK_TYPE_LOCAL_HW_TIME} is set, and GPS receiver has solved
* the clock for GPS time.
* {@link #getBiasUncertaintyInNs()} should be used for quality check.
*
* The sign of the value is defined by the following equation:
* true time (GPS time) = time_ns + (full_bias_ns + bias_ns)
*
* The reported full bias includes {@link #getBiasUncertaintyInNs()}.
* The value is onl available if {@link #hasFullBiasInNs()} is true.
*/
public long getFullBiasInNs() {
return mFullBiasInNs;
}
/**
* Sets the full bias in nanoseconds.
*/
public void setFullBiasInNs(long value) {
setFlag(HAS_FULL_BIAS);
mFullBiasInNs = value;
}
/**
* Resets the full bias in nanoseconds.
*/
public void resetFullBiasInNs() {
resetFlag(HAS_FULL_BIAS);
mFullBiasInNs = Long.MIN_VALUE;
}
/**
* Returns true if {@link #getBiasInNs()} is available, false otherwise.
*/
public boolean hasBiasInNs() {
return isFlagSet(HAS_BIAS);
}
/**
* Gets the clock's sub-nanosecond bias.
* The reported bias includes {@link #getBiasUncertaintyInNs()}.
*
* The value is only available if {@link #hasBiasInNs()} is true.
*/
public double getBiasInNs() {
return mBiasInNs;
}
/**
* Sets the sub-nanosecond bias.
*/
public void setBiasInNs(double biasInNs) {
setFlag(HAS_BIAS);
mBiasInNs = biasInNs;
}
/**
* Resets the clock's Bias in nanoseconds.
*/
public void resetBiasInNs() {
resetFlag(HAS_BIAS);
mBiasInNs = Double.NaN;
}
/**
* Returns true if {@link #getBiasUncertaintyInNs()} is available, false otherwise.
*/
public boolean hasBiasUncertaintyInNs() {
return isFlagSet(HAS_BIAS_UNCERTAINTY);
}
/**
* Gets the clock's Bias Uncertainty (1-Sigma) in nanoseconds.
*
* The value is only available if {@link #hasBiasUncertaintyInNs()} is true.
*/
public double getBiasUncertaintyInNs() {
return mBiasUncertaintyInNs;
}
/**
* Sets the clock's Bias Uncertainty (1-Sigma) in nanoseconds.
*/
public void setBiasUncertaintyInNs(double biasUncertaintyInNs) {
setFlag(HAS_BIAS_UNCERTAINTY);
mBiasUncertaintyInNs = biasUncertaintyInNs;
}
/**
* Resets the clock's Bias Uncertainty (1-Sigma) in nanoseconds.
*/
public void resetBiasUncertaintyInNs() {
resetFlag(HAS_BIAS_UNCERTAINTY);
mBiasUncertaintyInNs = Double.NaN;
}
/**
* Returns true if {@link #getDriftInNsPerSec()} is available, false otherwise.
*/
public boolean hasDriftInNsPerSec() {
return isFlagSet(HAS_DRIFT);
}
/**
* 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 #getDriftUncertaintyInNsPerSec()}.
*
* The value is only available if {@link #hasDriftInNsPerSec()} is true.
*/
public double getDriftInNsPerSec() {
return mDriftInNsPerSec;
}
/**
* Sets the clock's Drift in nanoseconds per second.
*/
public void setDriftInNsPerSec(double driftInNsPerSec) {
setFlag(HAS_DRIFT);
mDriftInNsPerSec = driftInNsPerSec;
}
/**
* Resets the clock's Drift in nanoseconds per second.
*/
public void resetDriftInNsPerSec() {
resetFlag(HAS_DRIFT);
mDriftInNsPerSec = Double.NaN;
}
/**
* Returns true if {@link #getDriftUncertaintyInNsPerSec()} is available, false otherwise.
*/
public boolean hasDriftUncertaintyInNsPerSec() {
return isFlagSet(HAS_DRIFT_UNCERTAINTY);
}
/**
* Gets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
*
* The value is only available if {@link #hasDriftUncertaintyInNsPerSec()} is true.
*/
public double getDriftUncertaintyInNsPerSec() {
return mDriftUncertaintyInNsPerSec;
}
/**
* Sets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
*/
public void setDriftUncertaintyInNsPerSec(double driftUncertaintyInNsPerSec) {
setFlag(HAS_DRIFT_UNCERTAINTY);
mDriftUncertaintyInNsPerSec = driftUncertaintyInNsPerSec;
}
/**
* Gets time of last hardware clock discontinuity.
*/
public long getTimeOfLastHwClockDiscontinuityInNs() {
return mTimeOfLastHwClockDiscontinuityInNs;
}
/**
* Sets time of last hardware clock discontinuity.
*/
public void setTimeOfLastHwClockDiscontinuityInNs(long timeOfLastHwClockDiscontinuityInNs) {
mTimeOfLastHwClockDiscontinuityInNs = timeOfLastHwClockDiscontinuityInNs;
}
/**
* Resets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
*/
public void resetDriftUncertaintyInNsPerSec() {
resetFlag(HAS_DRIFT_UNCERTAINTY);
mDriftUncertaintyInNsPerSec = Double.NaN;
}
public static final Creator<GnssClock> CREATOR = new Creator<GnssClock>() {
@Override
public GnssClock createFromParcel(Parcel parcel) {
GnssClock gpsClock = new GnssClock();
gpsClock.mFlags = (short) parcel.readInt();
gpsClock.mLeapSecond = (short) parcel.readInt();
gpsClock.mType = parcel.readByte();
gpsClock.mTimeInNs = parcel.readLong();
gpsClock.mTimeUncertaintyInNs = parcel.readDouble();
gpsClock.mFullBiasInNs = parcel.readLong();
gpsClock.mBiasInNs = parcel.readDouble();
gpsClock.mBiasUncertaintyInNs = parcel.readDouble();
gpsClock.mDriftInNsPerSec = parcel.readDouble();
gpsClock.mDriftUncertaintyInNsPerSec = parcel.readDouble();
gpsClock.mTimeOfLastHwClockDiscontinuityInNs = parcel.readLong();
return gpsClock;
}
@Override
public GnssClock[] newArray(int size) {
return new GnssClock[size];
}
};
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeInt(mFlags);
parcel.writeInt(mLeapSecond);
parcel.writeByte(mType);
parcel.writeLong(mTimeInNs);
parcel.writeDouble(mTimeUncertaintyInNs);
parcel.writeLong(mFullBiasInNs);
parcel.writeDouble(mBiasInNs);
parcel.writeDouble(mBiasUncertaintyInNs);
parcel.writeDouble(mDriftInNsPerSec);
parcel.writeDouble(mDriftUncertaintyInNsPerSec);
parcel.writeLong(mTimeOfLastHwClockDiscontinuityInNs);
}
@Override
public int describeContents() {
return 0;
}
@Override
public String toString() {
final String format = " %-15s = %s\n";
final String formatWithUncertainty = " %-15s = %-25s %-26s = %s\n";
StringBuilder builder = new StringBuilder("GnssClock:\n");
builder.append(String.format(format, "Type", getTypeString()));
builder.append(String.format(format, "LeapSecond", hasLeapSecond() ? mLeapSecond : null));
builder.append(String.format(
formatWithUncertainty,
"TimeInNs",
mTimeInNs,
"TimeUncertaintyInNs",
hasTimeUncertaintyInNs() ? mTimeUncertaintyInNs : null));
builder.append(String.format(
format,
"FullBiasInNs",
hasFullBiasInNs() ? mFullBiasInNs : null));
builder.append(String.format(
formatWithUncertainty,
"BiasInNs",
hasBiasInNs() ? mBiasInNs : null,
"BiasUncertaintyInNs",
hasBiasUncertaintyInNs() ? mBiasUncertaintyInNs : null));
builder.append(String.format(
formatWithUncertainty,
"DriftInNsPerSec",
hasDriftInNsPerSec() ? mDriftInNsPerSec : null,
"DriftUncertaintyInNsPerSec",
hasDriftUncertaintyInNsPerSec() ? mDriftUncertaintyInNsPerSec : null));
builder.append(String.format(format, "TimeOfLastHwClockDiscontinuityInNs",
getType() == CLOCK_TYPE_LOCAL_HW_TIME
? mTimeOfLastHwClockDiscontinuityInNs : null));
return builder.toString();
}
private void initialize() {
mFlags = HAS_NO_FLAGS;
resetLeapSecond();
setType(CLOCK_TYPE_UNKNOWN);
setTimeInNs(Long.MIN_VALUE);
resetTimeUncertaintyInNs();
resetFullBiasInNs();
resetBiasInNs();
resetBiasUncertaintyInNs();
resetDriftInNsPerSec();
resetDriftUncertaintyInNsPerSec();
setTimeOfLastHwClockDiscontinuityInNs(Long.MIN_VALUE);
}
private void setFlag(short flag) {
mFlags |= flag;
}
private void resetFlag(short flag) {
mFlags &= ~flag;
}
private boolean isFlagSet(short flag) {
return (mFlags & flag) == flag;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -20,41 +20,42 @@ import android.content.Context;
import android.os.RemoteException;
/**
* A handler class to manage transport callbacks for {@link GpsMeasurementsEvent.Callback}.
* A handler class to manage transport callbacks for {@link GnssMeasurementsEvent.Callback}.
*
* @hide
*/
class GpsMeasurementCallbackTransport
extends LocalListenerHelper<GpsMeasurementsEvent.Callback> {
class GnssMeasurementCallbackTransport
extends LocalListenerHelper<GnssMeasurementsEvent.Callback> {
private final ILocationManager mLocationManager;
private final IGpsMeasurementsListener mListenerTransport = new ListenerTransport();
private final IGnssMeasurementsListener mListenerTransport = new ListenerTransport();
public GpsMeasurementCallbackTransport(Context context, ILocationManager locationManager) {
super(context, "GpsMeasurementListenerTransport");
public GnssMeasurementCallbackTransport(Context context, ILocationManager locationManager) {
super(context, "GnssMeasurementListenerTransport");
mLocationManager = locationManager;
}
@Override
protected boolean registerWithServer() throws RemoteException {
return mLocationManager.addGpsMeasurementsListener(
return mLocationManager.addGnssMeasurementsListener(
mListenerTransport,
getContext().getPackageName());
}
@Override
protected void unregisterFromServer() throws RemoteException {
mLocationManager.removeGpsMeasurementsListener(mListenerTransport);
mLocationManager.removeGnssMeasurementsListener(mListenerTransport);
}
private class ListenerTransport extends IGpsMeasurementsListener.Stub {
private class ListenerTransport extends IGnssMeasurementsListener.Stub {
@Override
public void onGpsMeasurementsReceived(final GpsMeasurementsEvent event) {
ListenerOperation<GpsMeasurementsEvent.Callback> operation =
new ListenerOperation<GpsMeasurementsEvent.Callback>() {
public void onGnssMeasurementsReceived(final GnssMeasurementsEvent event) {
ListenerOperation<GnssMeasurementsEvent.Callback> operation =
new ListenerOperation<GnssMeasurementsEvent.Callback>() {
@Override
public void execute(GpsMeasurementsEvent.Callback callback) throws RemoteException {
callback.onGpsMeasurementsReceived(event);
public void execute(GnssMeasurementsEvent.Callback callback)
throws RemoteException {
callback.onGnssMeasurementsReceived(event);
}
};
foreach(operation);
@ -62,10 +63,11 @@ class GpsMeasurementCallbackTransport
@Override
public void onStatusChanged(final int status) {
ListenerOperation<GpsMeasurementsEvent.Callback> operation =
new ListenerOperation<GpsMeasurementsEvent.Callback>() {
ListenerOperation<GnssMeasurementsEvent.Callback> operation =
new ListenerOperation<GnssMeasurementsEvent.Callback>() {
@Override
public void execute(GpsMeasurementsEvent.Callback callback) throws RemoteException {
public void execute(GnssMeasurementsEvent.Callback callback)
throws RemoteException {
callback.onStatusChanged(status);
}
};

View File

@ -16,4 +16,4 @@
package android.location;
parcelable GpsMeasurementsEvent;
parcelable GnssMeasurementsEvent;

View File

@ -0,0 +1,160 @@
/*
* Copyright (C) 2014 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;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.security.InvalidParameterException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
/**
* A class implementing a container for data associated with a measurement event.
* Events are delivered to registered instances of {@link Callback}.
*/
public final class GnssMeasurementsEvent implements Parcelable {
/** The status of GPS measurements event. */
@Retention(RetentionPolicy.SOURCE)
@IntDef({STATUS_NOT_SUPPORTED, STATUS_READY, STATUS_GPS_LOCATION_DISABLED})
public @interface GnssMeasurementsStatus {}
/**
* The system does not support tracking of GPS Measurements. This status will not change in the
* future.
*/
public static final int STATUS_NOT_SUPPORTED = 0;
/**
* GPS 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_GPS_LOCATION_DISABLED = 2;
private final GnssClock mClock;
private final Collection<GnssMeasurement> mReadOnlyMeasurements;
/**
* Used for receiving GPS satellite measurements from the GPS engine.
* Each measurement contains raw and computed data identifying a satellite.
* You can implement this interface and call
* {@link LocationManager#registerGnssMeasurementCallback}.
*/
public static abstract class Callback {
/**
* Returns the latest collected GPS Measurements.
*/
public void onGnssMeasurementsReceived(GnssMeasurementsEvent eventArgs) {}
/**
* Returns the latest status of the GPS Measurements sub-system.
*/
public void onStatusChanged(@GnssMeasurementsStatus int status) {}
}
public GnssMeasurementsEvent(GnssClock clock, GnssMeasurement[] measurements) {
if (clock == null) {
throw new InvalidParameterException("Parameter 'clock' must not be null.");
}
if (measurements == null || measurements.length == 0) {
throw new InvalidParameterException(
"Parameter 'measurements' must not be null or empty.");
}
mClock = clock;
Collection<GnssMeasurement> measurementCollection = Arrays.asList(measurements);
mReadOnlyMeasurements = Collections.unmodifiableCollection(measurementCollection);
}
@NonNull
public GnssClock getClock() {
return mClock;
}
/**
* Gets a read-only collection of measurements associated with the current event.
*/
@NonNull
public Collection<GnssMeasurement> getMeasurements() {
return mReadOnlyMeasurements;
}
public static final Creator<GnssMeasurementsEvent> CREATOR =
new Creator<GnssMeasurementsEvent>() {
@Override
public GnssMeasurementsEvent createFromParcel(Parcel in) {
ClassLoader classLoader = getClass().getClassLoader();
GnssClock clock = in.readParcelable(classLoader);
int measurementsLength = in.readInt();
GnssMeasurement[] measurementsArray = new GnssMeasurement[measurementsLength];
in.readTypedArray(measurementsArray, GnssMeasurement.CREATOR);
return new GnssMeasurementsEvent(clock, measurementsArray);
}
@Override
public GnssMeasurementsEvent[] newArray(int size) {
return new GnssMeasurementsEvent[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeParcelable(mClock, flags);
int measurementsCount = mReadOnlyMeasurements.size();
GnssMeasurement[] measurementsArray =
mReadOnlyMeasurements.toArray(new GnssMeasurement[measurementsCount]);
parcel.writeInt(measurementsArray.length);
parcel.writeTypedArray(measurementsArray, flags);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder("[ GnssMeasurementsEvent:\n\n");
builder.append(mClock.toString());
builder.append("\n");
for (GnssMeasurement measurement : mReadOnlyMeasurements) {
builder.append(measurement.toString());
builder.append("\n");
}
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,330 @@
/*
* Copyright (C) 2014 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;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.security.InvalidParameterException;
/**
* A class containing a GPS satellite Navigation Message.
*/
public final class GnssNavigationMessage implements Parcelable {
private static final byte[] EMPTY_ARRAY = new byte[0];
/** The type of the GPS Clock. */
@Retention(RetentionPolicy.SOURCE)
@IntDef({MESSAGE_TYPE_UNKNOWN, MESSAGE_TYPE_L1CA, MESSAGE_TYPE_L2CNAV, MESSAGE_TYPE_L5CNAV,
MESSAGE_TYPE_CNAV2})
public @interface GnssNavigationMessageType {}
// The following enumerations must be in sync with the values declared in gps.h
/**
* The type of the navigation message is not available or unknown.
*/
public static final byte MESSAGE_TYPE_UNKNOWN = 0;
/**
* The Navigation Message is of type L1 C/A.
*/
public static final byte MESSAGE_TYPE_L1CA = 1;
/**
* The Navigation Message is of type L1-CNAV.
*/
public static final byte MESSAGE_TYPE_L2CNAV = 2;
/**
* The Navigation Message is of type L5-CNAV.
*/
public static final byte MESSAGE_TYPE_L5CNAV = 3;
/**
* The Navigation Message is of type CNAV-2.
*/
public static final byte MESSAGE_TYPE_CNAV2 = 4;
/**
* The Navigation Message Status is 'unknown'.
*/
public static final short STATUS_UNKNOWN = 0;
/**
* The Navigation Message was received without any parity error in its navigation words.
*/
public static final short STATUS_PARITY_PASSED = (1<<0);
/**
* The Navigation Message was received with words that failed parity check, but the receiver was
* able to correct those words.
*/
public static final short STATUS_PARITY_REBUILT = (1<<1);
// End enumerations in sync with gps.h
private byte mType;
private byte mPrn;
private short mMessageId;
private short mSubmessageId;
private byte[] mData;
private short mStatus;
GnssNavigationMessage() {
initialize();
}
/**
* Sets all contents to the values stored in the provided object.
*/
public void set(GnssNavigationMessage navigationMessage) {
mType = navigationMessage.mType;
mPrn = navigationMessage.mPrn;
mMessageId = navigationMessage.mMessageId;
mSubmessageId = navigationMessage.mSubmessageId;
mData = navigationMessage.mData;
mStatus = navigationMessage.mStatus;
}
/**
* Resets all the contents to its original state.
*/
public void reset() {
initialize();
}
/**
* Gets the type of the navigation message contained in the object.
*/
@GnssNavigationMessageType
public byte getType() {
return mType;
}
/**
* Sets the type of the navigation message.
*/
public void setType(@GnssNavigationMessageType byte value) {
mType = value;
}
/**
* Gets a string representation of the 'type'.
* For internal and logging use only.
*/
private String getTypeString() {
switch (mType) {
case MESSAGE_TYPE_UNKNOWN:
return "Unknown";
case MESSAGE_TYPE_L1CA:
return "L1 C/A";
case MESSAGE_TYPE_L2CNAV:
return "L2-CNAV";
case MESSAGE_TYPE_L5CNAV:
return "L5-CNAV";
case MESSAGE_TYPE_CNAV2:
return "CNAV-2";
default:
return "<Invalid:" + mType + ">";
}
}
/**
* Gets the Pseudo-random number.
* Range: [1, 32].
*/
public byte getPrn() {
return mPrn;
}
/**
* Sets the Pseud-random number.
*/
public void setPrn(byte value) {
mPrn = value;
}
/**
* 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.
*/
public short getMessageId() {
return mMessageId;
}
/**
* Sets the Message Identifier.
*/
public void setMessageId(short value) {
mMessageId = value;
}
/**
* 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.
*/
public short getSubmessageId() {
return mSubmessageId;
}
/**
* Sets the Sub-message identifier.
*/
public void setSubmessageId(short value) {
mSubmessageId = value;
}
/**
* Gets the data associated with the Navigation Message.
* The bytes (or words) specified using big endian format (MSB first).
*/
@NonNull
public byte[] getData() {
return mData;
}
/**
* Sets the data associated with the Navigation Message.
*/
public void setData(byte[] value) {
if (value == null) {
throw new InvalidParameterException("Data must be a non-null array");
}
mData = value;
}
/**
* Gets the Status of the navigation message contained in the object.
*/
public short getStatus() {
return mStatus;
}
/**
* Sets the status of the navigation message.
*/
public void setStatus(short value) {
mStatus = value;
}
/**
* Gets a string representation of the 'status'.
* For internal and logging use only.
*/
private String getStatusString() {
switch (mStatus) {
case STATUS_UNKNOWN:
return "Unknown";
case STATUS_PARITY_PASSED:
return "ParityPassed";
case STATUS_PARITY_REBUILT:
return "ParityRebuilt";
default:
return "<Invalid:" + mStatus + ">";
}
}
public static final Creator<GnssNavigationMessage> CREATOR =
new Creator<GnssNavigationMessage>() {
@Override
public GnssNavigationMessage createFromParcel(Parcel parcel) {
GnssNavigationMessage navigationMessage = new GnssNavigationMessage();
navigationMessage.setType(parcel.readByte());
navigationMessage.setPrn(parcel.readByte());
navigationMessage.setMessageId((short) parcel.readInt());
navigationMessage.setSubmessageId((short) parcel.readInt());
int dataLength = parcel.readInt();
byte[] data = new byte[dataLength];
parcel.readByteArray(data);
navigationMessage.setData(data);
if (parcel.dataAvail() >= Integer.SIZE) {
int status = parcel.readInt();
navigationMessage.setStatus((short) status);
} else {
navigationMessage.setStatus(STATUS_UNKNOWN);
}
return navigationMessage;
}
@Override
public GnssNavigationMessage[] newArray(int size) {
return new GnssNavigationMessage[size];
}
};
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeByte(mType);
parcel.writeByte(mPrn);
parcel.writeInt(mMessageId);
parcel.writeInt(mSubmessageId);
parcel.writeInt(mData.length);
parcel.writeByteArray(mData);
parcel.writeInt(mStatus);
}
@Override
public int describeContents() {
return 0;
}
@Override
public String toString() {
final String format = " %-15s = %s\n";
StringBuilder builder = new StringBuilder("GnssNavigationMessage:\n");
builder.append(String.format(format, "Type", getTypeString()));
builder.append(String.format(format, "Prn", mPrn));
builder.append(String.format(format, "Status", getStatusString()));
builder.append(String.format(format, "MessageId", mMessageId));
builder.append(String.format(format, "SubmessageId", mSubmessageId));
builder.append(String.format(format, "Data", "{"));
String prefix = " ";
for(byte value : mData) {
builder.append(prefix);
builder.append(value);
prefix = ", ";
}
builder.append(" }");
return builder.toString();
}
private void initialize() {
mType = MESSAGE_TYPE_UNKNOWN;
mPrn = 0;
mMessageId = -1;
mSubmessageId = -1;
mData = EMPTY_ARRAY;
mStatus = STATUS_UNKNOWN;
}
}

View File

@ -20,44 +20,44 @@ import android.content.Context;
import android.os.RemoteException;
/**
* A handler class to manage transport callback for {@link GpsNavigationMessageEvent.Callback}.
* A handler class to manage transport callback for {@link GnssNavigationMessageEvent.Callback}.
*
* @hide
*/
class GpsNavigationMessageCallbackTransport
extends LocalListenerHelper<GpsNavigationMessageEvent.Callback> {
class GnssNavigationMessageCallbackTransport
extends LocalListenerHelper<GnssNavigationMessageEvent.Callback> {
private final ILocationManager mLocationManager;
private final IGpsNavigationMessageListener mListenerTransport = new ListenerTransport();
private final IGnssNavigationMessageListener mListenerTransport = new ListenerTransport();
public GpsNavigationMessageCallbackTransport(
public GnssNavigationMessageCallbackTransport(
Context context,
ILocationManager locationManager) {
super(context, "GpsNavigationMessageCallbackTransport");
super(context, "GnssNavigationMessageCallbackTransport");
mLocationManager = locationManager;
}
@Override
protected boolean registerWithServer() throws RemoteException {
return mLocationManager.addGpsNavigationMessageListener(
return mLocationManager.addGnssNavigationMessageListener(
mListenerTransport,
getContext().getPackageName());
}
@Override
protected void unregisterFromServer() throws RemoteException {
mLocationManager.removeGpsNavigationMessageListener(mListenerTransport);
mLocationManager.removeGnssNavigationMessageListener(mListenerTransport);
}
private class ListenerTransport extends IGpsNavigationMessageListener.Stub {
private class ListenerTransport extends IGnssNavigationMessageListener.Stub {
@Override
public void onGpsNavigationMessageReceived(final GpsNavigationMessageEvent event) {
ListenerOperation<GpsNavigationMessageEvent.Callback> operation =
new ListenerOperation<GpsNavigationMessageEvent.Callback>() {
public void onGnssNavigationMessageReceived(final GnssNavigationMessageEvent event) {
ListenerOperation<GnssNavigationMessageEvent.Callback> operation =
new ListenerOperation<GnssNavigationMessageEvent.Callback>() {
@Override
public void execute(GpsNavigationMessageEvent.Callback callback)
public void execute(GnssNavigationMessageEvent.Callback callback)
throws RemoteException {
callback.onGpsNavigationMessageReceived(event);
callback.onGnssNavigationMessageReceived(event);
}
};
foreach(operation);
@ -65,10 +65,10 @@ class GpsNavigationMessageCallbackTransport
@Override
public void onStatusChanged(final int status) {
ListenerOperation<GpsNavigationMessageEvent.Callback> operation =
new ListenerOperation<GpsNavigationMessageEvent.Callback>() {
ListenerOperation<GnssNavigationMessageEvent.Callback> operation =
new ListenerOperation<GnssNavigationMessageEvent.Callback>() {
@Override
public void execute(GpsNavigationMessageEvent.Callback callback)
public void execute(GnssNavigationMessageEvent.Callback callback)
throws RemoteException {
callback.onStatusChanged(status);
}

View File

@ -16,4 +16,4 @@
package android.location;
parcelable GpsNavigationMessageEvent;
parcelable GnssNavigationMessageEvent;

View File

@ -0,0 +1,119 @@
/*
* Copyright (C) 2014 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;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.security.InvalidParameterException;
/**
* A class implementing a container for data associated with a navigation message event.
* Events are delivered to registered instances of {@link Callback}.
*/
public final class GnssNavigationMessageEvent implements Parcelable {
/** The status of GPS measurements event. */
@Retention(RetentionPolicy.SOURCE)
@IntDef({STATUS_NOT_SUPPORTED, STATUS_READY, STATUS_GPS_LOCATION_DISABLED})
public @interface GnssNavigationMessageStatus {}
/**
* The system does not support tracking of GPS 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.
*/
public static final int STATUS_READY = 1;
/**
* GPS provider or Location is disabled, updated will not be received until they are enabled.
*/
public static final int STATUS_GPS_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
* {@link LocationManager#registerGnssNavigationMessageCallback}.
*/
public static abstract class Callback {
/**
* Returns the latest collected GPS Navigation Message.
*/
public void onGnssNavigationMessageReceived(GnssNavigationMessageEvent event) {}
/**
* Returns the latest status of the GPS Navigation Messages sub-system.
*/
public void onStatusChanged(@GnssNavigationMessageStatus int status) {}
}
public GnssNavigationMessageEvent(GnssNavigationMessage message) {
if (message == null) {
throw new InvalidParameterException("Parameter 'message' must not be null.");
}
mNavigationMessage = message;
}
@NonNull
public GnssNavigationMessage getNavigationMessage() {
return mNavigationMessage;
}
public static final Creator<GnssNavigationMessageEvent> CREATOR =
new Creator<GnssNavigationMessageEvent>() {
@Override
public GnssNavigationMessageEvent createFromParcel(Parcel in) {
ClassLoader classLoader = getClass().getClassLoader();
GnssNavigationMessage navigationMessage = in.readParcelable(classLoader);
return new GnssNavigationMessageEvent(navigationMessage);
}
@Override
public GnssNavigationMessageEvent[] newArray(int size) {
return new GnssNavigationMessageEvent[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel parcel, int flags) {
parcel.writeParcelable(mNavigationMessage, flags);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder("[ GnssNavigationMessageEvent:\n\n");
builder.append(mNavigationMessage.toString());
builder.append("\n]");
return builder.toString();
}
}

View File

@ -16,41 +16,36 @@
package android.location;
import android.annotation.IntDef;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* A class containing a GPS clock timestamp.
* It represents a measurement of the GPS receiver's clock.
*
* @hide
*/
public final class GpsClock implements Parcelable {
@SystemApi
public class GpsClock implements Parcelable {
// The following enumerations must be in sync with the values declared in gps.h
/** The type of the GPS Clock. */
@Retention(RetentionPolicy.SOURCE)
@IntDef({CLOCK_TYPE_UNKNOWN, CLOCK_TYPE_LOCAL_HW_TIME, CLOCK_TYPE_GPS_TIME})
public @interface GpsClockType {}
/**
* The type of the time stored is not available or it is unknown.
*/
public static final byte CLOCK_TYPE_UNKNOWN = 0;
public static final byte TYPE_UNKNOWN = 0;
/**
* The source of the time value reported by this class is the 'Local Hardware Clock'.
*/
public static final byte CLOCK_TYPE_LOCAL_HW_TIME = 1;
public static final byte TYPE_LOCAL_HW_TIME = 1;
/**
* The source of the time value reported by this class is the 'GPS time' derived from
* satellites (epoch = Jan 6, 1980).
*/
public static final byte CLOCK_TYPE_GPS_TIME = 2;
public static final byte TYPE_GPS_TIME = 2;
private static final short HAS_NO_FLAGS = 0;
private static final short HAS_LEAP_SECOND = (1<<0);
@ -73,7 +68,6 @@ public final class GpsClock implements Parcelable {
private double mBiasUncertaintyInNs;
private double mDriftInNsPerSec;
private double mDriftUncertaintyInNsPerSec;
private long mTimeOfLastHwClockDiscontinuityInNs;
GpsClock() {
initialize();
@ -93,7 +87,6 @@ public final class GpsClock implements Parcelable {
mBiasUncertaintyInNs = clock.mBiasUncertaintyInNs;
mDriftInNsPerSec = clock.mDriftInNsPerSec;
mDriftUncertaintyInNsPerSec = clock.mDriftUncertaintyInNsPerSec;
mTimeOfLastHwClockDiscontinuityInNs = clock.mTimeOfLastHwClockDiscontinuityInNs;
}
/**
@ -106,7 +99,6 @@ public final class GpsClock implements Parcelable {
/**
* Gets the type of time reported by {@link #getTimeInNs()}.
*/
@GpsClockType
public byte getType() {
return mType;
}
@ -114,7 +106,7 @@ public final class GpsClock implements Parcelable {
/**
* Sets the type of time reported.
*/
public void setType(@GpsClockType byte value) {
public void setType(byte value) {
mType = value;
}
@ -124,11 +116,11 @@ public final class GpsClock implements Parcelable {
*/
private String getTypeString() {
switch (mType) {
case CLOCK_TYPE_UNKNOWN:
case TYPE_UNKNOWN:
return "Unknown";
case CLOCK_TYPE_GPS_TIME:
case TYPE_GPS_TIME:
return "GpsTime";
case CLOCK_TYPE_LOCAL_HW_TIME:
case TYPE_LOCAL_HW_TIME:
return "LocalHwClock";
default:
return "<Invalid:" + mType + ">";
@ -171,8 +163,8 @@ public final class GpsClock implements Parcelable {
/**
* Gets the GPS receiver internal clock value in nanoseconds.
* This can be either the 'local hardware clock' value ({@link #CLOCK_TYPE_LOCAL_HW_TIME}), or the
* current GPS time derived inside GPS receiver ({@link #CLOCK_TYPE_GPS_TIME}).
* This can be either the 'local hardware clock' value ({@link #TYPE_LOCAL_HW_TIME}), or the
* current GPS time derived inside GPS receiver ({@link #TYPE_GPS_TIME}).
* {@link #getType()} defines the time reported.
*
* For 'local hardware clock' this value is expected to be monotonically increasing during the
@ -231,7 +223,7 @@ public final class GpsClock implements Parcelable {
}
/**
* Returns true if {@link #getFullBiasInNs()} is available, false otherwise.
* Returns true if {@link @getFullBiasInNs()} is available, false otherwise.
*/
public boolean hasFullBiasInNs() {
return isFlagSet(HAS_FULL_BIAS);
@ -241,7 +233,7 @@ public final class GpsClock implements Parcelable {
* Gets the difference between hardware clock ({@link #getTimeInNs()}) inside GPS receiver and
* the true GPS time since 0000Z, January 6, 1980, in nanoseconds.
*
* This value is available if {@link #CLOCK_TYPE_LOCAL_HW_TIME} is set, and GPS receiver has solved
* This value is available if {@link #TYPE_LOCAL_HW_TIME} is set, and GPS receiver has solved
* the clock for GPS time.
* {@link #getBiasUncertaintyInNs()} should be used for quality check.
*
@ -394,20 +386,6 @@ public final class GpsClock implements Parcelable {
mDriftUncertaintyInNsPerSec = driftUncertaintyInNsPerSec;
}
/**
* Gets time of last hardware clock discontinuity.
*/
public long getTimeOfLastHwClockDiscontinuityInNs() {
return mTimeOfLastHwClockDiscontinuityInNs;
}
/**
* Sets time of last hardware clock discontinuity.
*/
public void setTimeOfLastHwClockDiscontinuityInNs(long timeOfLastHwClockDiscontinuityInNs) {
mTimeOfLastHwClockDiscontinuityInNs = timeOfLastHwClockDiscontinuityInNs;
}
/**
* Resets the clock's Drift Uncertainty (1-Sigma) in nanoseconds per second.
*/
@ -431,7 +409,6 @@ public final class GpsClock implements Parcelable {
gpsClock.mBiasUncertaintyInNs = parcel.readDouble();
gpsClock.mDriftInNsPerSec = parcel.readDouble();
gpsClock.mDriftUncertaintyInNsPerSec = parcel.readDouble();
gpsClock.mTimeOfLastHwClockDiscontinuityInNs = parcel.readLong();
return gpsClock;
}
@ -453,7 +430,6 @@ public final class GpsClock implements Parcelable {
parcel.writeDouble(mBiasUncertaintyInNs);
parcel.writeDouble(mDriftInNsPerSec);
parcel.writeDouble(mDriftUncertaintyInNsPerSec);
parcel.writeLong(mTimeOfLastHwClockDiscontinuityInNs);
}
@Override
@ -497,17 +473,13 @@ public final class GpsClock implements Parcelable {
"DriftUncertaintyInNsPerSec",
hasDriftUncertaintyInNsPerSec() ? mDriftUncertaintyInNsPerSec : null));
builder.append(String.format(format, "TimeOfLastHwClockDiscontinuityInNs",
getType() == CLOCK_TYPE_LOCAL_HW_TIME
? mTimeOfLastHwClockDiscontinuityInNs : null));
return builder.toString();
}
private void initialize() {
mFlags = HAS_NO_FLAGS;
resetLeapSecond();
setType(CLOCK_TYPE_UNKNOWN);
setType(TYPE_UNKNOWN);
setTimeInNs(Long.MIN_VALUE);
resetTimeUncertaintyInNs();
resetFullBiasInNs();
@ -515,7 +487,6 @@ public final class GpsClock implements Parcelable {
resetBiasUncertaintyInNs();
resetDriftInNsPerSec();
resetDriftUncertaintyInNsPerSec();
setTimeOfLastHwClockDiscontinuityInNs(Long.MIN_VALUE);
}
private void setFlag(short flag) {

View File

@ -16,17 +16,17 @@
package android.location;
import android.annotation.IntDef;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* A class representing a GPS satellite measurement, containing raw and computed information.
*
* @hide
*/
public final class GpsMeasurement implements Parcelable {
@SystemApi
public class GpsMeasurement implements Parcelable {
private int mFlags;
private byte mPrn;
private double mTimeOffsetInNs;
@ -59,8 +59,6 @@ public final class GpsMeasurement implements Parcelable {
private double mAzimuthInDeg;
private double mAzimuthUncertaintyInDeg;
private boolean mUsedInFix;
private double mPseudorangeRateCarrierInMetersPerSec;
private double mPseudorangeRateCarrierUncertaintyInMetersPerSec;
// The following enumerations must be in sync with the values declared in gps.h
@ -85,11 +83,6 @@ public final class GpsMeasurement implements Parcelable {
private static final int HAS_USED_IN_FIX = (1<<17);
private static final int GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE = (1<<18);
/** The status of 'loss of lock'. */
@Retention(RetentionPolicy.SOURCE)
@IntDef({LOSS_OF_LOCK_UNKNOWN, LOSS_OF_LOCK_OK, LOSS_OF_LOCK_CYCLE_SLIP})
public @interface LossOfLockStatus {}
/**
* The indicator is not available or it is unknown.
*/
@ -105,12 +98,6 @@ public final class GpsMeasurement implements Parcelable {
*/
public static final byte LOSS_OF_LOCK_CYCLE_SLIP = 2;
/** The status of multipath. */
@Retention(RetentionPolicy.SOURCE)
@IntDef({MULTIPATH_INDICATOR_UNKNOWN, MULTIPATH_INDICATOR_DETECTED,
MULTIPATH_INDICATOR_NOT_USED})
public @interface MultipathIndicator {}
/**
* The indicator is not available or it is unknown.
*/
@ -231,10 +218,6 @@ public final class GpsMeasurement implements Parcelable {
mAzimuthInDeg = measurement.mAzimuthInDeg;
mAzimuthUncertaintyInDeg = measurement.mAzimuthUncertaintyInDeg;
mUsedInFix = measurement.mUsedInFix;
mPseudorangeRateCarrierInMetersPerSec =
measurement.mPseudorangeRateCarrierInMetersPerSec;
mPseudorangeRateCarrierUncertaintyInMetersPerSec =
measurement.mPseudorangeRateCarrierUncertaintyInMetersPerSec;
}
/**
@ -793,7 +776,6 @@ public final class GpsMeasurement implements Parcelable {
/**
* Gets a value indicating the 'loss of lock' state of the event.
*/
@LossOfLockStatus
public byte getLossOfLock() {
return mLossOfLock;
}
@ -801,7 +783,7 @@ public final class GpsMeasurement implements Parcelable {
/**
* Sets the 'loss of lock' status.
*/
public void setLossOfLock(@LossOfLockStatus byte value) {
public void setLossOfLock(byte value) {
mLossOfLock = value;
}
@ -959,7 +941,6 @@ public final class GpsMeasurement implements Parcelable {
/**
* Gets a value indicating the 'multipath' state of the event.
*/
@MultipathIndicator
public byte getMultipathIndicator() {
return mMultipathIndicator;
}
@ -967,7 +948,7 @@ public final class GpsMeasurement implements Parcelable {
/**
* Sets the 'multi-path' indicator.
*/
public void setMultipathIndicator(@MultipathIndicator byte value) {
public void setMultipathIndicator(byte value) {
mMultipathIndicator = value;
}
@ -1176,34 +1157,6 @@ public final class GpsMeasurement implements Parcelable {
mUsedInFix = value;
}
/**
* Gets pseudorange rate (based on carrier phase changes) at the timestamp in m/s.
*/
public double getPseudorangeRateCarrierInMetersPerSec() {
return mPseudorangeRateCarrierInMetersPerSec;
}
/**
* Sets pseudorange rate (based on carrier phase changes) at the timestamp in m/s.
*/
public void setPseudorangeRateCarrierInMetersPerSec(double value) {
mPseudorangeRateCarrierInMetersPerSec = value;
}
/**
* Gets 1-Sigma uncertainty of the pseudorange rate carrier.
*/
public double getPseudorangeRateCarrierUncertaintyInMetersPerSec() {
return mPseudorangeRateCarrierUncertaintyInMetersPerSec;
}
/**
* Sets 1-Sigma uncertainty of the pseudorange rate carrier.
*/
public void setPseudorangeRateCarrierUncertaintyInMetersPerSec(double value) {
mPseudorangeRateCarrierUncertaintyInMetersPerSec = value;
}
public static final Creator<GpsMeasurement> CREATOR = new Creator<GpsMeasurement>() {
@Override
public GpsMeasurement createFromParcel(Parcel parcel) {
@ -1241,8 +1194,6 @@ public final class GpsMeasurement implements Parcelable {
gpsMeasurement.mAzimuthInDeg = parcel.readDouble();
gpsMeasurement.mAzimuthUncertaintyInDeg = parcel.readDouble();
gpsMeasurement.mUsedInFix = parcel.readInt() != 0;
gpsMeasurement.mPseudorangeRateCarrierInMetersPerSec = parcel.readDouble();
gpsMeasurement.mPseudorangeRateCarrierUncertaintyInMetersPerSec = parcel.readDouble();
return gpsMeasurement;
}
@ -1286,8 +1237,6 @@ public final class GpsMeasurement implements Parcelable {
parcel.writeDouble(mAzimuthInDeg);
parcel.writeDouble(mAzimuthUncertaintyInDeg);
parcel.writeInt(mUsedInFix ? 1 : 0);
parcel.writeDouble(mPseudorangeRateCarrierInMetersPerSec);
parcel.writeDouble(mPseudorangeRateCarrierUncertaintyInMetersPerSec);
}
@Override
@ -1412,11 +1361,6 @@ public final class GpsMeasurement implements Parcelable {
builder.append(String.format(format, "UsedInFix", mUsedInFix));
builder.append(String.format(format, "PseudorangeRateCarrierInMetersPerSec",
mPseudorangeRateCarrierInMetersPerSec));
builder.append(String.format(format, "PseudorangeRateCarrierUncertaintyInMetersPerSec",
mPseudorangeRateCarrierUncertaintyInMetersPerSec));
return builder.toString();
}
@ -1453,8 +1397,6 @@ public final class GpsMeasurement implements Parcelable {
resetAzimuthInDeg();
resetAzimuthUncertaintyInDeg();
setUsedInFix(false);
setPseudorangeRateCarrierInMetersPerSec(Double.MIN_VALUE);
setPseudorangeRateCarrierUncertaintyInMetersPerSec(Double.MIN_VALUE);
}
private void setFlag(int flag) {

View File

@ -16,13 +16,11 @@
package android.location;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.security.InvalidParameterException;
import java.util.Arrays;
import java.util.Collection;
@ -30,13 +28,12 @@ import java.util.Collections;
/**
* A class implementing a container for data associated with a measurement event.
* Events are delivered to registered instances of {@link Callback}.
* Events are delivered to registered instances of {@link Listener}.
*
* @hide
*/
public final class GpsMeasurementsEvent implements Parcelable {
/** The status of GPS measurements event. */
@Retention(RetentionPolicy.SOURCE)
@IntDef({STATUS_NOT_SUPPORTED, STATUS_READY, STATUS_GPS_LOCATION_DISABLED})
public @interface GpsMeasurementsStatus {}
@SystemApi
public class GpsMeasurementsEvent implements Parcelable {
/**
* The system does not support tracking of GPS Measurements. This status will not change in the
@ -61,20 +58,22 @@ public final class GpsMeasurementsEvent implements Parcelable {
/**
* Used for receiving GPS satellite measurements from the GPS engine.
* Each measurement contains raw and computed data identifying a satellite.
* You can implement this interface and call
* {@link LocationManager#registerGpsMeasurementCallback}.
* You can implement this interface and call {@link LocationManager#addGpsMeasurementListener}.
*
* @hide
*/
public static abstract class Callback {
@SystemApi
public interface Listener {
/**
* Returns the latest collected GPS Measurements.
*/
public void onGpsMeasurementsReceived(GpsMeasurementsEvent eventArgs) {}
void onGpsMeasurementsReceived(GpsMeasurementsEvent eventArgs);
/**
* Returns the latest status of the GPS Measurements sub-system.
*/
public void onStatusChanged(@GpsMeasurementsStatus int status) {}
void onStatusChanged(int status);
}
public GpsMeasurementsEvent(GpsClock clock, GpsMeasurement[] measurements) {

View File

@ -16,54 +16,49 @@
package android.location;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.security.InvalidParameterException;
/**
* A class containing a GPS satellite Navigation Message.
*
* @hide
*/
public final class GpsNavigationMessage implements Parcelable {
@SystemApi
public class GpsNavigationMessage implements Parcelable {
private static final byte[] EMPTY_ARRAY = new byte[0];
/** The type of the GPS Clock. */
@Retention(RetentionPolicy.SOURCE)
@IntDef({MESSAGE_TYPE_UNKNOWN, MESSAGE_TYPE_L1CA, MESSAGE_TYPE_L2CNAV, MESSAGE_TYPE_L5CNAV,
MESSAGE_TYPE_CNAV2})
public @interface GpsNavigationMessageType {}
// The following enumerations must be in sync with the values declared in gps.h
/**
* The type of the navigation message is not available or unknown.
*/
public static final byte MESSAGE_TYPE_UNKNOWN = 0;
public static final byte TYPE_UNKNOWN = 0;
/**
* The Navigation Message is of type L1 C/A.
*/
public static final byte MESSAGE_TYPE_L1CA = 1;
public static final byte TYPE_L1CA = 1;
/**
* The Navigation Message is of type L1-CNAV.
*/
public static final byte MESSAGE_TYPE_L2CNAV = 2;
public static final byte TYPE_L2CNAV = 2;
/**
* The Navigation Message is of type L5-CNAV.
*/
public static final byte MESSAGE_TYPE_L5CNAV = 3;
public static final byte TYPE_L5CNAV = 3;
/**
* The Navigation Message is of type CNAV-2.
*/
public static final byte MESSAGE_TYPE_CNAV2 = 4;
public static final byte TYPE_CNAV2 = 4;
/**
* The Navigation Message Status is 'unknown'.
@ -116,7 +111,6 @@ public final class GpsNavigationMessage implements Parcelable {
/**
* Gets the type of the navigation message contained in the object.
*/
@GpsNavigationMessageType
public byte getType() {
return mType;
}
@ -124,7 +118,7 @@ public final class GpsNavigationMessage implements Parcelable {
/**
* Sets the type of the navigation message.
*/
public void setType(@GpsNavigationMessageType byte value) {
public void setType(byte value) {
mType = value;
}
@ -134,15 +128,15 @@ public final class GpsNavigationMessage implements Parcelable {
*/
private String getTypeString() {
switch (mType) {
case MESSAGE_TYPE_UNKNOWN:
case TYPE_UNKNOWN:
return "Unknown";
case MESSAGE_TYPE_L1CA:
case TYPE_L1CA:
return "L1 C/A";
case MESSAGE_TYPE_L2CNAV:
case TYPE_L2CNAV:
return "L2-CNAV";
case MESSAGE_TYPE_L5CNAV:
case TYPE_L5CNAV:
return "L5-CNAV";
case MESSAGE_TYPE_CNAV2:
case TYPE_CNAV2:
return "CNAV-2";
default:
return "<Invalid:" + mType + ">";
@ -320,7 +314,7 @@ public final class GpsNavigationMessage implements Parcelable {
}
private void initialize() {
mType = MESSAGE_TYPE_UNKNOWN;
mType = TYPE_UNKNOWN;
mPrn = 0;
mMessageId = -1;
mSubmessageId = -1;

View File

@ -16,60 +16,60 @@
package android.location;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.security.InvalidParameterException;
/**
* A class implementing a container for data associated with a navigation message event.
* Events are delivered to registered instances of {@link Callback}.
* Events are delivered to registered instances of {@link Listener}.
*
* @hide
*/
public final class GpsNavigationMessageEvent implements Parcelable {
/** The status of GPS measurements event. */
@Retention(RetentionPolicy.SOURCE)
@IntDef({STATUS_NOT_SUPPORTED, STATUS_READY, STATUS_GPS_LOCATION_DISABLED})
public @interface GpsNavigationMessageStatus {}
@SystemApi
public class GpsNavigationMessageEvent implements Parcelable {
/**
* The system does not support tracking of GPS Navigation Messages. This status will not change
* in the future.
*/
public static final int STATUS_NOT_SUPPORTED = 0;
public static int STATUS_NOT_SUPPORTED = 0;
/**
* GPS Navigation Messages are successfully being tracked, it will receive updates once they are
* available.
*/
public static final int STATUS_READY = 1;
public static int STATUS_READY = 1;
/**
* GPS provider or Location is disabled, updated will not be received until they are enabled.
*/
public static final int STATUS_GPS_LOCATION_DISABLED = 2;
public static int STATUS_GPS_LOCATION_DISABLED = 2;
private final GpsNavigationMessage mNavigationMessage;
/**
* Used for receiving GPS satellite Navigation Messages from the GPS engine.
* You can implement this interface and call
* {@link LocationManager#registerGpsNavigationMessageCallback}.
* {@link LocationManager#addGpsNavigationMessageListener}.
*
* @hide
*/
public static abstract class Callback {
@SystemApi
public interface Listener {
/**
* Returns the latest collected GPS Navigation Message.
*/
public void onGpsNavigationMessageReceived(GpsNavigationMessageEvent event) {}
void onGpsNavigationMessageReceived(GpsNavigationMessageEvent event);
/**
* Returns the latest status of the GPS Navigation Messages sub-system.
*/
public void onStatusChanged(@GpsNavigationMessageStatus int status) {}
void onStatusChanged(int status);
}
public GpsNavigationMessageEvent(GpsNavigationMessage message) {

View File

@ -16,12 +16,12 @@
package android.location;
import android.location.GpsMeasurementsEvent;
import android.location.GnssMeasurementsEvent;
/**
* {@hide}
*/
oneway interface IGpsMeasurementsListener {
void onGpsMeasurementsReceived(in GpsMeasurementsEvent event);
oneway interface IGnssMeasurementsListener {
void onGnssMeasurementsReceived(in GnssMeasurementsEvent event);
void onStatusChanged(in int status);
}

View File

@ -16,12 +16,12 @@
package android.location;
import android.location.GpsNavigationMessageEvent;
import android.location.GnssNavigationMessageEvent;
/**
* {@hide}
*/
oneway interface IGpsNavigationMessageListener {
void onGpsNavigationMessageReceived(in GpsNavigationMessageEvent event);
oneway interface IGnssNavigationMessageListener {
void onGnssNavigationMessageReceived(in GnssNavigationMessageEvent event);
void onStatusChanged(in int status);
}

View File

@ -21,9 +21,9 @@ import android.location.Address;
import android.location.Criteria;
import android.location.GeocoderParams;
import android.location.Geofence;
import android.location.IGnssMeasurementsListener;
import android.location.IGnssStatusListener;
import android.location.IGpsMeasurementsListener;
import android.location.IGpsNavigationMessageListener;
import android.location.IGnssNavigationMessageListener;
import android.location.ILocationListener;
import android.location.Location;
import android.location.LocationRequest;
@ -61,13 +61,13 @@ interface ILocationManager
boolean sendNiResponse(int notifId, int userResponse);
boolean addGpsMeasurementsListener(in IGpsMeasurementsListener listener, in String packageName);
void removeGpsMeasurementsListener(in IGpsMeasurementsListener listener);
boolean addGnssMeasurementsListener(in IGnssMeasurementsListener listener, in String packageName);
void removeGnssMeasurementsListener(in IGnssMeasurementsListener listener);
boolean addGpsNavigationMessageListener(
in IGpsNavigationMessageListener listener,
boolean addGnssNavigationMessageListener(
in IGnssNavigationMessageListener listener,
in String packageName);
void removeGpsNavigationMessageListener(in IGpsNavigationMessageListener listener);
void removeGnssNavigationMessageListener(in IGnssNavigationMessageListener listener);
int getGpsYearOfHardware();

View File

@ -64,8 +64,8 @@ public class LocationManager {
private final Context mContext;
private final ILocationManager mService;
private final GpsMeasurementCallbackTransport mGpsMeasurementCallbackTransport;
private final GpsNavigationMessageCallbackTransport mGpsNavigationMessageCallbackTransport;
private final GnssMeasurementCallbackTransport mGnssMeasurementCallbackTransport;
private final GnssNavigationMessageCallbackTransport mGnssNavigationMessageCallbackTransport;
private final HashMap<GpsStatus.Listener, GnssStatusListenerTransport> mGpsStatusListeners =
new HashMap<>();
private final HashMap<GpsStatus.NmeaListener, GnssStatusListenerTransport> mGpsNmeaListeners =
@ -321,9 +321,9 @@ public class LocationManager {
public LocationManager(Context context, ILocationManager service) {
mService = service;
mContext = context;
mGpsMeasurementCallbackTransport = new GpsMeasurementCallbackTransport(mContext, mService);
mGpsNavigationMessageCallbackTransport =
new GpsNavigationMessageCallbackTransport(mContext, mService);
mGnssMeasurementCallbackTransport = new GnssMeasurementCallbackTransport(mContext, mService);
mGnssNavigationMessageCallbackTransport =
new GnssNavigationMessageCallbackTransport(mContext, mService);
}
private LocationProvider createProvider(String name, ProviderProperties properties) {
@ -1817,73 +1817,119 @@ public class LocationManager {
}
/**
* Registers a GPS Measurement callback.
*
* @param callback a {@link GpsMeasurementsEvent.Callback} object to register.
* @return {@code true} if the callback was added successfully, {@code false} otherwise.
* No-op method to keep backward-compatibility.
* Don't use it. Use {@link #registerGnssMeasurementCallback} instead.
* @hide
* @deprecated
*/
@RequiresPermission(ACCESS_FINE_LOCATION)
public boolean registerGpsMeasurementCallback(GpsMeasurementsEvent.Callback callback) {
return registerGpsMeasurementCallback(callback, null);
@Deprecated
@SystemApi
public boolean addGpsMeasurementListener(GpsMeasurementsEvent.Listener listener) {
return false;
}
/**
* Registers a GPS Measurement callback.
*
* @param callback a {@link GpsMeasurementsEvent.Callback} object to register.
* @param callback a {@link GnssMeasurementsEvent.Callback} object to register.
* @return {@code true} if the callback was added successfully, {@code false} otherwise.
*/
@RequiresPermission(ACCESS_FINE_LOCATION)
public boolean registerGnssMeasurementCallback(GnssMeasurementsEvent.Callback callback) {
return registerGnssMeasurementCallback(callback, null);
}
/**
* Registers a GPS Measurement callback.
*
* @param callback a {@link GnssMeasurementsEvent.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 registerGpsMeasurementCallback(GpsMeasurementsEvent.Callback callback,
public boolean registerGnssMeasurementCallback(GnssMeasurementsEvent.Callback callback,
Handler handler) {
return mGpsMeasurementCallbackTransport.add(callback, handler);
return mGnssMeasurementCallbackTransport.add(callback, handler);
}
/**
* No-op method to keep backward-compatibility.
* Don't use it. Use {@link #unregisterGnssMeasurementCallback} instead.
* @hide
* @deprecated
*/
@Deprecated
@SystemApi
public void removeGpsMeasurementListener(GpsMeasurementsEvent.Listener listener) {
}
/**
* Unregisters a GPS Measurement callback.
*
* @param callback a {@link GpsMeasurementsEvent.Callback} object to remove.
* @param callback a {@link GnssMeasurementsEvent.Callback} object to remove.
*/
public void unregisterGpsMeasurementCallback(GpsMeasurementsEvent.Callback callback) {
mGpsMeasurementCallbackTransport.remove(callback);
public void unregisterGnssMeasurementCallback(GnssMeasurementsEvent.Callback callback) {
mGnssMeasurementCallbackTransport.remove(callback);
}
/**
* No-op method to keep backward-compatibility.
* Don't use it. Use {@link #registerGnssNavigationMessageCallback} instead.
* @hide
* @deprecated
*/
@Deprecated
@SystemApi
public boolean addGpsNavigationMessageListener(GpsNavigationMessageEvent.Listener listener) {
return false;
}
/**
* Registers a GPS Navigation Message callback.
*
* @param callback a {@link GpsNavigationMessageEvent.Callback} object to register.
* @param callback a {@link GnssNavigationMessageEvent.Callback} object to register.
* @return {@code true} if the callback was added successfully, {@code false} otherwise.
*/
public boolean registerGpsNavigationMessageCallback(
GpsNavigationMessageEvent.Callback callback) {
return registerGpsNavigationMessageCallback(callback, null);
public boolean registerGnssNavigationMessageCallback(
GnssNavigationMessageEvent.Callback callback) {
return registerGnssNavigationMessageCallback(callback, null);
}
/**
* Registers a GPS Navigation Message callback.
*
* @param callback a {@link GpsNavigationMessageEvent.Callback} object to register.
* @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.
*/
@RequiresPermission(ACCESS_FINE_LOCATION)
public boolean registerGpsNavigationMessageCallback(
GpsNavigationMessageEvent.Callback callback, Handler handler) {
return mGpsNavigationMessageCallbackTransport.add(callback, handler);
public boolean registerGnssNavigationMessageCallback(
GnssNavigationMessageEvent.Callback callback, Handler handler) {
return mGnssNavigationMessageCallbackTransport.add(callback, handler);
}
/**
* Unregisters a GPS Navigation Message callback.
*
* @param callback a {@link GpsNavigationMessageEvent.Callback} object to remove.
* @param callback a {@link GnssNavigationMessageEvent.Callback} object to remove.
*/
public void unregisterGpsNavigationMessageCallback(
GpsNavigationMessageEvent.Callback callback) {
mGpsNavigationMessageCallbackTransport.remove(callback);
public void unregisterGnssNavigationMessageCallback(
GnssNavigationMessageEvent.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.

View File

@ -24,12 +24,12 @@ import com.android.internal.os.BackgroundThread;
import com.android.server.location.ActivityRecognitionProxy;
import com.android.server.location.FlpHardwareProvider;
import com.android.server.location.FusedProxy;
import com.android.server.location.GnssLocationProvider;
import com.android.server.location.GeocoderProxy;
import com.android.server.location.GeofenceManager;
import com.android.server.location.GeofenceProxy;
import com.android.server.location.GpsMeasurementsProvider;
import com.android.server.location.GpsNavigationMessageProvider;
import com.android.server.location.GnssLocationProvider;
import com.android.server.location.GnssMeasurementsProvider;
import com.android.server.location.GnssNavigationMessageProvider;
import com.android.server.location.LocationBlacklist;
import com.android.server.location.LocationFudger;
import com.android.server.location.LocationProviderInterface;
@ -61,11 +61,11 @@ import android.location.Address;
import android.location.Criteria;
import android.location.GeocoderParams;
import android.location.Geofence;
import android.location.IGnssMeasurementsListener;
import android.location.IGnssStatusListener;
import android.location.IGnssStatusProvider;
import android.location.IGpsGeofenceHardware;
import android.location.IGpsMeasurementsListener;
import android.location.IGpsNavigationMessageListener;
import android.location.IGnssNavigationMessageListener;
import android.location.ILocationListener;
import android.location.ILocationManager;
import android.location.INetInitiatedListener;
@ -162,8 +162,8 @@ public class LocationManagerService extends ILocationManager.Stub {
private LocationWorkerHandler mLocationHandler;
private PassiveProvider mPassiveProvider; // track passive provider for special cases
private LocationBlacklist mBlacklist;
private GpsMeasurementsProvider mGpsMeasurementsProvider;
private GpsNavigationMessageProvider mGpsNavigationMessageProvider;
private GnssMeasurementsProvider mGnssMeasurementsProvider;
private GnssNavigationMessageProvider mGnssNavigationMessageProvider;
private IGpsGeofenceHardware mGpsGeofenceProxy;
// --- fields below are protected by mLock ---
@ -467,8 +467,8 @@ public class LocationManagerService extends ILocationManager.Stub {
mNetInitiatedListener = gnssProvider.getNetInitiatedListener();
addProviderLocked(gnssProvider);
mRealProviders.put(LocationManager.GPS_PROVIDER, gnssProvider);
mGpsMeasurementsProvider = gnssProvider.getGpsMeasurementsProvider();
mGpsNavigationMessageProvider = gnssProvider.getGpsNavigationMessageProvider();
mGnssMeasurementsProvider = gnssProvider.getGnssMeasurementsProvider();
mGnssNavigationMessageProvider = gnssProvider.getGnssNavigationMessageProvider();
mGpsGeofenceProxy = gnssProvider.getGpsGeofenceProxy();
}
@ -994,7 +994,7 @@ public class LocationManagerService extends ILocationManager.Stub {
*/
@Override
public int getGpsYearOfHardware() {
if (mGpsNavigationMessageProvider != null) {
if (mGnssNavigationMessageProvider != null) {
return mGpsSystemInfoProvider.getGpsYearOfHardware();
} else {
return 0;
@ -1923,8 +1923,8 @@ public class LocationManagerService extends ILocationManager.Stub {
}
@Override
public boolean addGpsMeasurementsListener(
IGpsMeasurementsListener listener,
public boolean addGnssMeasurementsListener(
IGnssMeasurementsListener listener,
String packageName) {
int allowedResolutionLevel = getCallerAllowedResolutionLevel();
checkResolutionLevelIsSufficientForProviderUse(
@ -1941,22 +1941,22 @@ public class LocationManagerService extends ILocationManager.Stub {
Binder.restoreCallingIdentity(identity);
}
if (!hasLocationAccess || mGpsMeasurementsProvider == null) {
if (!hasLocationAccess || mGnssMeasurementsProvider == null) {
return false;
}
return mGpsMeasurementsProvider.addListener(listener);
return mGnssMeasurementsProvider.addListener(listener);
}
@Override
public void removeGpsMeasurementsListener(IGpsMeasurementsListener listener) {
if (mGpsMeasurementsProvider != null) {
mGpsMeasurementsProvider.removeListener(listener);
public void removeGnssMeasurementsListener(IGnssMeasurementsListener listener) {
if (mGnssMeasurementsProvider != null) {
mGnssMeasurementsProvider.removeListener(listener);
}
}
@Override
public boolean addGpsNavigationMessageListener(
IGpsNavigationMessageListener listener,
public boolean addGnssNavigationMessageListener(
IGnssNavigationMessageListener listener,
String packageName) {
int allowedResolutionLevel = getCallerAllowedResolutionLevel();
checkResolutionLevelIsSufficientForProviderUse(
@ -1973,16 +1973,16 @@ public class LocationManagerService extends ILocationManager.Stub {
Binder.restoreCallingIdentity(identity);
}
if (!hasLocationAccess || mGpsNavigationMessageProvider == null) {
if (!hasLocationAccess || mGnssNavigationMessageProvider == null) {
return false;
}
return mGpsNavigationMessageProvider.addListener(listener);
return mGnssNavigationMessageProvider.addListener(listener);
}
@Override
public void removeGpsNavigationMessageListener(IGpsNavigationMessageListener listener) {
if (mGpsNavigationMessageProvider != null) {
mGpsNavigationMessageProvider.removeListener(listener);
public void removeGnssNavigationMessageListener(IGnssNavigationMessageListener listener) {
if (mGnssNavigationMessageProvider != null) {
mGnssNavigationMessageProvider.removeListener(listener);
}
}

View File

@ -38,8 +38,8 @@ import android.location.FusedBatchOptions;
import android.location.GnssStatus;
import android.location.IGnssStatusListener;
import android.location.IGnssStatusProvider;
import android.location.GpsMeasurementsEvent;
import android.location.GpsNavigationMessageEvent;
import android.location.GnssMeasurementsEvent;
import android.location.GnssNavigationMessageEvent;
import android.location.IGpsGeofenceHardware;
import android.location.ILocationManager;
import android.location.INetInitiatedListener;
@ -368,8 +368,8 @@ public class GnssLocationProvider implements LocationProviderInterface {
private Location mLocation = new Location(LocationManager.GPS_PROVIDER);
private Bundle mLocationExtras = new Bundle();
private final GnssStatusListenerHelper mListenerHelper;
private final GpsMeasurementsProvider mGpsMeasurementsProvider;
private final GpsNavigationMessageProvider mGpsNavigationMessageProvider;
private final GnssMeasurementsProvider mGnssMeasurementsProvider;
private final GnssNavigationMessageProvider mGnssNavigationMessageProvider;
// Handler for processing events
private Handler mHandler;
@ -428,12 +428,12 @@ public class GnssLocationProvider implements LocationProviderInterface {
return mGpsGeofenceBinder;
}
public GpsMeasurementsProvider getGpsMeasurementsProvider() {
return mGpsMeasurementsProvider;
public GnssMeasurementsProvider getGnssMeasurementsProvider() {
return mGnssMeasurementsProvider;
}
public GpsNavigationMessageProvider getGpsNavigationMessageProvider() {
return mGpsNavigationMessageProvider;
public GnssNavigationMessageProvider getGnssNavigationMessageProvider() {
return mGnssNavigationMessageProvider;
}
/**
@ -713,7 +713,7 @@ public class GnssLocationProvider implements LocationProviderInterface {
}
};
mGpsMeasurementsProvider = new GpsMeasurementsProvider(mHandler) {
mGnssMeasurementsProvider = new GnssMeasurementsProvider(mHandler) {
@Override
public boolean isAvailableInPlatform() {
return native_is_measurement_supported();
@ -735,7 +735,7 @@ public class GnssLocationProvider implements LocationProviderInterface {
}
};
mGpsNavigationMessageProvider = new GpsNavigationMessageProvider(mHandler) {
mGnssNavigationMessageProvider = new GnssNavigationMessageProvider(mHandler) {
@Override
protected boolean isAvailableInPlatform() {
return native_is_navigation_message_supported();
@ -1087,8 +1087,8 @@ public class GnssLocationProvider implements LocationProviderInterface {
native_set_agps_server(AGPS_TYPE_C2K, mC2KServerHost, mC2KServerPort);
}
mGpsMeasurementsProvider.onGpsEnabledChanged();
mGpsNavigationMessageProvider.onGpsEnabledChanged();
mGnssMeasurementsProvider.onGpsEnabledChanged();
mGnssNavigationMessageProvider.onGpsEnabledChanged();
} else {
synchronized (mLock) {
mEnabled = false;
@ -1123,8 +1123,8 @@ public class GnssLocationProvider implements LocationProviderInterface {
// do this before releasing wakelock
native_cleanup();
mGpsMeasurementsProvider.onGpsEnabledChanged();
mGpsNavigationMessageProvider.onGpsEnabledChanged();
mGnssMeasurementsProvider.onGpsEnabledChanged();
mGnssNavigationMessageProvider.onGpsEnabledChanged();
}
@Override
@ -1655,15 +1655,15 @@ public class GnssLocationProvider implements LocationProviderInterface {
/**
* called from native code - Gps measurements callback
*/
private void reportMeasurementData(GpsMeasurementsEvent event) {
mGpsMeasurementsProvider.onMeasurementsAvailable(event);
private void reportMeasurementData(GnssMeasurementsEvent event) {
mGnssMeasurementsProvider.onMeasurementsAvailable(event);
}
/**
* called from native code - GPS navigation message callback
*/
private void reportNavigationMessage(GpsNavigationMessageEvent event) {
mGpsNavigationMessageProvider.onNavigationMessageAvailable(event);
private void reportNavigationMessage(GnssNavigationMessageEvent event) {
mGnssNavigationMessageProvider.onNavigationMessageAvailable(event);
}
/**
@ -1677,9 +1677,9 @@ public class GnssLocationProvider implements LocationProviderInterface {
requestUtcTime();
}
mGpsMeasurementsProvider.onCapabilitiesUpdated(
mGnssMeasurementsProvider.onCapabilitiesUpdated(
(capabilities & GPS_CAPABILITY_MEASUREMENTS) == GPS_CAPABILITY_MEASUREMENTS);
mGpsNavigationMessageProvider.onCapabilitiesUpdated(
mGnssNavigationMessageProvider.onCapabilitiesUpdated(
(capabilities & GPS_CAPABILITY_NAV_MESSAGES) == GPS_CAPABILITY_NAV_MESSAGES);
}

View File

@ -16,8 +16,8 @@
package com.android.server.location;
import android.location.GpsMeasurementsEvent;
import android.location.IGpsMeasurementsListener;
import android.location.GnssMeasurementsEvent;
import android.location.IGnssMeasurementsListener;
import android.os.Handler;
import android.os.RemoteException;
import android.util.Log;
@ -29,27 +29,27 @@ import android.util.Log;
*
* @hide
*/
public abstract class GpsMeasurementsProvider
extends RemoteListenerHelper<IGpsMeasurementsListener> {
private static final String TAG = "GpsMeasurementsProvider";
public abstract class GnssMeasurementsProvider
extends RemoteListenerHelper<IGnssMeasurementsListener> {
private static final String TAG = "GnssMeasurementsProvider";
protected GpsMeasurementsProvider(Handler handler) {
protected GnssMeasurementsProvider(Handler handler) {
super(handler, TAG);
}
public void onMeasurementsAvailable(final GpsMeasurementsEvent event) {
ListenerOperation<IGpsMeasurementsListener> operation =
new ListenerOperation<IGpsMeasurementsListener>() {
public void onMeasurementsAvailable(final GnssMeasurementsEvent event) {
ListenerOperation<IGnssMeasurementsListener> operation =
new ListenerOperation<IGnssMeasurementsListener>() {
@Override
public void execute(IGpsMeasurementsListener listener) throws RemoteException {
listener.onGpsMeasurementsReceived(event);
public void execute(IGnssMeasurementsListener listener) throws RemoteException {
listener.onGnssMeasurementsReceived(event);
}
};
foreach(operation);
}
public void onCapabilitiesUpdated(boolean isGpsMeasurementsSupported) {
setSupported(isGpsMeasurementsSupported);
public void onCapabilitiesUpdated(boolean isGnssMeasurementsSupported) {
setSupported(isGnssMeasurementsSupported);
updateResult();
}
@ -60,19 +60,19 @@ public abstract class GpsMeasurementsProvider
}
@Override
protected ListenerOperation<IGpsMeasurementsListener> getHandlerOperation(int result) {
protected ListenerOperation<IGnssMeasurementsListener> getHandlerOperation(int result) {
int status;
switch (result) {
case RESULT_SUCCESS:
status = GpsMeasurementsEvent.STATUS_READY;
status = GnssMeasurementsEvent.STATUS_READY;
break;
case RESULT_NOT_AVAILABLE:
case RESULT_NOT_SUPPORTED:
case RESULT_INTERNAL_ERROR:
status = GpsMeasurementsEvent.STATUS_NOT_SUPPORTED;
status = GnssMeasurementsEvent.STATUS_NOT_SUPPORTED;
break;
case RESULT_GPS_LOCATION_DISABLED:
status = GpsMeasurementsEvent.STATUS_GPS_LOCATION_DISABLED;
status = GnssMeasurementsEvent.STATUS_GPS_LOCATION_DISABLED;
break;
case RESULT_UNKNOWN:
return null;
@ -84,7 +84,7 @@ public abstract class GpsMeasurementsProvider
}
private static class StatusChangedOperation
implements ListenerOperation<IGpsMeasurementsListener> {
implements ListenerOperation<IGnssMeasurementsListener> {
private final int mStatus;
public StatusChangedOperation(int status) {
@ -92,7 +92,7 @@ public abstract class GpsMeasurementsProvider
}
@Override
public void execute(IGpsMeasurementsListener listener) throws RemoteException {
public void execute(IGnssMeasurementsListener listener) throws RemoteException {
listener.onStatusChanged(mStatus);
}
}

View File

@ -16,8 +16,8 @@
package com.android.server.location;
import android.location.GpsNavigationMessageEvent;
import android.location.IGpsNavigationMessageListener;
import android.location.GnssNavigationMessageEvent;
import android.location.IGnssNavigationMessageListener;
import android.os.Handler;
import android.os.RemoteException;
import android.util.Log;
@ -29,28 +29,28 @@ import android.util.Log;
*
* @hide
*/
public abstract class GpsNavigationMessageProvider
extends RemoteListenerHelper<IGpsNavigationMessageListener> {
private static final String TAG = "GpsNavigationMessageProvider";
public abstract class GnssNavigationMessageProvider
extends RemoteListenerHelper<IGnssNavigationMessageListener> {
private static final String TAG = "GnssNavigationMessageProvider";
protected GpsNavigationMessageProvider(Handler handler) {
protected GnssNavigationMessageProvider(Handler handler) {
super(handler, TAG);
}
public void onNavigationMessageAvailable(final GpsNavigationMessageEvent event) {
ListenerOperation<IGpsNavigationMessageListener> operation =
new ListenerOperation<IGpsNavigationMessageListener>() {
public void onNavigationMessageAvailable(final GnssNavigationMessageEvent event) {
ListenerOperation<IGnssNavigationMessageListener> operation =
new ListenerOperation<IGnssNavigationMessageListener>() {
@Override
public void execute(IGpsNavigationMessageListener listener)
public void execute(IGnssNavigationMessageListener listener)
throws RemoteException {
listener.onGpsNavigationMessageReceived(event);
listener.onGnssNavigationMessageReceived(event);
}
};
foreach(operation);
}
public void onCapabilitiesUpdated(boolean isGpsNavigationMessageSupported) {
setSupported(isGpsNavigationMessageSupported);
public void onCapabilitiesUpdated(boolean isGnssNavigationMessageSupported) {
setSupported(isGnssNavigationMessageSupported);
updateResult();
}
@ -61,19 +61,19 @@ public abstract class GpsNavigationMessageProvider
}
@Override
protected ListenerOperation<IGpsNavigationMessageListener> getHandlerOperation(int result) {
protected ListenerOperation<IGnssNavigationMessageListener> getHandlerOperation(int result) {
int status;
switch (result) {
case RESULT_SUCCESS:
status = GpsNavigationMessageEvent.STATUS_READY;
status = GnssNavigationMessageEvent.STATUS_READY;
break;
case RESULT_NOT_AVAILABLE:
case RESULT_NOT_SUPPORTED:
case RESULT_INTERNAL_ERROR:
status = GpsNavigationMessageEvent.STATUS_NOT_SUPPORTED;
status = GnssNavigationMessageEvent.STATUS_NOT_SUPPORTED;
break;
case RESULT_GPS_LOCATION_DISABLED:
status = GpsNavigationMessageEvent.STATUS_GPS_LOCATION_DISABLED;
status = GnssNavigationMessageEvent.STATUS_GPS_LOCATION_DISABLED;
break;
case RESULT_UNKNOWN:
return null;
@ -85,7 +85,7 @@ public abstract class GpsNavigationMessageProvider
}
private static class StatusChangedOperation
implements ListenerOperation<IGpsNavigationMessageListener> {
implements ListenerOperation<IGnssNavigationMessageListener> {
private final int mStatus;
public StatusChangedOperation(int status) {
@ -93,7 +93,7 @@ public abstract class GpsNavigationMessageProvider
}
@Override
public void execute(IGpsNavigationMessageListener listener) throws RemoteException {
public void execute(IGnssNavigationMessageListener listener) throws RemoteException {
listener.onStatusChanged(mStatus);
}
}

View File

@ -537,11 +537,11 @@ static void android_location_GnssLocationProvider_class_init_native(JNIEnv* env,
method_reportMeasurementData = env->GetMethodID(
clazz,
"reportMeasurementData",
"(Landroid/location/GpsMeasurementsEvent;)V");
"(Landroid/location/GnssMeasurementsEvent;)V");
method_reportNavigationMessages = env->GetMethodID(
clazz,
"reportNavigationMessage",
"(Landroid/location/GpsNavigationMessageEvent;)V");
"(Landroid/location/GnssNavigationMessageEvent;)V");
err = hw_get_module(GPS_HARDWARE_MODULE_ID, (hw_module_t const**)&module);
if (err == 0) {
@ -974,7 +974,7 @@ static jobject translate_gps_clock(JNIEnv* env, void* data, size_t size) {
GpsClock* clock = reinterpret_cast<GpsClock*>(data);
jclass gpsClockClass = env->FindClass("android/location/GpsClock");
jclass gpsClockClass = env->FindClass("android/location/GnssClock");
jmethodID gpsClockCtor = env->GetMethodID(gpsClockClass, "<init>", "()V");
jobject gpsClockObject = env->NewObject(gpsClockClass, gpsClockCtor);
@ -1049,264 +1049,264 @@ static jobject translate_gps_measurement(JNIEnv* env, void* data, size_t size) {
const char* floatSignature = "(F)V";
const char* doubleSignature = "(D)V";
jclass gpsMeasurementClass = env->FindClass("android/location/GpsMeasurement");
jmethodID gpsMeasurementCtor = env->GetMethodID(gpsMeasurementClass, "<init>", "()V");
jclass gnssMeasurementClass = env->FindClass("android/location/GnssMeasurement");
jmethodID gnssMeasurementCtor = env->GetMethodID(gnssMeasurementClass, "<init>", "()V");
GpsMeasurement* measurement = reinterpret_cast<GpsMeasurement*>(data);
jobject gpsMeasurementObject = env->NewObject(gpsMeasurementClass, gpsMeasurementCtor);
jobject gnssMeasurementObject = env->NewObject(gnssMeasurementClass, gnssMeasurementCtor);
GpsMeasurementFlags flags = measurement->flags;
jmethodID prnSetterMethod = env->GetMethodID(gpsMeasurementClass, "setPrn", byteSignature);
env->CallVoidMethod(gpsMeasurementObject, prnSetterMethod, measurement->prn);
jmethodID prnSetterMethod = env->GetMethodID(gnssMeasurementClass, "setPrn", byteSignature);
env->CallVoidMethod(gnssMeasurementObject, prnSetterMethod, measurement->prn);
jmethodID timeOffsetSetterMethod =
env->GetMethodID(gpsMeasurementClass, "setTimeOffsetInNs", doubleSignature);
env->GetMethodID(gnssMeasurementClass, "setTimeOffsetInNs", doubleSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
timeOffsetSetterMethod,
measurement->time_offset_ns);
jmethodID stateSetterMethod = env->GetMethodID(gpsMeasurementClass, "setState", shortSignature);
env->CallVoidMethod(gpsMeasurementObject, stateSetterMethod, measurement->state);
jmethodID stateSetterMethod = env->GetMethodID(gnssMeasurementClass, "setState", shortSignature);
env->CallVoidMethod(gnssMeasurementObject, stateSetterMethod, measurement->state);
jmethodID receivedGpsTowSetterMethod =
env->GetMethodID(gpsMeasurementClass, "setReceivedGpsTowInNs", longSignature);
env->GetMethodID(gnssMeasurementClass, "setReceivedGpsTowInNs", longSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
receivedGpsTowSetterMethod,
measurement->received_gps_tow_ns);
jmethodID receivedGpsTowUncertaintySetterMethod = env->GetMethodID(
gpsMeasurementClass,
gnssMeasurementClass,
"setReceivedGpsTowUncertaintyInNs",
longSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
receivedGpsTowUncertaintySetterMethod,
measurement->received_gps_tow_uncertainty_ns);
jmethodID cn0SetterMethod =
env->GetMethodID(gpsMeasurementClass, "setCn0InDbHz", doubleSignature);
env->CallVoidMethod(gpsMeasurementObject, cn0SetterMethod, measurement->c_n0_dbhz);
env->GetMethodID(gnssMeasurementClass, "setCn0InDbHz", doubleSignature);
env->CallVoidMethod(gnssMeasurementObject, cn0SetterMethod, measurement->c_n0_dbhz);
jmethodID pseudorangeRateSetterMethod = env->GetMethodID(
gpsMeasurementClass,
gnssMeasurementClass,
"setPseudorangeRateInMetersPerSec",
doubleSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
pseudorangeRateSetterMethod,
measurement->pseudorange_rate_mps);
jmethodID pseudorangeRateUncertaintySetterMethod = env->GetMethodID(
gpsMeasurementClass,
gnssMeasurementClass,
"setPseudorangeRateUncertaintyInMetersPerSec",
doubleSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
pseudorangeRateUncertaintySetterMethod,
measurement->pseudorange_rate_uncertainty_mps);
jmethodID accumulatedDeltaRangeStateSetterMethod =
env->GetMethodID(gpsMeasurementClass, "setAccumulatedDeltaRangeState", shortSignature);
env->GetMethodID(gnssMeasurementClass, "setAccumulatedDeltaRangeState", shortSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
accumulatedDeltaRangeStateSetterMethod,
measurement->accumulated_delta_range_state);
jmethodID accumulatedDeltaRangeSetterMethod = env->GetMethodID(
gpsMeasurementClass,
gnssMeasurementClass,
"setAccumulatedDeltaRangeInMeters",
doubleSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
accumulatedDeltaRangeSetterMethod,
measurement->accumulated_delta_range_m);
jmethodID accumulatedDeltaRangeUncertaintySetterMethod = env->GetMethodID(
gpsMeasurementClass,
gnssMeasurementClass,
"setAccumulatedDeltaRangeUncertaintyInMeters",
doubleSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
accumulatedDeltaRangeUncertaintySetterMethod,
measurement->accumulated_delta_range_uncertainty_m);
if (flags & GPS_MEASUREMENT_HAS_PSEUDORANGE) {
jmethodID setterMethod =
env->GetMethodID(gpsMeasurementClass, "setPseudorangeInMeters", doubleSignature);
env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->pseudorange_m);
env->GetMethodID(gnssMeasurementClass, "setPseudorangeInMeters", doubleSignature);
env->CallVoidMethod(gnssMeasurementObject, setterMethod, measurement->pseudorange_m);
}
if (flags & GPS_MEASUREMENT_HAS_PSEUDORANGE_UNCERTAINTY) {
jmethodID setterMethod = env->GetMethodID(
gpsMeasurementClass,
gnssMeasurementClass,
"setPseudorangeUncertaintyInMeters",
doubleSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
setterMethod,
measurement->pseudorange_uncertainty_m);
}
if (flags & GPS_MEASUREMENT_HAS_CODE_PHASE) {
jmethodID setterMethod =
env->GetMethodID(gpsMeasurementClass, "setCodePhaseInChips", doubleSignature);
env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->code_phase_chips);
env->GetMethodID(gnssMeasurementClass, "setCodePhaseInChips", doubleSignature);
env->CallVoidMethod(gnssMeasurementObject, setterMethod, measurement->code_phase_chips);
}
if (flags & GPS_MEASUREMENT_HAS_CODE_PHASE_UNCERTAINTY) {
jmethodID setterMethod = env->GetMethodID(
gpsMeasurementClass,
gnssMeasurementClass,
"setCodePhaseUncertaintyInChips",
doubleSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
setterMethod,
measurement->code_phase_uncertainty_chips);
}
if (flags & GPS_MEASUREMENT_HAS_CARRIER_FREQUENCY) {
jmethodID setterMethod =
env->GetMethodID(gpsMeasurementClass, "setCarrierFrequencyInHz", floatSignature);
env->GetMethodID(gnssMeasurementClass, "setCarrierFrequencyInHz", floatSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
setterMethod,
measurement->carrier_frequency_hz);
}
if (flags & GPS_MEASUREMENT_HAS_CARRIER_CYCLES) {
jmethodID setterMethod =
env->GetMethodID(gpsMeasurementClass, "setCarrierCycles", longSignature);
env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->carrier_cycles);
env->GetMethodID(gnssMeasurementClass, "setCarrierCycles", longSignature);
env->CallVoidMethod(gnssMeasurementObject, setterMethod, measurement->carrier_cycles);
}
if (flags & GPS_MEASUREMENT_HAS_CARRIER_PHASE) {
jmethodID setterMethod =
env->GetMethodID(gpsMeasurementClass, "setCarrierPhase", doubleSignature);
env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->carrier_phase);
env->GetMethodID(gnssMeasurementClass, "setCarrierPhase", doubleSignature);
env->CallVoidMethod(gnssMeasurementObject, setterMethod, measurement->carrier_phase);
}
if (flags & GPS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY) {
jmethodID setterMethod = env->GetMethodID(
gpsMeasurementClass,
gnssMeasurementClass,
"setCarrierPhaseUncertainty",
doubleSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
setterMethod,
measurement->carrier_phase_uncertainty);
}
jmethodID lossOfLockSetterMethod =
env->GetMethodID(gpsMeasurementClass, "setLossOfLock", byteSignature);
env->CallVoidMethod(gpsMeasurementObject, lossOfLockSetterMethod, measurement->loss_of_lock);
env->GetMethodID(gnssMeasurementClass, "setLossOfLock", byteSignature);
env->CallVoidMethod(gnssMeasurementObject, lossOfLockSetterMethod, measurement->loss_of_lock);
if (flags & GPS_MEASUREMENT_HAS_BIT_NUMBER) {
jmethodID setterMethod =
env->GetMethodID(gpsMeasurementClass, "setBitNumber", intSignature);
env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->bit_number);
env->GetMethodID(gnssMeasurementClass, "setBitNumber", intSignature);
env->CallVoidMethod(gnssMeasurementObject, setterMethod, measurement->bit_number);
}
if (flags & GPS_MEASUREMENT_HAS_TIME_FROM_LAST_BIT) {
jmethodID setterMethod =
env->GetMethodID(gpsMeasurementClass, "setTimeFromLastBitInMs", shortSignature);
env->GetMethodID(gnssMeasurementClass, "setTimeFromLastBitInMs", shortSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
setterMethod,
measurement->time_from_last_bit_ms);
}
if (flags & GPS_MEASUREMENT_HAS_DOPPLER_SHIFT) {
jmethodID setterMethod =
env->GetMethodID(gpsMeasurementClass, "setDopplerShiftInHz", doubleSignature);
env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->doppler_shift_hz);
env->GetMethodID(gnssMeasurementClass, "setDopplerShiftInHz", doubleSignature);
env->CallVoidMethod(gnssMeasurementObject, setterMethod, measurement->doppler_shift_hz);
}
if (flags & GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY) {
jmethodID setterMethod = env->GetMethodID(
gpsMeasurementClass,
gnssMeasurementClass,
"setDopplerShiftUncertaintyInHz",
doubleSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
setterMethod,
measurement->doppler_shift_uncertainty_hz);
}
jmethodID multipathIndicatorSetterMethod =
env->GetMethodID(gpsMeasurementClass, "setMultipathIndicator", byteSignature);
env->GetMethodID(gnssMeasurementClass, "setMultipathIndicator", byteSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
multipathIndicatorSetterMethod,
measurement->multipath_indicator);
if (flags & GPS_MEASUREMENT_HAS_SNR) {
jmethodID setterMethod =
env->GetMethodID(gpsMeasurementClass, "setSnrInDb", doubleSignature);
env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->snr_db);
env->GetMethodID(gnssMeasurementClass, "setSnrInDb", doubleSignature);
env->CallVoidMethod(gnssMeasurementObject, setterMethod, measurement->snr_db);
}
if (flags & GPS_MEASUREMENT_HAS_ELEVATION) {
jmethodID setterMethod =
env->GetMethodID(gpsMeasurementClass, "setElevationInDeg", doubleSignature);
env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->elevation_deg);
env->GetMethodID(gnssMeasurementClass, "setElevationInDeg", doubleSignature);
env->CallVoidMethod(gnssMeasurementObject, setterMethod, measurement->elevation_deg);
}
if (flags & GPS_MEASUREMENT_HAS_ELEVATION_UNCERTAINTY) {
jmethodID setterMethod =
env->GetMethodID(gpsMeasurementClass, "setElevationUncertaintyInDeg", doubleSignature);
env->GetMethodID(gnssMeasurementClass, "setElevationUncertaintyInDeg", doubleSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
setterMethod,
measurement->elevation_uncertainty_deg);
}
if (flags & GPS_MEASUREMENT_HAS_AZIMUTH) {
jmethodID setterMethod =
env->GetMethodID(gpsMeasurementClass, "setAzimuthInDeg", doubleSignature);
env->CallVoidMethod(gpsMeasurementObject, setterMethod, measurement->azimuth_deg);
env->GetMethodID(gnssMeasurementClass, "setAzimuthInDeg", doubleSignature);
env->CallVoidMethod(gnssMeasurementObject, setterMethod, measurement->azimuth_deg);
}
if (flags & GPS_MEASUREMENT_HAS_AZIMUTH_UNCERTAINTY) {
jmethodID setterMethod = env->GetMethodID(
gpsMeasurementClass,
gnssMeasurementClass,
"setAzimuthUncertaintyInDeg",
doubleSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
setterMethod,
measurement->azimuth_uncertainty_deg);
}
jmethodID usedInFixSetterMethod = env->GetMethodID(gpsMeasurementClass, "setUsedInFix", "(Z)V");
jmethodID usedInFixSetterMethod = env->GetMethodID(gnssMeasurementClass, "setUsedInFix", "(Z)V");
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
usedInFixSetterMethod,
(flags & GPS_MEASUREMENT_HAS_USED_IN_FIX) && measurement->used_in_fix);
if (size == sizeof(GpsMeasurement)) {
jmethodID setterMethod =
env->GetMethodID(gpsMeasurementClass,
env->GetMethodID(gnssMeasurementClass,
"setPseudorangeRateCarrierInMetersPerSec",
doubleSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
setterMethod,
measurement->pseudorange_rate_carrier_mps);
setterMethod =
env->GetMethodID(gpsMeasurementClass,
env->GetMethodID(gnssMeasurementClass,
"setPseudorangeRateCarrierUncertaintyInMetersPerSec",
doubleSignature);
env->CallVoidMethod(
gpsMeasurementObject,
gnssMeasurementObject,
setterMethod,
measurement->pseudorange_rate_carrier_uncertainty_mps);
}
env->DeleteLocalRef(gpsMeasurementClass);
return gpsMeasurementObject;
env->DeleteLocalRef(gnssMeasurementClass);
return gnssMeasurementObject;
}
/**
@ -1321,23 +1321,23 @@ static jobjectArray translate_gps_measurements(JNIEnv* env, void* data) {
return NULL;
}
jclass gpsMeasurementClass = env->FindClass("android/location/GpsMeasurement");
jobjectArray gpsMeasurementArray = env->NewObjectArray(
jclass gnssMeasurementClass = env->FindClass("android/location/GnssMeasurement");
jobjectArray gnssMeasurementArray = env->NewObjectArray(
measurementCount,
gpsMeasurementClass,
gnssMeasurementClass,
NULL /* initialElement */);
for (uint16_t i = 0; i < measurementCount; ++i) {
jobject gpsMeasurement = translate_gps_measurement(
jobject gnssMeasurement = translate_gps_measurement(
env,
&(gps_data->measurements[i]),
sizeof(gps_data->measurements[0]));
env->SetObjectArrayElement(gpsMeasurementArray, i, gpsMeasurement);
env->DeleteLocalRef(gpsMeasurement);
env->SetObjectArrayElement(gnssMeasurementArray, i, gnssMeasurement);
env->DeleteLocalRef(gnssMeasurement);
}
env->DeleteLocalRef(gpsMeasurementClass);
return gpsMeasurementArray;
env->DeleteLocalRef(gnssMeasurementClass);
return gnssMeasurementArray;
}
static void measurement_callback(GpsData* data) {
@ -1360,25 +1360,25 @@ static void measurement_callback(GpsData* data) {
gpsClock = translate_gps_clock(env, &data->clock, sizeof(GpsClock_v1));
measurementArray = translate_gps_measurements<GpsData_v1>(env, data);
}
jclass gpsMeasurementsEventClass = env->FindClass("android/location/GpsMeasurementsEvent");
jmethodID gpsMeasurementsEventCtor = env->GetMethodID(
gpsMeasurementsEventClass,
jclass gnssMeasurementsEventClass = env->FindClass("android/location/GnssMeasurementsEvent");
jmethodID gnssMeasurementsEventCtor = env->GetMethodID(
gnssMeasurementsEventClass,
"<init>",
"(Landroid/location/GpsClock;[Landroid/location/GpsMeasurement;)V");
"(Landroid/location/GnssClock;[Landroid/location/GnssMeasurement;)V");
jobject gpsMeasurementsEvent = env->NewObject(
gpsMeasurementsEventClass,
gpsMeasurementsEventCtor,
jobject gnssMeasurementsEvent = env->NewObject(
gnssMeasurementsEventClass,
gnssMeasurementsEventCtor,
gpsClock,
measurementArray);
env->CallVoidMethod(mCallbacksObj, method_reportMeasurementData, gpsMeasurementsEvent);
env->CallVoidMethod(mCallbacksObj, method_reportMeasurementData, gnssMeasurementsEvent);
checkAndClearExceptionFromCallback(env, __FUNCTION__);
env->DeleteLocalRef(gpsClock);
env->DeleteLocalRef(measurementArray);
env->DeleteLocalRef(gpsMeasurementsEventClass);
env->DeleteLocalRef(gpsMeasurementsEvent);
env->DeleteLocalRef(gnssMeasurementsEventClass);
env->DeleteLocalRef(gnssMeasurementsEvent);
}
GpsMeasurementCallbacks sGpsMeasurementCallbacks = {
@ -1432,7 +1432,7 @@ static jobject translate_gps_navigation_message(JNIEnv* env, GpsNavigationMessag
return NULL;
}
jclass navigationMessageClass = env->FindClass("android/location/GpsNavigationMessage");
jclass navigationMessageClass = env->FindClass("android/location/GnssNavigationMessage");
jmethodID navigationMessageCtor = env->GetMethodID(navigationMessageClass, "<init>", "()V");
jobject navigationMessageObject = env->NewObject(navigationMessageClass, navigationMessageCtor);
@ -1470,11 +1470,11 @@ static void navigation_message_callback(GpsNavigationMessage* message) {
jobject navigationMessage = translate_gps_navigation_message(env, message);
jclass navigationMessageEventClass =
env->FindClass("android/location/GpsNavigationMessageEvent");
env->FindClass("android/location/GnssNavigationMessageEvent");
jmethodID navigationMessageEventCtor = env->GetMethodID(
navigationMessageEventClass,
"<init>",
"(Landroid/location/GpsNavigationMessage;)V");
"(Landroid/location/GnssNavigationMessage;)V");
jobject navigationMessageEvent = env->NewObject(
navigationMessageEventClass,
navigationMessageEventCtor,