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

Commit 2b862e5e authored by Vinit Deshapnde's avatar Vinit Deshapnde
Browse files

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
parent d6957d5f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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));
+3 −0
Original line number Diff line number Diff line
@@ -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);