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

Commit 8c2dcefc authored by Nivedita Sarkar's avatar Nivedita Sarkar Committed by Gerrit - the friendly Code Review server
Browse files

Propagate the call substate changed message to the UI

Change-Id: I0465c65d9ac7af22cac544f6404056d0c2094cf4
CRs-Fixed: 749824
parent 91d85e78
Loading
Loading
Loading
Loading
+30 −2
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ final class Call implements CreateConnectionResponse {
        void onConnectionManagerPhoneAccountChanged(Call call);
        void onPhoneAccountChanged(Call call);
        void onConferenceableCallsChanged(Call call);
        void onCallSubstateChanged(Call call);
    }

    abstract static class ListenerBase implements Listener {
@@ -138,6 +139,8 @@ final class Call implements CreateConnectionResponse {
        public void onPhoneAccountChanged(Call call) {}
        @Override
        public void onConferenceableCallsChanged(Call call) {}
        @Override
        public void onCallSubstateChanged(Call call) {}
    }

    private static final OnQueryCompleteListener sCallerInfoQueryListener =
@@ -291,6 +294,7 @@ final class Call implements CreateConnectionResponse {
    private int mNotificationType;
    private int mCode;
    boolean mIsActiveSub = false;
    private int mCallSubstate;

    private boolean mWasConferencePreviouslyMerged = false;

@@ -356,7 +360,7 @@ final class Call implements CreateConnectionResponse {
            component = mConnectionService.getComponentName().flattenToShortString();
        }

        return String.format(Locale.US, "[%s, %s, %s, %s, %d, childs(%d), has_parent(%b), [%s], %b, %s]",
        return String.format(Locale.US, "[%s, %s, %s, %s, %d, childs(%d), has_parent(%b), [%s], %b, %s %d]",
                System.identityHashCode(this),
                CallState.toString(mState),
                component,
@@ -365,7 +369,9 @@ final class Call implements CreateConnectionResponse {
                getChildCalls().size(),
                getParentCall() != null,
                PhoneCapabilities.toString(getCallCapabilities()),
                mIsActiveSub, mTargetPhoneAccountHandle);
                mIsActiveSub,
                mTargetPhoneAccountHandle,
                getCallSubstate());
    }

    int getState() {
@@ -711,6 +717,7 @@ final class Call implements CreateConnectionResponse {
        setRingbackRequested(connection.isRingbackRequested());
        setIsVoipAudioMode(connection.getIsVoipAudioMode());
        setStatusHints(connection.getStatusHints());
        setCallSubstate(connection.getCallSubstate());

        mConferenceableCalls.clear();
        for (String id : connection.getConferenceableConnectionIds()) {
@@ -1399,4 +1406,25 @@ final class Call implements CreateConnectionResponse {
        }
        return CallState.DISCONNECTED;
    }

    /**
     * The current call substate.
     */
    public int getCallSubstate() {
        return mCallSubstate;
    }


    /**
     * Determines the current substate for the call.
     *
     * @param callSubstate The substate for the call.
     */
    public void setCallSubstate(int callSubstate) {
        mCallSubstate = callSubstate;

        for (Listener l : mListeners) {
            l.onCallSubstateChanged(this);
        }
    }
}
+8 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public final class CallsManager extends Call.ListenerBase {
        void onIsConferencedChanged(Call call);
        void onIsVoipAudioModeChanged(Call call);
        void onVideoStateChanged(Call call);
        void onCallSubstateChanged(Call call);
    }

    /**
@@ -312,6 +313,13 @@ public final class CallsManager extends Call.ListenerBase {
        }
    }

    @Override
    public void onCallSubstateChanged(Call call) {
        for (CallsManagerListener listener : mListeners) {
            listener.onCallSubstateChanged(call);
        }
    }

    ImmutableCollection<Call> getCalls() {
        return ImmutableList.copyOf(mCalls);
    }
+4 −0
Original line number Diff line number Diff line
@@ -72,4 +72,8 @@ class CallsManagerListenerBase implements CallsManager.CallsManagerListener {
    @Override
    public void onVideoStateChanged(Call call) {
    }

    @Override
    public void onCallSubstateChanged(Call call) {
    }
}
+17 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
    private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20;
    private static final int MSG_SET_DISCONNECTED_WITH_SUPP_NOTIFICATION = 22;
    private static final int MSG_SET_PHONE_ACCOUNT = 23;
    private static final int MSG_SET_CALL_SUBSTATE = 24;

    private final Handler mHandler = new Handler() {
        @Override
@@ -389,6 +390,13 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
                    }
                    break;
                }
                case MSG_SET_CALL_SUBSTATE: {
                    call = mCallIdMapper.getCall(msg.obj);
                    if (call != null) {
                        call.setCallSubstate(msg.arg1);
                    }
                    break;
                }
            }
        }
    };
@@ -624,6 +632,15 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
                mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT, args).sendToTarget();
            }
        }

        @Override
        public void setCallSubstate(String callId, int callSubstate) {
            logIncoming("setCallSubstate %s %d", callId, callSubstate);
            if (mCallIdMapper.isValidCallId(callId)) {
                mHandler.obtainMessage(
                    MSG_SET_CALL_SUBSTATE, callSubstate, 0, callId).sendToTarget();
            }
        }
    }

    private final Adapter mAdapter = new Adapter();
+7 −1
Original line number Diff line number Diff line
@@ -117,6 +117,11 @@ public final class InCallController extends CallsManagerListenerBase {
        public void onConferenceableCallsChanged(Call call) {
            updateCall(call);
        }

        @Override
        public void onCallSubstateChanged(Call call) {
            updateCall(call);
        }
    };

    /**
@@ -509,7 +514,8 @@ public final class InCallController extends CallsManagerListenerBase {
                call.getExtras(),
                call.getNotificationType(),
                call.getNotificationCode(),
                call.mIsActiveSub);
                call.mIsActiveSub,
                call.getCallSubstate());
    }

    /**
Loading