Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4577b9b1 authored by Etan Cohen's avatar Etan Cohen
Browse files

[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
parent 11fa8355
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
+1 −1
Original line number Diff line number Diff line
@@ -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;
+6 −3
Original line number Diff line number Diff line
@@ -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;
    }