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

Commit 309cef92 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 am: 3d5716b1

am: 215e11ca

Change-Id: I88ef742a2b143d1cfdc55d772e342bfb2f0502ff
parents 354bf612 215e11ca
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
@@ -1432,6 +1432,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
@@ -4553,4 +4554,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);
    }
}