Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff4f9ce4 authored by Grant Menke's avatar Grant Menke
Browse files

Fix completableFuture exception handling in call.

Ensured runtime exceptions that occur in the call path are not
swallowed. Added locations where exceptions are caught and handled. If a
runtime exceptions occurs while connecting an emergency call, added a
check that sets the current call to disconnected and removed to prevent future
calls from failing to connect.

Bug: 243811811
Test: Manual Test
Change-Id: I5e0cf1489dc2e93e81b260696619580245565fac
parent d4c96ab6
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -1648,6 +1648,9 @@ public class CallsManager extends Call.ListenerBase
        // retrieved.
        CompletableFuture<List<PhoneAccountHandle>> setAccountHandle =
                accountsForCall.whenCompleteAsync((potentialPhoneAccounts, exception) -> {
                    if (exception != null){
                        Log.e(TAG, exception, "Error retrieving list of potential phone accounts.");
                    }
                    Log.i(CallsManager.this, "set outgoing call phone acct; potentialAccts=%s",
                            potentialPhoneAccounts);
                    PhoneAccountHandle phoneAccountHandle;
@@ -2437,8 +2440,17 @@ public class CallsManager extends Call.ListenerBase
                    // Drop any ongoing self-managed calls to make way for an emergency call.
                    disconnectSelfManagedCalls("place emerg call" /* reason */);
                }

                try {
                    call.startCreateConnection(mPhoneAccountRegistrar);
                } catch (Exception exception) {
                    // If an exceptions is thrown while creating the connection, disconnect.
                    Log.e(TAG, exception, "Exception thrown while establishing connection.");
                    markCallAsDisconnected(call,
                            new DisconnectCause(DisconnectCause.ERROR,
                            "Failed to create the connection."));
                    markCallAsRemoved(call);
                }

            }
        } else if (mPhoneAccountRegistrar.getCallCapablePhoneAccounts(
                requireCallCapableAccountByHandle ? callHandleScheme : null, false,