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

Commit 752cacbc authored by Sailesh Nepal's avatar Sailesh Nepal
Browse files

Continue processing calls that don't connect

If a call goes from DIALING to DISCONNECTED and there are
unprocessed phone accounts then we continue processing.

This fixes a problem where we didn't fallback to the
connection manager for emergency calls.

Bug: 16192560
Change-Id: Ic693a810e4a386f7fdb6f36700d95c8bbd325d0b
parent 6f2c1ebb
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -382,12 +382,21 @@ final class Call implements CreateConnectionResponse {
    void setState(int newState) {
        if (mState != newState) {
            Log.v(this, "setState %s -> %s", mState, newState);
            int oldState = mState;
            mState = newState;
            maybeLoadCannedSmsResponses();

            if (mState == CallState.DISCONNECTED) {
                setLocallyDisconnecting(false);
                fixParentAfterDisconnect();
                if ((oldState == CallState.DIALING || oldState == CallState.CONNECTING)
                        && mCreateConnectionProcessor != null
                        && mCreateConnectionProcessor.isProcessingComplete()
                        && mCreateConnectionProcessor.hasMorePhoneAccounts()
                        && mDisconnectCause != null
                        && mDisconnectCause.getCode() == DisconnectCause.ERROR) {
                    mCreateConnectionProcessor.continueProcessingIfPossible(this, mDisconnectCause);
                }
            }
        }
    }
@@ -689,7 +698,6 @@ final class Call implements CreateConnectionResponse {
            CallIdMapper idMapper,
            ParcelableConnection connection) {
        Log.v(this, "handleCreateConnectionSuccessful %s", connection);
        mCreateConnectionProcessor = null;
        setTargetPhoneAccount(connection.getPhoneAccount());
        setHandle(connection.getHandle(), connection.getHandlePresentation());
        setCallerDisplayName(
@@ -731,7 +739,6 @@ final class Call implements CreateConnectionResponse {

    @Override
    public void handleCreateConnectionFailure(DisconnectCause disconnectCause) {
        mCreateConnectionProcessor = null;
        clearConnectionService();
        setDisconnectCause(disconnectCause);
        CallsManager.getInstance().markCallAsDisconnected(this, disconnectCause);
@@ -806,7 +813,8 @@ final class Call implements CreateConnectionResponse {
    }

    void abort(boolean wasViaNewOutgoingCallBroadcaster) {
        if (mCreateConnectionProcessor != null) {
        if (mCreateConnectionProcessor != null &&
                !mCreateConnectionProcessor.isProcessingComplete()) {
            mCreateConnectionProcessor.abort();
        } else if (mState == CallState.NEW || mState == CallState.PRE_DIAL_WAIT
                || mState == CallState.CONNECTING) {
+16 −0
Original line number Diff line number Diff line
@@ -101,6 +101,10 @@ final class CreateConnectionProcessor {
        mContext = context;
    }

    boolean isProcessingComplete() {
        return mResponse == null;
    }

    void process() {
        Log.v(this, "process");
        mAttemptRecords = new ArrayList<>();
@@ -114,6 +118,18 @@ final class CreateConnectionProcessor {
        attemptNextPhoneAccount();
    }

    boolean hasMorePhoneAccounts() {
        return mAttemptRecordIterator.hasNext();
    }

    void continueProcessingIfPossible(CreateConnectionResponse response,
            DisconnectCause disconnectCause) {
        Log.v(this, "continueProcessingIfPossible");
        mResponse = response;
        mLastErrorDisconnectCause = disconnectCause;
        attemptNextPhoneAccount();
    }

    void abort() {
        Log.v(this, "abort");