DO NOT MERGE ApfFilter: use elapsedRealTime for RA lifetime

This patch replaces System.currentTimeMillis() with
SystemClock.elapsedRealTime() to make RA lifetime computation more
resilient to various external events inducing jumps in
currentTimeMillis().

Test: ApfTest passes.

(cherry picked from commit 305af8e98a)

Change-Id: Idbde700025fecfecefb8162d66b94194a87829d5
This commit is contained in:
Hugo Benichi
2016-10-17 14:21:33 +09:00
parent c81837495d
commit 4c0b7cc776

View File

@@ -285,10 +285,9 @@ public class ApfFilter {
mReceiveThread.start(); mReceiveThread.start();
} }
// Returns seconds since Unix Epoch. // Returns seconds since device boot.
// TODO: use SystemClock.elapsedRealtime() instead
private static long curTime() { private static long curTime() {
return System.currentTimeMillis() / DateUtils.SECOND_IN_MILLIS; return SystemClock.elapsedRealtime() / DateUtils.SECOND_IN_MILLIS;
} }
public static class InvalidRaException extends Exception { public static class InvalidRaException extends Exception {