Merge "Change TelephonyConnection to use onDisconnect callback from original conn."
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 2358160..a1b48d0 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -33,6 +33,7 @@
 import android.telecom.TelecomManager;
 import android.telecom.VideoProfile;
 import android.telephony.CarrierConfigManager;
+import android.telephony.DisconnectCause;
 import android.telephony.PhoneNumberUtils;
 import android.telephony.TelephonyManager;
 import android.util.Pair;
@@ -443,6 +444,12 @@
                 sendRttInitiationFailure(status);
             }
         }
+
+        @Override
+        public void onDisconnect(int cause) {
+            Log.i(this, "onDisconnect: cause=%s", DisconnectCause.toString(cause));
+            mHandler.obtainMessage(MSG_DISCONNECT);
+        }
     };
 
     protected com.android.internal.telephony.Connection mOriginalConnection;
@@ -889,7 +896,6 @@
         getPhone().registerForHandoverStateChanged(
                 mHandler, MSG_HANDOVER_STATE_CHANGED, null);
         getPhone().registerForRingbackTone(mHandler, MSG_RINGBACK_TONE, null);
-        getPhone().registerForDisconnect(mHandler, MSG_DISCONNECT, null);
         getPhone().registerForSuppServiceNotification(mHandler, MSG_SUPP_SERVICE_NOTIFY, null);
         getPhone().registerForOnHoldTone(mHandler, MSG_ON_HOLD_TONE, null);
         getPhone().registerForInCallVoicePrivacyOn(mHandler, MSG_CDMA_VOICE_PRIVACY_ON, null);
@@ -1329,7 +1335,8 @@
             newState = mOriginalConnection.getState();
         }
         int cause = mOriginalConnection.getDisconnectCause();
-        Log.v(this, "Update state from %s to %s for %s", mConnectionState, newState, this);
+        Log.v(this, "Update state from %s to %s for %s", mConnectionState, newState,
+                getTelecomCallId());
 
         if (mConnectionState != newState) {
             mConnectionState = newState;