FileDocCategorySizeDatePackage
ConnectionServiceAdapter.javaAPI DocAndroid 5.1 API12480Thu Mar 12 22:22:42 GMT 2015android.telecom

ConnectionServiceAdapter

public final class ConnectionServiceAdapter extends Object implements android.os.IBinder.DeathRecipient
Provides methods for IConnectionService implementations to interact with the system phone app.
hide

Fields Summary
private final Set
mAdapters
ConcurrentHashMap constructor params: 8 is initial table size, 0.9f is load factor before resizing, 1 means we only expect a single thread to access the map so make only a single shard
Constructors Summary
ConnectionServiceAdapter()


     
    
Methods Summary
voidaddAdapter(com.android.internal.telecom.IConnectionServiceAdapter adapter)

        if (mAdapters.add(adapter)) {
            try {
                adapter.asBinder().linkToDeath(this, 0);
            } catch (RemoteException e) {
                mAdapters.remove(adapter);
            }
        }
    
voidaddConferenceCall(java.lang.String callId, ParcelableConference parcelableConference)
Indicates that a new conference call has been created.

param
callId The unique ID of the conference call.

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.addConferenceCall(callId, parcelableConference);
            } catch (RemoteException ignored) {
            }
        }
    
voidaddExistingConnection(java.lang.String callId, ParcelableConnection connection)
Informs telecom of an existing connection which was added by the {@link ConnectionService}.

param
callId The unique ID of the call being added.
param
connection The connection.

        Log.v(this, "addExistingConnection: %s", callId);
        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.addExistingConnection(callId, connection);
            } catch (RemoteException ignored) {
            }
        }
    
public voidbinderDied()
${inheritDoc}

        Iterator<IConnectionServiceAdapter> it = mAdapters.iterator();
        while (it.hasNext()) {
            IConnectionServiceAdapter adapter = it.next();
            if (!adapter.asBinder().isBinderAlive()) {
                it.remove();
                adapter.asBinder().unlinkToDeath(this, 0);
            }
        }
    
voidhandleCreateConnectionComplete(java.lang.String id, ConnectionRequest request, ParcelableConnection connection)

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.handleCreateConnectionComplete(id, request, connection);
            } catch (RemoteException e) {
            }
        }
    
voidonPostDialChar(java.lang.String callId, char nextChar)

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.onPostDialChar(callId, nextChar);
            } catch (RemoteException ignored) {
            }
        }
    
voidonPostDialWait(java.lang.String callId, java.lang.String remaining)

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.onPostDialWait(callId, remaining);
            } catch (RemoteException ignored) {
            }
        }
    
voidqueryRemoteConnectionServices(com.android.internal.telecom.RemoteServiceCallback callback)
Retrieves a list of remote connection services usable to place calls.

        // Only supported when there is only one adapter.
        if (mAdapters.size() == 1) {
            try {
                mAdapters.iterator().next().queryRemoteConnectionServices(callback);
            } catch (RemoteException e) {
                Log.e(this, e, "Exception trying to query for remote CSs");
            }
        }
    
voidremoveAdapter(com.android.internal.telecom.IConnectionServiceAdapter adapter)

        if (adapter != null && mAdapters.remove(adapter)) {
            adapter.asBinder().unlinkToDeath(this, 0);
        }
    
voidremoveCall(java.lang.String callId)
Indicates that the call no longer exists. Can be used with either a call or a conference call.

param
callId The unique ID of the call.

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.removeCall(callId);
            } catch (RemoteException ignored) {
            }
        }
    
voidsetActive(java.lang.String callId)
Sets a call's state to active (e.g., an ongoing call where two parties can actively communicate).

param
callId The unique ID of the call whose state is changing to active.

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setActive(callId);
            } catch (RemoteException e) {
            }
        }
    
voidsetAddress(java.lang.String callId, android.net.Uri address, int presentation)

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setAddress(callId, address, presentation);
            } catch (RemoteException e) {
            }
        }
    
