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

Commit 9646ed98 authored by Tyler Gunn's avatar Tyler Gunn Committed by Android (Google) Code Review
Browse files

Merge "Changing the point where the call state is set." into lmp-dev

parents b3ed36db cde2e506
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ final class Call implements CreateConnectionResponse {
     * Listener for events on the call.
     */
    interface Listener {
        void onSuccessfulOutgoingCall(Call call);
        void onSuccessfulOutgoingCall(Call call, CallState callState);
        void onFailedOutgoingCall(Call call, int errorCode, String errorMsg);
        void onCancelledOutgoingCall(Call call);
        void onSuccessfulIncomingCall(Call call);
@@ -94,7 +94,7 @@ final class Call implements CreateConnectionResponse {

    abstract static class ListenerBase implements Listener {
        @Override
        public void onSuccessfulOutgoingCall(Call call) {}
        public void onSuccessfulOutgoingCall(Call call, CallState callState) {}
        @Override
        public void onFailedOutgoingCall(Call call, int errorCode, String errorMsg) {}
        @Override
@@ -623,7 +623,6 @@ final class Call implements CreateConnectionResponse {
            ConnectionRequest request, ParcelableConnection connection) {
        Log.v(this, "handleCreateConnectionSuccessful %s", connection);
        mCreateConnectionProcessor = null;
        setState(getStateFromConnectionState(connection.getState()));
        setTargetPhoneAccount(connection.getPhoneAccount());
        setHandle(connection.getHandle(), connection.getHandlePresentation());
        setCallerDisplayName(
@@ -644,7 +643,8 @@ final class Call implements CreateConnectionResponse {
            mHandler.postDelayed(mDirectToVoicemailRunnable, Timeouts.getDirectToVoicemailMillis());
        } else {
            for (Listener l : mListeners) {
                l.onSuccessfulOutgoingCall(this);
                l.onSuccessfulOutgoingCall(this,
                        getStateFromConnectionState(connection.getState()));
            }
        }
    }
@@ -676,7 +676,6 @@ final class Call implements CreateConnectionResponse {
        if (mIsIncoming) {
            clearConnectionService();
            setDisconnectCause(DisconnectCause.OUTGOING_CANCELED, null);
            setState(CallState.DISCONNECTED);

            Listener[] listeners = mListeners.toArray(new Listener[mListeners.size()]);
            for (int i = 0; i < listeners.length; i++) {
+3 −1
Original line number Diff line number Diff line
@@ -123,8 +123,9 @@ public final class CallsManager extends Call.ListenerBase {
    }

    @Override
    public void onSuccessfulOutgoingCall(Call call) {
    public void onSuccessfulOutgoingCall(Call call, CallState callState) {
        Log.v(this, "onSuccessfulOutgoingCall, %s", call);
        setCallState(call, callState);
        if (mCalls.contains(call)) {
            // The call's ConnectionService has been updated.
            for (CallsManagerListener listener : mListeners) {
@@ -161,6 +162,7 @@ public final class CallsManager extends Call.ListenerBase {

    @Override
    public void onFailedIncomingCall(Call call) {
        setCallState(call, CallState.DISCONNECTED);
        call.removeListener(this);
    }