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: If19011fc0c905948f2e42b975cfcc5f8672a95fb
This commit is contained in:
Hugo Benichi
2016-10-17 14:21:33 +09:00
committed by Lorenzo Colitti
parent 94dcb3c3fd
commit dafc44ea11

View File

@@ -283,10 +283,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 {