Home | History | Annotate | Download | only in telephony

Lines Matching defs:connection

21 import android.telecom.Connection;
57 * Ims conference controller connection listener. Used to respond to changes in state of the
60 private final Connection.Listener mConnectionListener = new Connection.Listener() {
62 public void onStateChanged(Connection c, int state) {
68 public void onDisconnected(Connection c, DisconnectCause disconnectCause) {
74 public void onDestroyed(Connection connection) {
75 remove(connection);
85 public void onConferenceSupportedChanged(Connection c, boolean isConferenceSupported) {
112 * @param connectionService The current connection service.
121 * Adds a new connection to the IMS conference controller.
123 * @param connection
125 void add(TelephonyConnection connection) {
128 if ((connection.getConnectionProperties() & Connection.PROPERTY_IS_EXTERNAL_CALL) ==
129 Connection.PROPERTY_IS_EXTERNAL_CALL) {
133 if (mTelephonyConnections.contains(connection)) {
135 Log.w(this, "add - connection already tracked; connection=%s", connection);
139 // Note: Wrap in Log.VERBOSE to avoid calling connection.toString if we are not going to be
142 Log.v(this, "add connection %s", connection);
145 mTelephonyConnections.add(connection);
146 connection.addConnectionListener(mConnectionListener);
151 * Removes a connection from the IMS conference controller.
153 * @param connection
155 void remove(Connection connection) {
157 if ((connection.getConnectionProperties() & Connection.PROPERTY_IS_EXTERNAL_CALL) ==
158 Connection.PROPERTY_IS_EXTERNAL_CALL) {
162 if (!mTelephonyConnections.contains(connection)) {
164 // when the original connection changes. It does this proactively.
165 Log.d(this, "remove - connection not tracked; connection=%s", connection);
170 Log.v(this, "remove connection: %s", connection);
173 connection.removeConnectionListener(mConnectionListener);
174 mTelephonyConnections.remove(connection);
188 * Calculates the conference-capable state of all GSM connections in this connection service.
197 for (TelephonyConnection connection : mTelephonyConnections) {
199 Log.d(this, "recalc - %s %s supportsConf? %s", connection.getState(), connection,
200 connection.isConferenceSupported());
203 // If this connection is a member of a conference hosted on another device, it is not
205 if (isMemberOfPeerConference(connection)) {
207 Log.v(this, "Skipping connection in peer conference: %s", connection);
212 // If this connection does not support being in a conference call, then it is not
213 // conferenceable with any other connection.
214 if (!connection.isConferenceSupported()) {
215 connection.setConferenceables(Collections.<Conferenceable>emptyList());
219 switch (connection.getState()) {
220 case Connection.STATE_ACTIVE:
222 case Connection.STATE_HOLDING:
223 conferenceableSet.add(connection);
228 // This connection is not active or holding, so clear all conferencable connections
229 connection.setConferenceables(Collections.<Conferenceable>emptyList());
245 case Connection.STATE_ACTIVE:
247 case Connection.STATE_HOLDING:
261 if (c instanceof Connection) {
262 // Remove this connection from the Set and add all others
269 // Connection. We need to do this to ensure that RemoteConnections work properly.
277 ((Connection) c).setConferenceables(conferenceables);
283 imsConference.setConferenceableConnections(Collections.<Connection>emptyList());
288 List<Connection> connections = conferenceableSet
290 .filter(conferenceable -> conferenceable instanceof Connection)
291 .map(conferenceable -> (Connection) conferenceable)
300 * Determines if a connection is a member of a conference hosted on another device.
302 * @param connection The connection.
303 * @return {@code true} if the connection is a member of a conference hosted on another device.
305 private boolean isMemberOfPeerConference(Connection connection) {
306 if (!(connection instanceof TelephonyConnection)) {
309 TelephonyConnection telephonyConnection = (TelephonyConnection) connection;
310 com.android.internal.telephony.Connection originalConnection =
318 * Starts a new ImsConference for a connection which just entered a multiparty state.
325 TelephonyConnection connection = it.next();
326 if (connection.isImsConnection() && connection.getOriginalConnection() != null &&
327 connection.getOriginalConnection().isMultiparty()) {
329 startConference(connection);
336 * Starts a new {@link ImsConference} for the given IMS connection.
338 * Creates a new IMS Conference to manage the conference represented by the connection.
339 * Internally the ImsConference wraps the radio connection with a new TelephonyConnection
340 * which is NOT reported to the connection service and Telecom.
342 * Once the new IMS Conference has been created, the connection passed in is held and removed
343 * from the connection service (removing it from Telecom). The connection is put into a held
344 * state to ensure that telecom removes the connection without putting it into a disconnected
347 * @param connection The connection to the Ims server.
349 private void startConference(TelephonyConnection connection) {
351 Log.v(this, "Start new ImsConference - connection: %s", connection);
354 // Make a clone of the connection which will become the Ims conference host connection.
355 // This is necessary since the Connection Service does not support removing a connection
357 TelephonyConnection conferenceHostConnection = connection.cloneConnection();
358 conferenceHostConnection.setVideoPauseSupported(connection.getVideoPauseSupported());
360 connection.isManageImsConferenceCallSupported());
364 // Attempt to determine the phone account associated with the conference host connection.
365 if (connection.getPhone() != null &&
366 connection.getPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_IMS) {
367 Phone imsPhone = connection.getPhone();
382 // Cleanup TelephonyConnection which backed the original connection and remove from telecom.
385 connection.removeConnectionListener(mConnectionListener);
386 connection.clearOriginalConnection();
387 connection.setDisconnected(new DisconnectCause(DisconnectCause.OTHER,
390 connection.destroy();