summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinit Deshapnde <vinitd@google.com>2013-10-02 11:50:39 -0700
committerVinit Deshapnde <vinitd@google.com>2013-10-02 11:50:39 -0700
commit2b862e5e75ad419f17a4cea185b9349e0da70e7b (patch)
tree9a7c7f92ef6d8bd6f29339ee361144630e033d82
parentd6957d5f8ddf3b542996955bf2d6efe0e9804ef4 (diff)
downloadframeworks_base-2b862e5e75ad419f17a4cea185b9349e0da70e7b.zip
frameworks_base-2b862e5e75ad419f17a4cea185b9349e0da70e7b.tar.gz
frameworks_base-2b862e5e75ad419f17a4cea185b9349e0da70e7b.tar.bz2
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
-rw-r--r--packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java2
-rw-r--r--services/java/com/android/server/connectivity/Vpn.java3
2 files changed, 4 insertions, 1 deletions
diff --git a/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java b/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java
index 42b8cce..3d5654a 100644
--- a/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java
+++ b/packages/VpnDialogs/src/com/android/vpndialogs/ManageDialog.java
@@ -147,7 +147,7 @@ public class ManageDialog extends AlertActivity implements
mHandler.removeMessages(0);
if (!isFinishing()) {
- if (mConfig.startTime != 0) {
+ if (mConfig.startTime != -1) {
long seconds = (SystemClock.elapsedRealtime() - mConfig.startTime) / 1000;
mDuration.setText(String.format("%02d:%02d:%02d",
seconds / 3600, seconds / 60 % 60, seconds % 60));
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 @@ public class Vpn extends BaseNetworkStateTracker {
// 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);