summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrad Ebinger <breadley@google.com>2021-08-11 18:21:44 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-08-11 18:21:44 +0000
commit809b8f06962b1f69fcfc1a82ed520c8562e0ec4d (patch)
treee15e935aeda5ff60e5e3c5925245f02c6a94b44f /src
parent32c412aa7ea61ff87545d0215c8cb740eb53c042 (diff)
parent2ad2250609ad2c021f1a3ba2e6da1c474069f855 (diff)
downloadplatform_packages_services_Telephony-809b8f06962b1f69fcfc1a82ed520c8562e0ec4d.tar.gz
platform_packages_services_Telephony-809b8f06962b1f69fcfc1a82ed520c8562e0ec4d.tar.bz2
platform_packages_services_Telephony-809b8f06962b1f69fcfc1a82ed520c8562e0ec4d.zip
Merge "Retry sending hangup command on new connection after redial completes" into sc-dev am: 2ad2250609
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/services/Telephony/+/15520334 Change-Id: Ia295b93766158c99cb720955f19b4b4d4d39a7ea
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/android/services/telephony/TelephonyConnection.java75
1 files changed, 49 insertions, 26 deletions
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index abc961361..53e923ef7 100755
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -165,32 +165,7 @@ abstract class TelephonyConnection extends Connection implements Holdable, Commu
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 &&
- mOriginalConnection.getAddress() != null &&
- mOriginalConnection.getAddress().equals(connection.getAddress())) ||
- connection.getState() == mOriginalConnection.getStateBeforeHandover())) {
- Log.i(TelephonyConnection.this, "Setting original connection after"
- + " handover or redial, current original connection="
- + mOriginalConnection.toString()
- + ", new original connection="
- + connection.toString());
- setOriginalConnection(connection);
- mWasImsConnection = false;
- }
- } else {
- Log.w(TelephonyConnection.this,
- what + ": mOriginalConnection==null --"
- + " invalid state (not cleaned up)");
- }
+ onOriginalConnectionRedialed(connection);
break;
case MSG_RINGBACK_TONE:
Log.v(TelephonyConnection.this, "MSG_RINGBACK_TONE");
@@ -360,6 +335,54 @@ abstract class TelephonyConnection extends Connection implements Holdable, Commu
private final Messenger mHandlerMessenger = new Messenger(mHandler);
/**
+ * The underlying telephony Connection has been redialed on a different domain (CS or IMS).
+ * Track the new telephony Connection and set back up appropriate callbacks.
+ * @param connection The new telephony Connection associated with this TelephonyConnection.
+ */
+ @VisibleForTesting
+ public void onOriginalConnectionRedialed(
+ com.android.internal.telephony.Connection connection) {
+ if (connection == null) {
+ setDisconnected(DisconnectCauseUtil
+ .toTelecomDisconnectCause(DisconnectCause.OUT_OF_NETWORK,
+ "handover failure, no connection"));
+ close();
+ return;
+ }
+ if (mOriginalConnection != null) {
+ if ((connection.getAddress() != null
+ && mOriginalConnection.getAddress() != null
+ && mOriginalConnection.getAddress().equals(connection.getAddress()))
+ || connection.getState() == mOriginalConnection.getStateBeforeHandover()) {
+ Log.i(TelephonyConnection.this, "Setting original connection after"
+ + " handover or redial, current original connection="
+ + mOriginalConnection.toString()
+ + ", new original connection="
+ + connection.toString());
+ setOriginalConnection(connection);
+ mWasImsConnection = false;
+ if (mHangupDisconnectCause != DisconnectCause.NOT_VALID) {
+ // A hangup request was initiated during the handover process, so
+ // go ahead and initiate the hangup on the new connection.
+ try {
+ Log.i(TelephonyConnection.this, "user has tried to hangup "
+ + "during handover, retrying hangup.");
+ connection.hangup();
+ } catch (CallStateException e) {
+ // Call state exception may be thrown if the connection was
+ // already disconnected, so just log this case.
+ Log.w(TelephonyConnection.this, "hangup during "
+ + "handover or redial resulted in an exception:" + e);
+ }
+ }
+ }
+ } else {
+ Log.w(TelephonyConnection.this, " mOriginalConnection==null --"
+ + " invalid state (not cleaned up)");
+ }
+ }
+
+ /**
* Handles {@link SuppServiceNotification}s pertinent to Telephony.
* @param ssn the notification.
*/