diff --git a/api/current.txt b/api/current.txt index 9356a353f0c77..79f328e6a4001 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28643,6 +28643,8 @@ package android.net.wifi.rtt { method public int getDistanceMm(); method public int getDistanceStdDevMm(); method public android.net.MacAddress getMacAddress(); + method public int getNumAttemptedMeasurements(); + method public int getNumSuccessfulMeasurements(); method public android.net.wifi.aware.PeerHandle getPeerHandle(); method public long getRangingTimestampMillis(); method public int getRssi(); diff --git a/wifi/java/android/net/wifi/rtt/RangingResult.java b/wifi/java/android/net/wifi/rtt/RangingResult.java index 5518d35eb4c7f..758a8d559e4e6 100644 --- a/wifi/java/android/net/wifi/rtt/RangingResult.java +++ b/wifi/java/android/net/wifi/rtt/RangingResult.java @@ -170,7 +170,9 @@ public final class RangingResult implements Parcelable { /** * @return The standard deviation of the measured distance (in mm) to the device specified by * {@link #getMacAddress()} or {@link #getPeerHandle()}. The standard deviation is calculated - * over the measurements executed in a single RTT burst. + * over the measurements executed in a single RTT burst. The number of measurements is returned + * by {@link #getNumSuccessfulMeasurements()} - 0 successful measurements indicate that the + * standard deviation is not valid (a valid standard deviation requires at least 2 data points). *
* Only valid if {@link #getStatus()} returns {@link #STATUS_SUCCESS}, otherwise will throw an * exception. @@ -199,11 +201,12 @@ public final class RangingResult implements Parcelable { /** * @return The number of attempted measurements used in the RTT exchange resulting in this set - * of results. + * of results. The number of successful measurements is returned by + * {@link #getNumSuccessfulMeasurements()} which at most, if there are no errors, will be 1 less + * that the number of attempted measurements. *
* Only valid if {@link #getStatus()} returns {@link #STATUS_SUCCESS}, otherwise will throw an * exception. - * @hide */ public int getNumAttemptedMeasurements() { if (mStatus != STATUS_SUCCESS) { @@ -220,9 +223,12 @@ public final class RangingResult implements Parcelable { * returned by {@link #getDistanceStdDevMm()}, is not valid (a 0 is returned for the standard * deviation). *
+ * The total number of measurement attempts is returned by + * {@link #getNumAttemptedMeasurements()}. The number of successful measurements will be at + * most 1 less then the number of attempted measurements. + *
* Only valid if {@link #getStatus()} returns {@link #STATUS_SUCCESS}, otherwise will throw an * exception. - * @hide */ public int getNumSuccessfulMeasurements() { if (mStatus != STATUS_SUCCESS) {