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

Commit 988ccc80 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Fix lack of notification of un-parent on disconnecting conference child.

As a consequence of recent changes to improve efficiency of IMS conferences,
there was a regression when unparenting a child of a conference when it
was disconnected.  We would neglect to send the connection event notifying
the InCallService of the change in parent for the call.

To fix this I split notifying of parent change into a new method which
is called in the right place for the "add existing call" case, and also
from within setParentAndChildCall.  This actually reads nicer and we're
no longer sending this from setChildOf.

Test: Manual, ran CTS, ran unit tests
Bug: 62236503
Change-Id: Ie59a00a39c2ebeee44a81c2db6edf2968fa5b643
parent 60da84f0
Loading
Loading
Loading
Loading
+19 −15
Original line number Diff line number Diff line
@@ -1876,8 +1876,24 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable {
     * @param parentCall
     */
    void setParentAndChildCall(Call parentCall) {
        boolean isParentChanging = (mParentCall != parentCall);
        setParentCall(parentCall);
        setChildOf(parentCall);
        if (isParentChanging) {
            notifyParentChanged(parentCall);
        }
    }

    /**
     * Notifies listeners when the parent call changes.
     * Used by {@link #setParentAndChildCall(Call)}, and in {@link CallsManager}.
     * @param parentCall The new parent call for this call.
     */
    void notifyParentChanged(Call parentCall) {
        Log.addEvent(this, LogUtils.Events.SET_PARENT, parentCall);
        for (Listener l : mListeners) {
            l.onParentChanged(this);
        }
    }

    /**
@@ -1906,25 +1922,13 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable {
     * To be called after {@link #setParentCall(Call)} to complete setting the parent by adding
     * this call as a child of another call.
     * <p>
     * Note: The fact that the {@link Listener#onParentChanged(Call)} callback is called here seems
     * counter-intuitive; it is done here so that when this method is called from
     * {@link CallsManager#createCallForExistingConnection(String, ParcelableConnection)} we can
     * delay informing InCallServices of the change in parent relationship until AFTER the call has
     * been added to Telecom.
     * Note: if using this method alone, the caller must call {@link #notifyParentChanged(Call)} to
     * ensure the InCall UI is updated with the change in parent.
     * @param parentCall The new parent for this call.
     */
    void setChildOf(Call parentCall) {
        if (parentCall == null) {
            return;
        }

        if (!parentCall.getChildCalls().contains(this)) {
        if (parentCall != null && !parentCall.getChildCalls().contains(this)) {
            parentCall.addChildCall(this);

            Log.addEvent(this, LogUtils.Events.SET_PARENT, parentCall);
            for (Listener l : mListeners) {
                l.onParentChanged(this);
            }
        }
    }

+1 −0
Original line number Diff line number Diff line
@@ -2542,6 +2542,7 @@ public class CallsManager extends Call.ListenerBase
            // Now, set the call as a child of the parent since it has been added to Telecom.  This
            // is where we will inform InCall.
            call.setChildOf(parentCall);
            call.notifyParentChanged(parentCall);
        }

        return call;