FileDocCategorySizeDatePackage
Conference.javaAPI DocAndroid 5.1 API16299Thu Mar 12 22:22:42 GMT 2015android.telecom

Conference

public abstract class Conference extends Object implements IConferenceable
Represents a conference call which can contain any number of {@link Connection} objects.
hide

Fields Summary
public static long
CONNECT_TIME_NOT_SPECIFIED
Used to indicate that the conference connection time is not specified. If not specified, Telecom will set the connect time.
private final Set
mListeners
private final List
mChildConnections
private final List
mUnmodifiableChildConnections
private final List
mConferenceableConnections
private final List
mUnmodifiableConferenceableConnections
protected PhoneAccountHandle
mPhoneAccount
private AudioState
mAudioState
private int
mState
private DisconnectCause
mDisconnectCause
private int
mConnectionCapabilities
private String
mDisconnectMessage
private long
mConnectTimeMillis
private final Connection.Listener
mConnectionDeathListener
Constructors Summary
public Conference(PhoneAccountHandle phoneAccount)
Constructs a new Conference with a mandatory {@link PhoneAccountHandle}

param
phoneAccount The {@code PhoneAccountHandle} associated with the conference.


                           
       
        mPhoneAccount = phoneAccount;
    
Methods Summary
public voidaddCapability(int capability)
Adds the specified capability to the set of capabilities of this {@code Conference}.

param
capability The capability to add to the set.
hide

        mConnectionCapabilities |= capability;
    
public final booleanaddConnection(Connection connection)
Adds the specified connection as a child of this conference.

param
connection The connection to add.
return
True if the connection was successfully added.

        if (connection != null && !mChildConnections.contains(connection)) {
            if (connection.setConference(this)) {
                mChildConnections.add(connection);
                onConnectionAdded(connection);
                for (Listener l : mListeners) {
                    l.onConnectionAdded(this, connection);
                }
                return true;
            }
        }
        return false;
    
public final android.telecom.ConferenceaddListener(android.telecom.Conference$Listener listener)
Add a listener to be notified of a state change.

param
listener The new listener.
return
This conference.
hide

        mListeners.add(listener);
        return this;
    
public static booleancan(int capabilities, int capability)
Whether the given capabilities support the specified capability.

param
capabilities A capability bit field.
param
capability The capability to check capabilities for.
return
Whether the specified capability is supported.
hide

        return (capabilities & capability) != 0;
    
public booleancan(int capability)
Whether the capabilities of this {@code Connection} supports the specified capability.

param
capability The capability to check capabilities for.
return
Whether the specified capability is supported.
hide

        return can(mConnectionCapabilities, capability);
    
private final voidclearConferenceableList()

        for (Connection c : mConferenceableConnections) {
            c.removeConnectionListener(mConnectionDeathListener);
        }
        mConferenceableConnections.clear();
    
public final voiddestroy()
Tears down the conference object and any of its current connections.

        Log.d(this, "destroying conference : %s", this);
        // Tear down the children.
        for (Connection connection : mChildConnections) {
            Log.d(this, "removing connection %s", connection);
            removeConnection(connection);
        }

        // If not yet disconnected, set the conference call as disconnected first.
        if (mState != Connection.STATE_DISCONNECTED) {
            Log.d(this, "setting to disconnected");
            setDisconnected(new DisconnectCause(DisconnectCause.LOCAL));
        }

        // ...and notify.
        for (Listener l : mListeners) {
            l.onDestroyed(this);
        }
    
private final voidfireOnConferenceableConnectionsChanged()

        for (Listener l : mListeners) {
            l.onConferenceableConnectionsChanged(this, getConferenceableConnections());
        }
    
public final AudioStategetAudioState()

return
The audio state of the conference, describing how its audio is currently being routed by the system. This is {@code null} if this Conference does not directly know about its audio state.

        return mAudioState;
    
public final intgetCapabilities()

hide

        return getConnectionCapabilities();
    
public final java.util.ListgetConferenceableConnections()
Returns the connections with which this connection can be conferenced.

        return mUnmodifiableConferenceableConnections;
    
