Always get the latest Connection in the call for the incoming case

For the auto-missed call scenario, a disconnected connection may
still be tracked in the Call. If getEarliestConnection is used,
it will grab a potentially disconnected call vs the newest incoming
call.

Instead, always grab the latest connection, since this is most
likely going to be the connection that the incoming call notification
is for.

Bug: 193910479
Test: incoming call tests
Change-Id: Idc46344935357a7216768aea4579761d79bb51ec
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index 7a0d8c2..766a75e 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -1199,9 +1199,9 @@
             return connection;
         }
 
-        com.android.internal.telephony.Connection originalConnection =
-                call.getState() == Call.State.WAITING ?
-                    call.getLatestConnection() : call.getEarliestConnection();
+        // If there are multiple Connections tracked in a call, grab the latest, since it is most
+        // likely to be the incoming call.
+        com.android.internal.telephony.Connection originalConnection = call.getLatestConnection();
         if (isOriginalConnectionKnown(originalConnection)) {
             Log.i(this, "onCreateIncomingConnection, original connection already registered");
             return Connection.createCanceledConnection();