Fix incorrect VPN time
First, startTime's default value is -1 and not 0, so use it to test
if the startTime is set. Also, startTime isn't being set when connecting
legacy VPN; this change fixes that too.
Bug: 10985174
Change-Id: Ibf52b8f489b18c96efba501b76aa73e9a9e0e3e8
diff --git a/services/java/com/android/server/connectivity/Vpn.java b/services/java/com/android/server/connectivity/Vpn.java
index 8cc5b4f..45797b2 100644
--- a/services/java/com/android/server/connectivity/Vpn.java
+++ b/services/java/com/android/server/connectivity/Vpn.java
@@ -1096,6 +1096,9 @@
// Here is the last step and it must be done synchronously.
synchronized (Vpn.this) {
+ // Set the start time
+ mConfig.startTime = SystemClock.elapsedRealtime();
+
// Check if the thread is interrupted while we are waiting.
checkpoint(false);