Adding connect time support to call objects.

Change-Id: I4b39694720fcec5b6975a19361ec5d91d4d5062d
diff --git a/common/src/com/android/services/telephony/common/Call.java b/common/src/com/android/services/telephony/common/Call.java
index 088a06d..6c85f44 100644
--- a/common/src/com/android/services/telephony/common/Call.java
+++ b/common/src/com/android/services/telephony/common/Call.java
@@ -129,17 +129,36 @@
     // show pay phone info
     public static int PRESENTATION_PAYPHONE = PhoneConstants.PRESENTATION_PAYPHONE;
 
+    // Unique identifier for the call
     private int mCallId = INVALID_CALL_ID;
+
+    // The phone number on the other end of the connection
     private String mNumber = "";
+
+    // The current state of the call
     private int mState = State.INVALID;
+
+    // Number presentation received from the carrier
     private int mNumberPresentation = PRESENTATION_ALLOWED;
+
+    // Name presentation mode received from the carrier
     private int mCnapNamePresentation = PRESENTATION_ALLOWED;
+
+    // Name associated with the other end of the connection; from the carrier.
     private String mCnapName = "";
+
+    // Reason for disconnect. Valid when the call state is DISCONNECTED.
     private DisconnectCause mDisconnectCause;
+
+    // Bit mask of capabilities unique to this call.
     private int mCapabilities;
 
+    // Time that this call transitioned into ACTIVE state from INCOMING, WAITING, or OUTGOING.
+    private long mConnectTime;
+
     public Call(int callId) {
         mCallId = callId;
+        mConnectTime = 0;
     }
 
     public int getCallId() {
@@ -214,6 +233,14 @@
         setCapabilities(capabilities | mCapabilities);
     }
 
+    public void setConnectTime(long connectTime) {
+        mConnectTime = connectTime;
+    }
+
+    public long getConnectTime() {
+        return mConnectTime;
+    }
+
     /**
      * Parcelable implementation
      */
@@ -228,6 +255,7 @@
         dest.writeString(mCnapName);
         dest.writeString(getDisconnectCause().toString());
         dest.writeInt(getCapabilities());
+        dest.writeLong(getConnectTime());
     }
 
     @Override
@@ -264,6 +292,7 @@
         mCnapName = in.readString();
         mDisconnectCause = DisconnectCause.valueOf(in.readString());
         mCapabilities = in.readInt();
+        mConnectTime = in.readLong();
     }
 
     @Override
diff --git a/src/com/android/phone/CallModeler.java b/src/com/android/phone/CallModeler.java
index 154b155..63879a4 100644
--- a/src/com/android/phone/CallModeler.java
+++ b/src/com/android/phone/CallModeler.java
@@ -265,6 +265,12 @@
             changed = true;
         }
 
+        final long oldConnectTime = call.getConnectTime();
+        if (oldConnectTime != connection.getConnectTime()) {
+            call.setConnectTime(connection.getConnectTime());
+            changed = true;
+        }
+
         /**
          * !!! Uses values from connection and call collected above so this part must be last !!!
          */