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

Commit e39c21cf authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Refactor conference participant processing.

Moving the logic to handle transformation from an ImsConferenceState
instance to a List<ConferenceParticipant> to a standalone method.
This is to support testing conference event package testing.

Test: Manual conference event package regression testing.
Test: Test using conference event package test intents.
Fixes: 150860282
Change-Id: I2343980511b85558e589fa01144688dcbc9a6071
parent 537a9deb
Loading
Loading
Loading
Loading
+19 −13
Original line number Diff line number Diff line
@@ -43,8 +43,10 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.telephony.Rlog;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
@@ -1915,14 +1917,26 @@ public class ImsCall implements ICall {
            return;
        }

        mConferenceParticipants = parseConferenceState(state);

        if (mConferenceParticipants != null && mListener != null) {
            try {
                mListener.onConferenceParticipantsStateChanged(this, mConferenceParticipants);
            } catch (Throwable t) {
                loge("notifyConferenceStateUpdated :: ", t);
            }
        }
    }

    public static List<ConferenceParticipant> parseConferenceState(ImsConferenceState state) {
        Set<Entry<String, Bundle>> participants = state.mParticipants.entrySet();

        if (participants == null) {
            return;
            return Collections.emptyList();
        }

        Iterator<Entry<String, Bundle>> iterator = participants.iterator();
        mConferenceParticipants = new ArrayList<>(participants.size());
        List<ConferenceParticipant> conferenceParticipants = new ArrayList<>(participants.size());
        while (iterator.hasNext()) {
            Entry<String, Bundle> entry = iterator.next();

@@ -1934,7 +1948,7 @@ public class ImsCall implements ICall {
            String endpoint = confInfo.getString(ImsConferenceState.ENDPOINT);

            if (CONF_DBG) {
                logi("notifyConferenceStateUpdated :: key=" + Rlog.pii(TAG, key) +
                Log.i(TAG, "notifyConferenceStateUpdated :: key=" + Rlog.pii(TAG, key) +
                        ", status=" + status +
                        ", user=" + Rlog.pii(TAG, user) +
                        ", displayName= " + Rlog.pii(TAG, displayName) +
@@ -1951,17 +1965,10 @@ public class ImsCall implements ICall {
            if (connectionState != Connection.STATE_DISCONNECTED) {
                ConferenceParticipant conferenceParticipant = new ConferenceParticipant(handle,
                        displayName, endpointUri, connectionState, Call.Details.DIRECTION_UNKNOWN);
                mConferenceParticipants.add(conferenceParticipant);
            }
        }

        if (mConferenceParticipants != null && mListener != null) {
            try {
                mListener.onConferenceParticipantsStateChanged(this, mConferenceParticipants);
            } catch (Throwable t) {
                loge("notifyConferenceStateUpdated :: ", t);
                conferenceParticipants.add(conferenceParticipant);
            }
        }
        return conferenceParticipants;
    }

    /**
@@ -3067,7 +3074,6 @@ public class ImsCall implements ICall {
        public void callSessionConferenceStateUpdated(ImsCallSession session,
                ImsConferenceState state) {
            logi("callSessionConferenceStateUpdated :: state=" + state);

            conferenceStateUpdated(state);
        }