Fix unknown call logic for multi-endpoint.
When adding a new unknownn call, ensure we don't try to reuse an existing
actual call to represent an extral call. This will happen when a call is
pulled away from the device. We want the actual call to disconnect so it
can be logged, and a new unknown call to be created to represent the now
external version of that call.
Bug: 27458894
Change-Id: Ib5e950bce66011afab32257ff61d36b6b0d252a9
diff --git a/src/com/android/services/telephony/PstnIncomingCallNotifier.java b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
index b4733dd..47fac6a 100644
--- a/src/com/android/services/telephony/PstnIncomingCallNotifier.java
+++ b/src/com/android/services/telephony/PstnIncomingCallNotifier.java
@@ -312,6 +312,17 @@
Connection original = telephonyConnection.getOriginalConnection();
if (original != null && !original.isIncoming()
&& Objects.equals(original.getAddress(), unknown.getAddress())) {
+ // If the new unknown connection is an external connection, don't swap one with an
+ // actual connection. This means a call got pulled away. We want the actual connection
+ // to disconnect.
+ if (unknown instanceof ImsExternalConnection &&
+ !(telephonyConnection
+ .getOriginalConnection() instanceof ImsExternalConnection)) {
+ Log.v(this, "maybeSwapWithUnknownConnection - not swapping regular connection " +
+ "with external connection.");
+ return false;
+ }
+
telephonyConnection.setOriginalConnection(unknown);
return true;
}