1823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon/* 2823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Copyright (C) 2014 The Android Open Source Project 3823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * 4823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Licensed under the Apache License, Version 2.0 (the "License"); 5823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * you may not use this file except in compliance with the License. 6823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * You may obtain a copy of the License at 7823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * 8823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * http://www.apache.org/licenses/LICENSE-2.0 9823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * 10823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Unless required by applicable law or agreed to in writing, software 11823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * distributed under the License is distributed on an "AS IS" BASIS, 12823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * See the License for the specific language governing permissions and 14823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * limitations under the License. 15823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 16823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 17ef9f6f957d897ea0ed82114185b8fa3fefd4917bTyler Gunnpackage android.telecom; 18823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 190e094d926c306c3667bcdf6f23c52cc7181f25f3Evan Charltonimport android.annotation.SystemApi; 200e094d926c306c3667bcdf6f23c52cc7181f25f3Evan Charlton 2150e3506533478fa273cbc92c2919470d1889f1edIhab Awadimport java.util.ArrayList; 22823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordonimport java.util.Collections; 23823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordonimport java.util.List; 24823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordonimport java.util.Set; 25823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordonimport java.util.concurrent.CopyOnWriteArrayList; 26823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordonimport java.util.concurrent.CopyOnWriteArraySet; 27823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 28823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon/** 29823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Represents a conference call which can contain any number of {@link Connection} objects. 300e094d926c306c3667bcdf6f23c52cc7181f25f3Evan Charlton * @hide 31823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 320e094d926c306c3667bcdf6f23c52cc7181f25f3Evan Charlton@SystemApi 336d76ca0438c2cb7a7d5d91992db819c063c0a57bTyler Gunnpublic abstract class Conference implements IConferenceable { 34823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 35cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn /** 36cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn * Used to indicate that the conference connection time is not specified. If not specified, 37cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn * Telecom will set the connect time. 38cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn */ 39cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn public static long CONNECT_TIME_NOT_SPECIFIED = 0; 40cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn 41823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon /** @hide */ 42823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public abstract static class Listener { 43823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public void onStateChanged(Conference conference, int oldState, int newState) {} 447f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee public void onDisconnected(Conference conference, DisconnectCause disconnectCause) {} 45823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public void onConnectionAdded(Conference conference, Connection connection) {} 46823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public void onConnectionRemoved(Conference conference, Connection connection) {} 4750e3506533478fa273cbc92c2919470d1889f1edIhab Awad public void onConferenceableConnectionsChanged( 4850e3506533478fa273cbc92c2919470d1889f1edIhab Awad Conference conference, List<Connection> conferenceableConnections) {} 49823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public void onDestroyed(Conference conference) {} 505c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad public void onConnectionCapabilitiesChanged( 515c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad Conference conference, int connectionCapabilities) {} 52823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 53823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 54823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon private final Set<Listener> mListeners = new CopyOnWriteArraySet<>(); 55823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon private final List<Connection> mChildConnections = new CopyOnWriteArrayList<>(); 56b8e85c74e5910a461078704048d67f82b216508cIhab Awad private final List<Connection> mUnmodifiableChildConnections = 57823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon Collections.unmodifiableList(mChildConnections); 5850e3506533478fa273cbc92c2919470d1889f1edIhab Awad private final List<Connection> mConferenceableConnections = new ArrayList<>(); 5950e3506533478fa273cbc92c2919470d1889f1edIhab Awad private final List<Connection> mUnmodifiableConferenceableConnections = 6050e3506533478fa273cbc92c2919470d1889f1edIhab Awad Collections.unmodifiableList(mConferenceableConnections); 61823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 62f9c4d84ea99bcb0e5ccd43d99005eaa908fd315fAnju Mathapati protected PhoneAccountHandle mPhoneAccount; 63a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee private AudioState mAudioState; 64823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon private int mState = Connection.STATE_NEW; 657f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee private DisconnectCause mDisconnectCause; 665c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad private int mConnectionCapabilities; 67823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon private String mDisconnectMessage; 68cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn private long mConnectTimeMillis = CONNECT_TIME_NOT_SPECIFIED; 69823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 7050e3506533478fa273cbc92c2919470d1889f1edIhab Awad private final Connection.Listener mConnectionDeathListener = new Connection.Listener() { 7150e3506533478fa273cbc92c2919470d1889f1edIhab Awad @Override 7250e3506533478fa273cbc92c2919470d1889f1edIhab Awad public void onDestroyed(Connection c) { 7350e3506533478fa273cbc92c2919470d1889f1edIhab Awad if (mConferenceableConnections.remove(c)) { 7450e3506533478fa273cbc92c2919470d1889f1edIhab Awad fireOnConferenceableConnectionsChanged(); 7550e3506533478fa273cbc92c2919470d1889f1edIhab Awad } 7650e3506533478fa273cbc92c2919470d1889f1edIhab Awad } 7750e3506533478fa273cbc92c2919470d1889f1edIhab Awad }; 7850e3506533478fa273cbc92c2919470d1889f1edIhab Awad 7956fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen /** 8056fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen * Constructs a new Conference with a mandatory {@link PhoneAccountHandle} 8156fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen * 8256fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen * @param phoneAccount The {@code PhoneAccountHandle} associated with the conference. 8356fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen */ 84823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public Conference(PhoneAccountHandle phoneAccount) { 85823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon mPhoneAccount = phoneAccount; 86823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 87823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 8856fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen /** 8956fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen * Returns the {@link PhoneAccountHandle} the conference call is being placed through. 9056fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen * 9156fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen * @return A {@code PhoneAccountHandle} object representing the PhoneAccount of the conference. 9256fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen */ 93ea38cca14964a5ee658899b0bafbc48017d556cdNancy Chen public final PhoneAccountHandle getPhoneAccountHandle() { 94823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon return mPhoneAccount; 95823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 96823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 9756fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen /** 9856fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen * Returns the list of connections currently associated with the conference call. 9956fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen * 10056fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen * @return A list of {@code Connection} objects which represent the children of the conference. 10156fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen */ 102823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public final List<Connection> getConnections() { 103b8e85c74e5910a461078704048d67f82b216508cIhab Awad return mUnmodifiableChildConnections; 104823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 105823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 10656fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen /** 10756fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen * Gets the state of the conference call. See {@link Connection} for valid values. 10856fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen * 10956fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen * @return A constant representing the state the conference call is currently in. 11056fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen */ 111823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public final int getState() { 112823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon return mState; 113823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 114823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 1155c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad /** @hide */ 1165c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad @Deprecated public final int getCapabilities() { 1175c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad return getConnectionCapabilities(); 1185c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad } 1195c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad 1205c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad /** 1215c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * Returns the capabilities of a conference. See {@code CAPABILITY_*} constants in class 1225c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * {@link Connection} for valid values. 1235c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * 1245c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * @return A bitmask of the capabilities of the conference call. 1255c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad */ 1265c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad public final int getConnectionCapabilities() { 1275c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad return mConnectionCapabilities; 1285c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad } 1295c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad 1305c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad /** 1315c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * Whether the given capabilities support the specified capability. 1325c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * 1335c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * @param capabilities A capability bit field. 1345c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * @param capability The capability to check capabilities for. 1355c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * @return Whether the specified capability is supported. 1365c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * @hide 1375c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad */ 1385c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad public static boolean can(int capabilities, int capability) { 1395c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad return (capabilities & capability) != 0; 1405c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad } 1415c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad 14256fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen /** 1435c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * Whether the capabilities of this {@code Connection} supports the specified capability. 14456fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen * 1455c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * @param capability The capability to check capabilities for. 1465c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * @return Whether the specified capability is supported. 1475c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * @hide 14856fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen */ 1495c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad public boolean can(int capability) { 1505c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad return can(mConnectionCapabilities, capability); 1515c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad } 1525c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad 1535c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad /** 1545c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * Removes the specified capability from the set of capabilities of this {@code Conference}. 1555c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * 1565c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * @param capability The capability to remove from the set. 1575c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * @hide 1585c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad */ 1595c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad public void removeCapability(int capability) { 1605c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad mConnectionCapabilities &= ~capability; 1615c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad } 1625c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad 1635c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad /** 1645c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * Adds the specified capability to the set of capabilities of this {@code Conference}. 1655c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * 1665c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * @param capability The capability to add to the set. 1675c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * @hide 1685c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad */ 1695c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad public void addCapability(int capability) { 1705c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad mConnectionCapabilities |= capability; 171823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 172823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 173823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon /** 174a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee * @return The audio state of the conference, describing how its audio is currently 175a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee * being routed by the system. This is {@code null} if this Conference 176a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee * does not directly know about its audio state. 177a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee */ 178a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee public final AudioState getAudioState() { 179a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee return mAudioState; 180a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee } 181a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee 182a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee /** 183823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Invoked when the Conference and all it's {@link Connection}s should be disconnected. 184823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 185823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public void onDisconnect() {} 186823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 187823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon /** 188823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Invoked when the specified {@link Connection} should be separated from the conference call. 189823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * 190823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * @param connection The connection to separate. 191823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 192823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public void onSeparate(Connection connection) {} 193823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 194823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon /** 19550e3506533478fa273cbc92c2919470d1889f1edIhab Awad * Invoked when the specified {@link Connection} should merged with the conference call. 19650e3506533478fa273cbc92c2919470d1889f1edIhab Awad * 19750e3506533478fa273cbc92c2919470d1889f1edIhab Awad * @param connection The {@code Connection} to merge. 19850e3506533478fa273cbc92c2919470d1889f1edIhab Awad */ 19950e3506533478fa273cbc92c2919470d1889f1edIhab Awad public void onMerge(Connection connection) {} 20050e3506533478fa273cbc92c2919470d1889f1edIhab Awad 20150e3506533478fa273cbc92c2919470d1889f1edIhab Awad /** 202823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Invoked when the conference should be put on hold. 203823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 204823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public void onHold() {} 205823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 206823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon /** 207823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Invoked when the conference should be moved from hold to active. 208823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 209823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public void onUnhold() {} 210823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 211823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon /** 212a48680427e022ab6eb73277faac6c57831ee6ff9Santos Cordon * Invoked when the child calls should be merged. Only invoked if the conference contains the 2135c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * capability {@link Connection#CAPABILITY_MERGE_CONFERENCE}. 214a48680427e022ab6eb73277faac6c57831ee6ff9Santos Cordon */ 215a48680427e022ab6eb73277faac6c57831ee6ff9Santos Cordon public void onMerge() {} 216a48680427e022ab6eb73277faac6c57831ee6ff9Santos Cordon 217a48680427e022ab6eb73277faac6c57831ee6ff9Santos Cordon /** 218a48680427e022ab6eb73277faac6c57831ee6ff9Santos Cordon * Invoked when the child calls should be swapped. Only invoked if the conference contains the 2195c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * capability {@link Connection#CAPABILITY_SWAP_CONFERENCE}. 220a48680427e022ab6eb73277faac6c57831ee6ff9Santos Cordon */ 221a48680427e022ab6eb73277faac6c57831ee6ff9Santos Cordon public void onSwap() {} 222a48680427e022ab6eb73277faac6c57831ee6ff9Santos Cordon 223a48680427e022ab6eb73277faac6c57831ee6ff9Santos Cordon /** 224a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee * Notifies this conference of a request to play a DTMF tone. 225a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee * 226a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee * @param c A DTMF character. 227a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee */ 228a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee public void onPlayDtmfTone(char c) {} 229a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee 230a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee /** 231a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee * Notifies this conference of a request to stop any currently playing DTMF tones. 232a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee */ 233a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee public void onStopDtmfTone() {} 234a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee 235a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee /** 236a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee * Notifies this conference that the {@link #getAudioState()} property has a new value. 237a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee * 238a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee * @param state The new call audio state. 239a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee */ 240a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee public void onAudioStateChanged(AudioState state) {} 241a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee 242a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee /** 24346f7f5dce42d645353a0f3eb0dbdd25b3a6c72fbAndrew Lee * Notifies this conference that a connection has been added to it. 24446f7f5dce42d645353a0f3eb0dbdd25b3a6c72fbAndrew Lee * 24546f7f5dce42d645353a0f3eb0dbdd25b3a6c72fbAndrew Lee * @param connection The newly added connection. 24646f7f5dce42d645353a0f3eb0dbdd25b3a6c72fbAndrew Lee */ 24746f7f5dce42d645353a0f3eb0dbdd25b3a6c72fbAndrew Lee public void onConnectionAdded(Connection connection) {} 24846f7f5dce42d645353a0f3eb0dbdd25b3a6c72fbAndrew Lee 24946f7f5dce42d645353a0f3eb0dbdd25b3a6c72fbAndrew Lee /** 250823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Sets state to be on hold. 251823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 252823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public final void setOnHold() { 253823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon setState(Connection.STATE_HOLDING); 254823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 255823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 256823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon /** 257823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Sets state to be active. 258823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 259823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public final void setActive() { 260823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon setState(Connection.STATE_ACTIVE); 261823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 262823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 263823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon /** 264823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Sets state to disconnected. 265823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * 2667f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee * @param disconnectCause The reason for the disconnection, as described by 2677f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee * {@link android.telecom.DisconnectCause}. 268823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 2697f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee public final void setDisconnected(DisconnectCause disconnectCause) { 2707f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee mDisconnectCause = disconnectCause;; 271823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon setState(Connection.STATE_DISCONNECTED); 272823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon for (Listener l : mListeners) { 2737f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee l.onDisconnected(this, mDisconnectCause); 274823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 275823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 276823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 277823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon /** 2781cf14ac5dc5708fc31e6c987a5c7db465ff95533mike dooley * @return The {@link DisconnectCause} for this connection. 2791cf14ac5dc5708fc31e6c987a5c7db465ff95533mike dooley */ 2801cf14ac5dc5708fc31e6c987a5c7db465ff95533mike dooley public final DisconnectCause getDisconnectCause() { 2811cf14ac5dc5708fc31e6c987a5c7db465ff95533mike dooley return mDisconnectCause; 2821cf14ac5dc5708fc31e6c987a5c7db465ff95533mike dooley } 2831cf14ac5dc5708fc31e6c987a5c7db465ff95533mike dooley 2845c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad /** @hide */ 2855c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad @Deprecated public final void setCapabilities(int connectionCapabilities) { 2865c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad setConnectionCapabilities(connectionCapabilities); 2875c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad } 2885c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad 2891cf14ac5dc5708fc31e6c987a5c7db465ff95533mike dooley /** 2905c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * Sets the capabilities of a conference. See {@code CAPABILITY_*} constants of class 2915c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * {@link Connection} for valid values. 29256fc25deec15a32ea5f37d7c8c82f16d1bf9d275Nancy Chen * 2935c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad * @param connectionCapabilities A bitmask of the {@code PhoneCapabilities} of the conference call. 294823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 2955c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad public final void setConnectionCapabilities(int connectionCapabilities) { 2965c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad if (connectionCapabilities != mConnectionCapabilities) { 2975c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad mConnectionCapabilities = connectionCapabilities; 298823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 299823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon for (Listener l : mListeners) { 3005c9c86ec0f95d1f5e1aca212967f508fc736b895Ihab Awad l.onConnectionCapabilitiesChanged(this, mConnectionCapabilities); 301823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 302823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 303823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 304823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 305823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon /** 306823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Adds the specified connection as a child of this conference. 307823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * 308823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * @param connection The connection to add. 309823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * @return True if the connection was successfully added. 310823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 311a48680427e022ab6eb73277faac6c57831ee6ff9Santos Cordon public final boolean addConnection(Connection connection) { 312823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon if (connection != null && !mChildConnections.contains(connection)) { 313823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon if (connection.setConference(this)) { 314823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon mChildConnections.add(connection); 31546f7f5dce42d645353a0f3eb0dbdd25b3a6c72fbAndrew Lee onConnectionAdded(connection); 316823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon for (Listener l : mListeners) { 317823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon l.onConnectionAdded(this, connection); 318823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 319823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon return true; 320823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 321823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 322823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon return false; 323823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 324823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 325823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon /** 326823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Removes the specified connection as a child of this conference. 327823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * 328823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * @param connection The connection to remove. 329823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 330a48680427e022ab6eb73277faac6c57831ee6ff9Santos Cordon public final void removeConnection(Connection connection) { 3310159ac0cfe20e8f85ee4150e64d91392850f8a3fSantos Cordon Log.d(this, "removing %s from %s", connection, mChildConnections); 332823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon if (connection != null && mChildConnections.remove(connection)) { 333823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon connection.resetConference(); 334823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon for (Listener l : mListeners) { 335823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon l.onConnectionRemoved(this, connection); 336823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 337823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 338823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 339823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 340823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon /** 34150e3506533478fa273cbc92c2919470d1889f1edIhab Awad * Sets the connections with which this connection can be conferenced. 34250e3506533478fa273cbc92c2919470d1889f1edIhab Awad * 34350e3506533478fa273cbc92c2919470d1889f1edIhab Awad * @param conferenceableConnections The set of connections this connection can conference with. 34450e3506533478fa273cbc92c2919470d1889f1edIhab Awad */ 34550e3506533478fa273cbc92c2919470d1889f1edIhab Awad public final void setConferenceableConnections(List<Connection> conferenceableConnections) { 34650e3506533478fa273cbc92c2919470d1889f1edIhab Awad clearConferenceableList(); 34750e3506533478fa273cbc92c2919470d1889f1edIhab Awad for (Connection c : conferenceableConnections) { 34850e3506533478fa273cbc92c2919470d1889f1edIhab Awad // If statement checks for duplicates in input. It makes it N^2 but we're dealing with a 34950e3506533478fa273cbc92c2919470d1889f1edIhab Awad // small amount of items here. 35050e3506533478fa273cbc92c2919470d1889f1edIhab Awad if (!mConferenceableConnections.contains(c)) { 35150e3506533478fa273cbc92c2919470d1889f1edIhab Awad c.addConnectionListener(mConnectionDeathListener); 35250e3506533478fa273cbc92c2919470d1889f1edIhab Awad mConferenceableConnections.add(c); 35350e3506533478fa273cbc92c2919470d1889f1edIhab Awad } 35450e3506533478fa273cbc92c2919470d1889f1edIhab Awad } 35550e3506533478fa273cbc92c2919470d1889f1edIhab Awad fireOnConferenceableConnectionsChanged(); 35650e3506533478fa273cbc92c2919470d1889f1edIhab Awad } 35750e3506533478fa273cbc92c2919470d1889f1edIhab Awad 35850e3506533478fa273cbc92c2919470d1889f1edIhab Awad private final void fireOnConferenceableConnectionsChanged() { 35950e3506533478fa273cbc92c2919470d1889f1edIhab Awad for (Listener l : mListeners) { 36050e3506533478fa273cbc92c2919470d1889f1edIhab Awad l.onConferenceableConnectionsChanged(this, getConferenceableConnections()); 36150e3506533478fa273cbc92c2919470d1889f1edIhab Awad } 36250e3506533478fa273cbc92c2919470d1889f1edIhab Awad } 36350e3506533478fa273cbc92c2919470d1889f1edIhab Awad 36450e3506533478fa273cbc92c2919470d1889f1edIhab Awad /** 36550e3506533478fa273cbc92c2919470d1889f1edIhab Awad * Returns the connections with which this connection can be conferenced. 36650e3506533478fa273cbc92c2919470d1889f1edIhab Awad */ 36750e3506533478fa273cbc92c2919470d1889f1edIhab Awad public final List<Connection> getConferenceableConnections() { 36850e3506533478fa273cbc92c2919470d1889f1edIhab Awad return mUnmodifiableConferenceableConnections; 36950e3506533478fa273cbc92c2919470d1889f1edIhab Awad } 37050e3506533478fa273cbc92c2919470d1889f1edIhab Awad 37150e3506533478fa273cbc92c2919470d1889f1edIhab Awad /** 372ea38cca14964a5ee658899b0bafbc48017d556cdNancy Chen * Tears down the conference object and any of its current connections. 373823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 374a48680427e022ab6eb73277faac6c57831ee6ff9Santos Cordon public final void destroy() { 375823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon Log.d(this, "destroying conference : %s", this); 376823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon // Tear down the children. 3770159ac0cfe20e8f85ee4150e64d91392850f8a3fSantos Cordon for (Connection connection : mChildConnections) { 378823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon Log.d(this, "removing connection %s", connection); 379823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon removeConnection(connection); 380823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 381823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 382823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon // If not yet disconnected, set the conference call as disconnected first. 383823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon if (mState != Connection.STATE_DISCONNECTED) { 384823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon Log.d(this, "setting to disconnected"); 3857f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee setDisconnected(new DisconnectCause(DisconnectCause.LOCAL)); 386823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 387823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 388823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon // ...and notify. 389823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon for (Listener l : mListeners) { 390823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon l.onDestroyed(this); 391823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 392823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 393823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 394823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon /** 395823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Add a listener to be notified of a state change. 396823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * 397823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * @param listener The new listener. 398823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * @return This conference. 399823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * @hide 400823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 401823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public final Conference addListener(Listener listener) { 402823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon mListeners.add(listener); 403823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon return this; 404823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 405823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 406823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon /** 407823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * Removes the specified listener. 408823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * 409823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * @param listener The listener to remove. 410823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * @return This conference. 411823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon * @hide 412823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon */ 413823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon public final Conference removeListener(Listener listener) { 414823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon mListeners.remove(listener); 415823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon return this; 416823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 417823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 418a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee /** 4194a57b9b59b74c97e559a301af0add13cd4c3331cTyler Gunn * Retrieves the primary connection associated with the conference. The primary connection is 4204a57b9b59b74c97e559a301af0add13cd4c3331cTyler Gunn * the connection from which the conference will retrieve its current state. 4214a57b9b59b74c97e559a301af0add13cd4c3331cTyler Gunn * 4224a57b9b59b74c97e559a301af0add13cd4c3331cTyler Gunn * @return The primary connection. 4234a57b9b59b74c97e559a301af0add13cd4c3331cTyler Gunn */ 4244a57b9b59b74c97e559a301af0add13cd4c3331cTyler Gunn public Connection getPrimaryConnection() { 4254a57b9b59b74c97e559a301af0add13cd4c3331cTyler Gunn if (mUnmodifiableChildConnections == null || mUnmodifiableChildConnections.isEmpty()) { 4264a57b9b59b74c97e559a301af0add13cd4c3331cTyler Gunn return null; 4274a57b9b59b74c97e559a301af0add13cd4c3331cTyler Gunn } 4284a57b9b59b74c97e559a301af0add13cd4c3331cTyler Gunn return mUnmodifiableChildConnections.get(0); 4294a57b9b59b74c97e559a301af0add13cd4c3331cTyler Gunn } 4304a57b9b59b74c97e559a301af0add13cd4c3331cTyler Gunn 4314a57b9b59b74c97e559a301af0add13cd4c3331cTyler Gunn /** 432cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn * Sets the connect time of the {@code Conference}. 433cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn * 434cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn * @param connectTimeMillis The connection time, in milliseconds. 435cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn */ 436cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn public void setConnectTimeMillis(long connectTimeMillis) { 437cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn mConnectTimeMillis = connectTimeMillis; 438cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn } 439cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn 440cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn /** 441cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn * Retrieves the connect time of the {@code Conference}, if specified. A value of 442cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn * {@link #CONNECT_TIME_NOT_SPECIFIED} indicates that Telecom should determine the start time 443cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn * of the conference. 444cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn * 445cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn * @return The time the {@code Conference} has been connected. 446cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn */ 447cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn public long getConnectTimeMillis() { 448cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn return mConnectTimeMillis; 449cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn } 450cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn 451cd5d33c89f25b3bfe8989d55f05702d0970c13b4Tyler Gunn /** 452a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee * Inform this Conference that the state of its audio output has been changed externally. 453a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee * 454a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee * @param state The new audio state. 455a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee * @hide 456a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee */ 457a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee final void setAudioState(AudioState state) { 458a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee Log.d(this, "setAudioState %s", state); 459a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee mAudioState = state; 460a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee onAudioStateChanged(state); 461a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee } 462a0d3ca9746143d669fe9384babb9e1b9fca33dcfYorke Lee 463823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon private void setState(int newState) { 464823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon if (newState != Connection.STATE_ACTIVE && 465823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon newState != Connection.STATE_HOLDING && 466823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon newState != Connection.STATE_DISCONNECTED) { 467823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon Log.w(this, "Unsupported state transition for Conference call.", 468823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon Connection.stateToString(newState)); 469823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon return; 470823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 471823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon 472823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon if (mState != newState) { 473823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon int oldState = mState; 474823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon mState = newState; 475823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon for (Listener l : mListeners) { 476823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon l.onStateChanged(this, oldState, newState); 477823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 478823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 479823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon } 48050e3506533478fa273cbc92c2919470d1889f1edIhab Awad 48150e3506533478fa273cbc92c2919470d1889f1edIhab Awad private final void clearConferenceableList() { 48250e3506533478fa273cbc92c2919470d1889f1edIhab Awad for (Connection c : mConferenceableConnections) { 48350e3506533478fa273cbc92c2919470d1889f1edIhab Awad c.removeConnectionListener(mConnectionDeathListener); 48450e3506533478fa273cbc92c2919470d1889f1edIhab Awad } 48550e3506533478fa273cbc92c2919470d1889f1edIhab Awad mConferenceableConnections.clear(); 48650e3506533478fa273cbc92c2919470d1889f1edIhab Awad } 487823fd3c79dd4f762bbc778e0ce9e2204b6d3d454Santos Cordon} 488