OSDN Git Service

Fix connect duration for un-established SIP calls.
authorHung-ying Tyan <tyanh@google.com>
Thu, 21 Oct 2010 07:54:46 +0000 (15:54 +0800)
committerHung-ying Tyan <tyanh@google.com>
Thu, 21 Oct 2010 07:54:46 +0000 (15:54 +0800)
Bug: 3118364
Change-Id: I931b675de04a3aac70b45d6bae27ab42a84f2d1e

telephony/java/com/android/internal/telephony/sip/SipConnectionBase.java

index d546a08..154a334 100644 (file)
@@ -49,7 +49,7 @@ abstract class SipConnectionBase extends Connection {
      * calculating deltas.
      */
     private long connectTimeReal;
-    private long duration;
+    private long duration = -1L;
     private long holdingStartTime;  // The time when the Connection last transitioned
                             // into HOLDING
 
@@ -74,7 +74,7 @@ abstract class SipConnectionBase extends Connection {
                 }
                 break;
             case DISCONNECTED:
-                duration = SystemClock.elapsedRealtime() - connectTimeReal;
+                duration = getDurationMillis();
                 disconnectTime = System.currentTimeMillis();
                 break;
             case HOLDING:
@@ -102,7 +102,7 @@ abstract class SipConnectionBase extends Connection {
     public long getDurationMillis() {
         if (connectTimeReal == 0) {
             return 0;
-        } else if (duration == 0) {
+        } else if (duration < 0) {
             return SystemClock.elapsedRealtime() - connectTimeReal;
         } else {
             return duration;