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

Commit 3d5716b1 authored by Tyler Gunn's avatar Tyler Gunn Committed by android-build-merger
Browse files

Provide error message when no available account to place a call.

am: 5ee82e0a

Change-Id: Ia1b1c8f4f56a0db5d9eea42e41f2be93e8af6c32
parents 88ad2afb 5ee82e0a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -249,6 +249,12 @@
    <!-- The "decline" button for an incoming call. [CHAR LIMIT=60] -->
    <string name="decline_incoming_call">Decline</string>

    <!-- Error message shown to the user when an outgoing call cannot be placed because there no
         calling service is present on the device which supports this call type.
         This is typically encountered when the user tries to dial a SIP/VOIP call, but there are
         no calling services present which support SIP calling. [CHAR LIMIT=none] -->
    <string name="cant_call_due_to_no_supported_service">Call cannot be placed because there are no calling accounts which support calls of this type.</string>

    <!-- Error message shown to the user when an outgoing call cannot be placed due to an ongoing
         phone call in a third-party app.  For example:
         Call cannot be placed due to your Duo call. [CHAR LIMIT=none] -->
+13 −0
Original line number Diff line number Diff line
@@ -1417,6 +1417,7 @@ public class CallsManager extends Call.ListenerBase
                            if (accountSuggestions == null || accountSuggestions.isEmpty()) {
                                Log.i(CallsManager.this, "Aborting call since there are no"
                                        + " available accounts.");
                                showErrorMessage(R.string.cant_call_due_to_no_supported_service);
                                return CompletableFuture.completedFuture(null);
                            }
                            boolean needsAccountSelection = accountSuggestions.size() > 1
@@ -4469,4 +4470,16 @@ public class CallsManager extends Call.ListenerBase
        return mCalls.stream().filter(c -> c.isEmergencyCall()
                || c.isNetworkIdentifiedEmergencyCall()).count() > 0;
    }

    /**
     * Trigger display of an error message to the user; we do this outside of dialer for calls which
     * fail to be created and added to Dialer.
     * @param messageId The string resource id.
     */
    private void showErrorMessage(int messageId) {
        final Intent errorIntent = new Intent(mContext, ErrorDialogActivity.class);
        errorIntent.putExtra(ErrorDialogActivity.ERROR_MESSAGE_ID_EXTRA, messageId);
        errorIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mContext.startActivityAsUser(errorIntent, UserHandle.CURRENT);
    }
}