IMS: fix missed call notification not shown.
Differentiate the missed call/rejected call during onCallTerminated callback.
Also remove the onCallTerminiated from onCallStartFailed as
onCallTerminated should be triggered by the vendor ims.

Bug: 17142654
Change-Id: I107717c21f7da89e945cf74d14fbe2d2d24f94b3
diff --git a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
index 4042a85..780f471 100644
--- a/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
+++ b/src/java/com/android/internal/telephony/imsphone/ImsPhoneCallTracker.java
@@ -946,7 +946,6 @@
                 }
                 mPendingMO = null;
             }
-            onCallTerminated(imsCall, reasonInfo);
         }
 
         @Override
@@ -954,9 +953,19 @@
             if (DBG) log("onCallTerminated reasonCode=" + reasonInfo.getCode());
 
             ImsPhoneCall.State oldState = mForegroundCall.getState();
+            int cause = getDisconnectCauseFromReasonInfo(reasonInfo);
+            ImsPhoneConnection conn = findConnection(imsCall);
+            if (DBG) log("cause = " + cause + " conn = " + conn);
 
-            processCallStateChange(imsCall, ImsPhoneCall.State.DISCONNECTED,
-                    getDisconnectCauseFromReasonInfo(reasonInfo));
+            if (conn.isIncoming() && conn.getConnectTime() == 0) {
+                // Missed or rejected call
+                if (cause == DisconnectCause.LOCAL) {
+                    cause = DisconnectCause.INCOMING_REJECTED;
+               } else {
+                    cause = DisconnectCause.INCOMING_MISSED;
+               }
+            }
+            processCallStateChange(imsCall, ImsPhoneCall.State.DISCONNECTED, cause);
 
             if (reasonInfo.getCode() == ImsReasonInfo.CODE_USER_TERMINATED) {
                 if ((oldState == ImsPhoneCall.State.DISCONNECTING)