Merge "Fix silent redial operation"
am: ddbac41b70
Change-Id: I53fc21a17b500ef477932b4655c144a7bfcdf5e6
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 1601f00..7f846a9 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -102,6 +102,7 @@
private static final int MSG_HANGUP = 17;
private static final int MSG_SET_CALL_RADIO_TECH = 18;
private static final int MSG_ON_CONNECTION_EVENT = 19;
+ private static final int MSG_REDIAL_CONNECTION_CHANGED = 20;
private final Handler mHandler = new Handler(Looper.getMainLooper()) {
@Override
@@ -112,10 +113,20 @@
updateState();
break;
case MSG_HANDOVER_STATE_CHANGED:
- Log.v(TelephonyConnection.this, "MSG_HANDOVER_STATE_CHANGED");
+ case MSG_REDIAL_CONNECTION_CHANGED:
+ String what = (msg.what == MSG_HANDOVER_STATE_CHANGED)
+ ? "MSG_HANDOVER_STATE_CHANGED" : "MSG_REDIAL_CONNECTION_CHANGED";
+ Log.v(TelephonyConnection.this, what);
AsyncResult ar = (AsyncResult) msg.obj;
com.android.internal.telephony.Connection connection =
(com.android.internal.telephony.Connection) ar.result;
+ if (connection == null) {
+ setDisconnected(DisconnectCauseUtil
+ .toTelecomDisconnectCause(DisconnectCause.OUT_OF_NETWORK,
+ "handover failure, no connection"));
+ close();
+ break;
+ }
if (mOriginalConnection != null) {
if (connection != null &&
((connection.getAddress() != null &&
@@ -130,7 +141,7 @@
}
} else {
Log.w(TelephonyConnection.this,
- "MSG_HANDOVER_STATE_CHANGED: mOriginalConnection==null - invalid state (not cleaned up)");
+ what + ": mOriginalConnection==null - invalid state (not cleaned up)");
}
break;
case MSG_RINGBACK_TONE:
@@ -1178,6 +1189,8 @@
mHandler, MSG_PRECISE_CALL_STATE_CHANGED, null);
getPhone().registerForHandoverStateChanged(
mHandler, MSG_HANDOVER_STATE_CHANGED, null);
+ getPhone().registerForRedialConnectionChanged(
+ mHandler, MSG_REDIAL_CONNECTION_CHANGED, null);
getPhone().registerForRingbackTone(mHandler, MSG_RINGBACK_TONE, null);
getPhone().registerForSuppServiceNotification(mHandler, MSG_SUPP_SERVICE_NOTIFY, null);
getPhone().registerForOnHoldTone(mHandler, MSG_ON_HOLD_TONE, null);
@@ -1426,6 +1439,7 @@
getPhone().unregisterForPreciseCallStateChanged(mHandler);
getPhone().unregisterForRingbackTone(mHandler);
getPhone().unregisterForHandoverStateChanged(mHandler);
+ getPhone().unregisterForRedialConnectionChanged(mHandler);
getPhone().unregisterForDisconnect(mHandler);
getPhone().unregisterForSuppServiceNotification(mHandler);
getPhone().unregisterForOnHoldTone(mHandler);