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

Commit 672321e6 authored by Santos Cordon's avatar Santos Cordon
Browse files

Fix conference call issues.

1) When disconnecting a child conference call, undo the parent
relationship before setting Disconnected state & before destroying.
2) Do not log conference calls in the call log.
3) for setIsConferenced, stop checking to see if the conference ID is
valid since it can be set to null when you want to undo the parent/child
relationship.
4) Add some logging.

Bug: 15621105
Bug: 17136172
Change-Id: I8371e46484a9ce9a8986aebd1fe771e1794979de
parent cac5b2ca
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -350,6 +350,10 @@ final class Call implements CreateConnectionResponse {
            Log.v(this, "setState %s -> %s", mState, newState);
            mState = newState;
            maybeLoadCannedSmsResponses();

            if (mState == CallState.DISCONNECTED) {
                fixParentAfterDisconnect();
            }
        }
    }

@@ -364,6 +368,10 @@ final class Call implements CreateConnectionResponse {
        return mRequestingRingback;
    }

    boolean isConference() {
        return mIsConference;
    }

    Uri getHandle() {
        return mHandle;
    }
@@ -825,7 +833,11 @@ final class Call implements CreateConnectionResponse {
    }

    void splitFromConference() {
        // TODO: todo
        if (mConnectionService == null) {
            Log.w(this, "splitting from conference call without a connection service");
        } else {
            mConnectionService.splitFromConference(this);
        }
    }

    void setParentCall(Call parentCall) {
@@ -940,6 +952,16 @@ final class Call implements CreateConnectionResponse {
        return mCannedSmsResponses;
    }

    /**
     * We need to make sure that before we move a call to the disconnected state, it no
     * longer has any parent/child relationships.  We want to do this to ensure that the InCall
     * Service always has the right data in the right order.  We also want to do it in telecomm so
     * that the insurance policy lives in the framework side of things.
     */
    private void fixParentAfterDisconnect() {
        setParentCall(null);
    }

    /**
     * @return True if the call is ringing, else logs the action name.
     */
+13 −3
Original line number Diff line number Diff line
@@ -89,9 +89,19 @@ final class CallLogManager extends CallsManagerListenerBase {

    @Override
    public void onCallStateChanged(Call call, int oldState, int newState) {
        if ((newState == CallState.DISCONNECTED || newState == CallState.ABORTED)
                && oldState != CallState.PRE_DIAL_WAIT
                && call.getDisconnectCause() != DisconnectCause.OUTGOING_CANCELED) {
        boolean isNewlyDisconnected =
                newState == CallState.DISCONNECTED || newState == CallState.ABORTED;
        boolean isCallCanceled = isNewlyDisconnected &&
                call.getDisconnectCause() == DisconnectCause.OUTGOING_CANCELED;

        // Log newly disconnected calls only if:
        // 1) It was not in the "choose account" phase when disconnected
        // 2) It is a conference call
        // 3) Call was not explicitly canceled
        if (isNewlyDisconnected &&
                (oldState != CallState.PRE_DIAL_WAIT &&
                 !call.isConference() &&
                 !isCallCanceled)) {
            int type;
            if (!call.isIncoming()) {
                type = Calls.OUTGOING_TYPE;
+1 −0
Original line number Diff line number Diff line
@@ -782,6 +782,7 @@ public final class CallsManager extends Call.ListenerBase {
    private void removeCall(Call call) {
        Log.v(this, "removeCall(%s)", call);

        call.setParentCall(null);  // need to clean up parent relationship before destroying.
        call.removeListener(this);
        call.clearConnectionService();

+4 −3
Original line number Diff line number Diff line
@@ -171,6 +171,7 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
                    SomeArgs args = (SomeArgs) msg.obj;
                    try {
                        Call childCall = mCallIdMapper.getCall(args.arg1);
                        Log.d(this, "SET_IS_CONFERENCE: %s %s", args.arg1, args.arg2);
                        if (childCall != null) {
                            String conferenceCallId = (String) args.arg2;
                            if (conferenceCallId == null) {
@@ -205,7 +206,8 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
                        mCallIdMapper.addCall(conferenceCall, id);
                        conferenceCall.setConnectionService(ConnectionServiceWrapper.this);

                        Log.d(this, "adding children to conference");
                        Log.d(this, "adding children to conference %s",
                                parcelableConference.getConnectionIds());
                        for (String callId : parcelableConference.getConnectionIds()) {
                            Call childCall = mCallIdMapper.getCall(callId);
                            Log.d(this, "found child: %s", callId);
@@ -456,8 +458,7 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
        @Override
        public void setIsConferenced(String callId, String conferenceCallId) {
            logIncoming("setIsConferenced %s %s", callId, conferenceCallId);
            if (mCallIdMapper.isValidCallId(callId) &&
                    mCallIdMapper.isValidConferenceId(conferenceCallId)) {
            if (mCallIdMapper.isValidCallId(callId)) {
                SomeArgs args = SomeArgs.obtain();
                args.arg1 = callId;
                args.arg2 = conferenceCallId;