RemoteConnectionServicepublic final class RemoteConnectionService extends Object Remote connection service which other connection services can use to place calls on their behalf. |
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 RemoteConnection | createRemoteConnection(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 RemoteConference | findConferenceForAction(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 RemoteConnection | findConnectionForAction(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 boolean | hasConnection(java.lang.String callId)
return mConnectionById.containsKey(callId);
| private void | maybeDisconnectAdapter()
if (mConnectionById.isEmpty() && mConferenceById.isEmpty()) {
try {
mOutgoingConnectionServiceRpc.removeConnectionServiceAdapter(mServant.getStub());
} catch (RemoteException e) {
}
}
| public java.lang.String | toString()
return "[RemoteCS - " + mOutgoingConnectionServiceRpc.asBinder().toString() + "]";
|
|