public longgetConnectTimeMillis()
Retrieves the connect time of the {@code Conference}, if specified. A value of {@link #CONNECT_TIME_NOT_SPECIFIED} indicates that Telecom should determine the start time of the conference.

return
The time the {@code Conference} has been connected.

        return mConnectTimeMillis;
    
public final intgetConnectionCapabilities()
Returns the capabilities of a conference. See {@code CAPABILITY_*} constants in class {@link Connection} for valid values.

return
A bitmask of the capabilities of the conference call.

        return mConnectionCapabilities;
    
public final java.util.ListgetConnections()
Returns the list of connections currently associated with the conference call.

return
A list of {@code Connection} objects which represent the children of the conference.

        return mUnmodifiableChildConnections;
    
public final DisconnectCausegetDisconnectCause()

return
The {@link DisconnectCause} for this connection.

        return mDisconnectCause;
    
public final PhoneAccountHandlegetPhoneAccountHandle()
Returns the {@link PhoneAccountHandle} the conference call is being placed through.

return
A {@code PhoneAccountHandle} object representing the PhoneAccount of the conference.

        return mPhoneAccount;
    
public ConnectiongetPrimaryConnection()
Retrieves the primary connection associated with the conference. The primary connection is the connection from which the conference will retrieve its current state.

return
The primary connection.

        if (mUnmodifiableChildConnections == null || mUnmodifiableChildConnections.isEmpty()) {
            return null;
        }
        return mUnmodifiableChildConnections.get(0);
    
public final intgetState()
Gets the state of the conference call. See {@link Connection} for valid values.

return
A constant representing the state the conference call is currently in.

        return mState;
    
public voidonAudioStateChanged(AudioState state)
Notifies this conference that the {@link #getAudioState()} property has a new value.

param
state The new call audio state.

public voidonConnectionAdded(Connection connection)
Notifies this conference that a connection has been added to it.

param
connection The newly added connection.

public voidonDisconnect()
Invoked when the Conference and all it's {@link Connection}s should be disconnected.

public voidonHold()
Invoked when the conference should be put on hold.

public voidonMerge(Connection connection)
Invoked when the specified {@link Connection} should merged with the conference call.

param
connection The {@code Connection} to merge.

public voidonMerge()
Invoked when the child calls should be merged. Only invoked if the conference contains the capability {@link Connection#CAPABILITY_MERGE_CONFERENCE}.

public voidonPlayDtmfTone(char c)
Notifies this conference of a request to play a DTMF tone.

param
c A DTMF character.

public voidonSeparate(Connection connection)
Invoked when the specified {@link Connection} should be separated from the conference call.

param
connection The connection to separate.

public voidonStopDtmfTone()
Notifies this conference of a request to stop any currently playing DTMF tones.

public voidonSwap()
Invoked when the child calls should be swapped. Only invoked if the conference contains the capability {@link Connection#CAPABILITY_SWAP_CONFERENCE}.

public voidonUnhold()
Invoked when the conference should be moved from hold to active.

public voidremoveCapability(int capability)
Removes the specified capability from the set of capabilities of this {@code Conference}.

param
capability The capability to remove from the set.
hide

        mConnectionCapabilities &= ~capability;
    
public final voidremoveConnection(Connection connection)
Removes the specified connection as a child of this conference.

param
connection The connection to remove.

        Log.d(this, "removing %s from %s", connection, mChildConnections);
        if (connection != null && mChildConnections.remove(connection)) {
            connection.resetConference();
            for (Listener l : mListeners) {
                l.onConnectionRemoved(this, connection);
            }
        }
    
public final android.telecom.ConferenceremoveListener(android.telecom.Conference$Listener listener)
Removes the specified listener.

param
listener The listener to remove.
return
This conference.
hide

        mListeners.remove(listener);
        return this;
    
public final voidsetActive()
Sets state to be active.

        setState(Connection.STATE_ACTIVE);
    
final voidsetAudioState(AudioState state)
Inform this Conference that the state of its audio output has been changed externally.

param
state The new audio state.
hide

        Log.d(this, "setAudioState %s", state);
        mAudioState = state;
        onAudioStateChanged(state);
    
public final voidsetCapabilities(int connectionCapabilities)

hide

        setConnectionCapabilities(connectionCapabilities);
    
public final voidsetConferenceableConnections(java.util.List conferenceableConnections)
Sets the connections with which this connection can be conferenced.

param
conferenceableConnections The set of connections this connection can conference with.

        clearConferenceableList();
        for (Connection c : conferenceableConnections) {
            // If statement checks for duplicates in input. It makes it N^2 but we're dealing with a
            // small amount of items here.
            if (!mConferenceableConnections.contains(c)) {
                c.addConnectionListener(mConnectionDeathListener);
                mConferenceableConnections.add(c);
            }
        }
        fireOnConferenceableConnectionsChanged();
    
public voidsetConnectTimeMillis(long connectTimeMillis)
Sets the connect time of the {@code Conference}.

param
connectTimeMillis The connection time, in milliseconds.

        mConnectTimeMillis = connectTimeMillis;
    
public final voidsetConnectionCapabilities(int connectionCapabilities)
Sets the capabilities of a conference. See {@code CAPABILITY_*} constants of class {@link Connection} for valid values.

param
connectionCapabilities A bitmask of the {@code PhoneCapabilities} of the conference call.

        if (connectionCapabilities != mConnectionCapabilities) {
            mConnectionCapabilities = connectionCapabilities;

            for (Listener l : mListeners) {
                l.onConnectionCapabilitiesChanged(this, mConnectionCapabilities);
            }
        }
    
public final voidsetDisconnected(DisconnectCause disconnectCause)
Sets state to disconnected.

param
disconnectCause The reason for the disconnection, as described by {@link android.telecom.DisconnectCause}.

        mDisconnectCause = disconnectCause;;
        setState(Connection.STATE_DISCONNECTED);
        for (Listener l : mListeners) {
            l.onDisconnected(this, mDisconnectCause);
        }
    
public final voidsetOnHold()
Sets state to be on hold.

        setState(Connection.STATE_HOLDING);
    
private voidsetState(int newState)

        if (newState != Connection.STATE_ACTIVE &&
                newState != Connection.STATE_HOLDING &&
                newState != Connection.STATE_DISCONNECTED) {
            Log.w(this, "Unsupported state transition for Conference call.",
                    Connection.stateToString(newState));
            return;
        }

        if (mState != newState) {
            int oldState = mState;
            mState = newState;
            for (Listener l : mListeners) {
                l.onStateChanged(this, oldState, newState);
            }
        }