voidsetCallerDisplayName(java.lang.String callId, java.lang.String callerDisplayName, int presentation)

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setCallerDisplayName(callId, callerDisplayName, presentation);
            } catch (RemoteException e) {
            }
        }
    
voidsetConferenceableConnections(java.lang.String callId, java.util.List conferenceableCallIds)

        Log.v(this, "setConferenceableConnections: %s, %s", callId, conferenceableCallIds);
        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setConferenceableConnections(callId, conferenceableCallIds);
            } catch (RemoteException ignored) {
            }
        }
    
voidsetConnectionCapabilities(java.lang.String callId, int capabilities)

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setConnectionCapabilities(callId, capabilities);
            } catch (RemoteException ignored) {
            }
        }
    
voidsetDialing(java.lang.String callId)
Sets a call's state to dialing (e.g., dialing an outbound call).

param
callId The unique ID of the call whose state is changing to dialing.

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setDialing(callId);
            } catch (RemoteException e) {
            }
        }
    
voidsetDisconnected(java.lang.String callId, DisconnectCause disconnectCause)
Sets a call's state to disconnected.

param
callId The unique ID of the call whose state is changing to disconnected.
param
disconnectCause The reason for the disconnection, as described by {@link android.telecomm.DisconnectCause}.

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setDisconnected(callId, disconnectCause);
            } catch (RemoteException e) {
            }
        }
    
voidsetIsConferenced(java.lang.String callId, java.lang.String conferenceCallId)
Indicates whether or not the specified call is currently conferenced into the specified conference call.

param
callId The unique ID of the call being conferenced.
param
conferenceCallId The unique ID of the conference call. Null if call is not conferenced.

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                Log.d(this, "sending connection %s with conference %s", callId, conferenceCallId);
                adapter.setIsConferenced(callId, conferenceCallId);
            } catch (RemoteException ignored) {
            }
        }
    
voidsetIsVoipAudioMode(java.lang.String callId, boolean isVoip)
Requests that the framework use VOIP audio mode for this connection.

param
callId The unique ID of the call to set with the given call video provider.
param
isVoip True if the audio mode is VOIP.

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setIsVoipAudioMode(callId, isVoip);
            } catch (RemoteException e) {
            }
        }
    
voidsetOnHold(java.lang.String callId)
Sets a call's state to be on hold.

param
callId - The unique ID of the call whose state is changing to be on hold.

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setOnHold(callId);
            } catch (RemoteException e) {
            }
        }
    
voidsetRingbackRequested(java.lang.String callId, boolean ringback)
Asks Telecom to start or stop a ringback tone for a call.

param
callId The unique ID of the call whose ringback is being changed.
param
ringback Whether Telecom should start playing a ringback tone.

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setRingbackRequested(callId, ringback);
            } catch (RemoteException e) {
            }
        }
    
voidsetRinging(java.lang.String callId)
Sets a call's state to ringing (e.g., an inbound ringing call).

param
callId The unique ID of the call whose state is changing to ringing.

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setRinging(callId);
            } catch (RemoteException e) {
            }
        }
    
voidsetStatusHints(java.lang.String callId, StatusHints statusHints)

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setStatusHints(callId, statusHints);
            } catch (RemoteException e) {
            }
        }
    
voidsetVideoProvider(java.lang.String callId, Connection.VideoProvider videoProvider)
Sets the call video provider for a call.

param
callId The unique ID of the call to set with the given call video provider.
param
videoProvider The call video provider instance to set on the call.

        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setVideoProvider(
                        callId,
                        videoProvider == null ? null : videoProvider.getInterface());
            } catch (RemoteException e) {
            }
        }
    
voidsetVideoState(java.lang.String callId, int videoState)
Sets the video state associated with a call. Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY}, {@link VideoProfile.VideoState#BIDIRECTIONAL}, {@link VideoProfile.VideoState#TX_ENABLED}, {@link VideoProfile.VideoState#RX_ENABLED}.

param
callId The unique ID of the call to set the video state for.
param
videoState The video state.

        Log.v(this, "setVideoState: %d", videoState);
        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setVideoState(callId, videoState);
            } catch (RemoteException ignored) {
            }
        }