FileDocCategorySizeDatePackage
RemoteConnectionService.javaAPI DocAndroid 5.1 API16787Thu Mar 12 22:22:42 GMT 2015android.telecom

RemoteConnectionService

public final class RemoteConnectionService extends Object
Remote connection service which other connection services can use to place calls on their behalf.
hide

Fields Summary
private static final RemoteConnection
NULL_CONNECTION
private static final RemoteConference
NULL_CONFERENCE
private final com.android.internal.telecom.IConnectionServiceAdapter
mServantDelegate
private final ConnectionServiceAdapterServant
mServant
private final android.os.IBinder.DeathRecipient
mDeathRecipient
private final com.android.internal.telecom.IConnectionService
mOutgoingConnectionServiceRpc
private final ConnectionService
mOurConnectionServiceImpl
private final Map
mConnectionById
private final Map
mConferenceById
private final Set
mPendingConnections
Constructors Summary
RemoteConnectionService(com.android.internal.telecom.IConnectionService outgoingConnectionServiceRpc, ConnectionService ourConnectionServiceImpl)


    
             
                
        mOutgoingConnectionServiceRpc = outgoingConnectionServiceRpc;
        mOutgoingConnectionServiceRpc.asBinder().linkToDeath(mDeathRecipient, 0);
        mOurConnectionServiceImpl = ourConnectionServiceImpl;
    
Methods Summary
final RemoteConnectioncreateRemoteConnection(PhoneAccountHandle connectionManagerPhoneAccount, ConnectionRequest request, boolean isIncoming)

        final String id = UUID.randomUUID().toString();
        final ConnectionRequest newRequest = new ConnectionRequest(
                request.getAccountHandle(),
                request.getAddress(),
                request.getExtras(),
                request.getVideoState());
        try {
            if (mConnectionById.isEmpty()) {
                mOutgoingConnectionServiceRpc.addConnectionServiceAdapter(mServant.getStub());
            }
            RemoteConnection connection =
                    new RemoteConnection(id, mOutgoingConnectionServiceRpc, newRequest);
            mPendingConnections.add(connection);
            mConnectionById.put(id, connection);
            mOutgoingConnectionServiceRpc.createConnection(
                    connectionManagerPhoneAccount,
                    id,
                    newRequest,
                    isIncoming,
                    false /* isUnknownCall */);
            connection.registerCallback(new RemoteConnection.Callback() {
                @Override
                public void onDestroyed(RemoteConnection connection) {
                    mConnectionById.remove(id);
                    maybeDisconnectAdapter();
                }
            });
            return connection;
        } catch (RemoteException e) {
            return RemoteConnection.failure(
                    new DisconnectCause(DisconnectCause.ERROR, e.toString()));
        }
    
private RemoteConferencefindConferenceForAction(java.lang.String callId, java.lang.String action)

        if (mConferenceById.containsKey(callId)) {
            return mConferenceById.get(callId);
        }
        Log.w(this, "%s - Cannot find Conference %s", action, callId);
        return NULL_CONFERENCE;
    
private RemoteConnectionfindConnectionForAction(java.lang.String callId, java.lang.String action)

        if (mConnectionById.containsKey(callId)) {
            return mConnectionById.get(callId);
        }
        Log.w(this, "%s - Cannot find Connection %s", action, callId);
        return NULL_CONNECTION;
    
private booleanhasConnection(java.lang.String callId)

        return mConnectionById.containsKey(callId);
    
private voidmaybeDisconnectAdapter()

        if (mConnectionById.isEmpty() && mConferenceById.isEmpty()) {
            try {
                mOutgoingConnectionServiceRpc.removeConnectionServiceAdapter(mServant.getStub());
            } catch (RemoteException e) {
            }
        }
    
public java.lang.StringtoString()

        return "[RemoteCS - " + mOutgoingConnectionServiceRpc.asBinder().toString() + "]";