[RTT] Ranging timestamp is in millis

API review mods: change ranging timestamp to milliseconds. Update
docs to clarify which time is being measured.

Bug: 73088768
Test: unit tests & integration tests
Change-Id: I8a81e92d1a3d264abd98a1695be6a5da6fa5f6a1
This commit is contained in:
Etan Cohen
2018-02-13 16:27:20 -08:00
parent 11fa8355d4
commit 4577b9b17c
3 changed files with 8 additions and 5 deletions

View File

@@ -28524,7 +28524,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

@@ -228,15 +228,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;
}