Merge "[RTT] Ranging timestamp is in millis"

This commit is contained in:
Etan Cohen
2018-02-17 05:27:30 +00:00
committed by Android (Google) Code Review
3 changed files with 8 additions and 5 deletions

View File

@@ -28531,7 +28531,7 @@ package android.net.wifi.rtt {
method public int getDistanceStdDevMm();
method public android.net.MacAddress getMacAddress();
method public android.net.wifi.aware.PeerHandle getPeerHandle();
method public long getRangingTimestampUs();
method public long getRangingTimestampMillis();
method public int getRssi();
method public int getStatus();
method public void writeToParcel(android.os.Parcel, int);

View File

@@ -992,7 +992,7 @@ public class RttManager {
legacyResults[i].distanceStandardDeviation =
result.getDistanceStdDevMm() / 10;
legacyResults[i].rssi = result.getRssi() * -2;
legacyResults[i].ts = result.getRangingTimestampUs();
legacyResults[i].ts = result.getRangingTimestampMillis() * 1000;
} else {
// just in case legacy API needed some relatively real timestamp
legacyResults[i].ts = SystemClock.elapsedRealtime() * 1000;

View File

@@ -226,15 +226,18 @@ public final class RangingResult implements Parcelable {
}
/**
* @return The timestamp, in us since boot, at which the ranging operation was performed.
* @return The timestamp at which the ranging operation was performed. The timestamp is in
* milliseconds since boot, including time spent in sleep, corresponding to values provided by
* {@link android.os.SystemClock#elapsedRealtime()}.
* <p>
* Only valid if {@link #getStatus()} returns {@link #STATUS_SUCCESS}, otherwise will throw an
* exception.
*/
public long getRangingTimestampUs() {
public long getRangingTimestampMillis() {
if (mStatus != STATUS_SUCCESS) {
throw new IllegalStateException(
"getRangingTimestamp(): invoked on an invalid result: getStatus()=" + mStatus);
"getRangingTimestampMillis(): invoked on an invalid result: getStatus()="
+ mStatus);
}
return mTimestamp;
}