blob: 4bb78c0103034a1351e4982df5ce5f8414426af8 [file] [log] [blame]
Santos Cordon52d8a152014-06-17 19:08:45 -07001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
Ihab Awadb19a0bc2014-08-07 19:46:01 -070014 * limitations under the License.
Santos Cordon52d8a152014-06-17 19:08:45 -070015 */
16
Tyler Gunnef9f6f92014-09-12 22:16:17 -070017package android.telecom;
Santos Cordon52d8a152014-06-17 19:08:45 -070018
Santos Cordon52d8a152014-06-17 19:08:45 -070019import android.net.Uri;
Ihab Awad5d0410f2014-07-30 10:07:40 -070020import android.os.IBinder;
Santos Cordone8dc4be2014-07-21 01:28:28 -070021import android.os.IBinder.DeathRecipient;
Santos Cordon52d8a152014-06-17 19:08:45 -070022import android.os.RemoteException;
Santos Cordon52d8a152014-06-17 19:08:45 -070023
Tyler Gunnef9f6f92014-09-12 22:16:17 -070024import com.android.internal.telecom.IConnectionService;
25import com.android.internal.telecom.IConnectionServiceAdapter;
26import com.android.internal.telecom.IVideoProvider;
27import com.android.internal.telecom.RemoteServiceCallback;
Santos Cordon52d8a152014-06-17 19:08:45 -070028
Ihab Awadb8e85c72014-08-23 20:34:57 -070029import java.util.ArrayList;
Ihab Awad5d0410f2014-07-30 10:07:40 -070030import java.util.HashMap;
31import java.util.HashSet;
32import java.util.Map;
33import java.util.Set;
Santos Cordon7c7bc7f2014-07-28 18:15:48 -070034import java.util.List;
Santos Cordon52d8a152014-06-17 19:08:45 -070035import java.util.UUID;
36
37/**
38 * Remote connection service which other connection services can use to place calls on their behalf.
Sailesh Nepal091768c2014-06-30 15:15:23 -070039 *
40 * @hide
Santos Cordon52d8a152014-06-17 19:08:45 -070041 */
Ihab Awad5d0410f2014-07-30 10:07:40 -070042final class RemoteConnectionService {
Sailesh Nepal48031592014-07-18 14:21:23 -070043
Tyler Gunn4a57b9b2014-10-30 14:27:48 -070044 // Note: Casting null to avoid ambiguous constructor reference.
Ihab Awadb8e85c72014-08-23 20:34:57 -070045 private static final RemoteConnection NULL_CONNECTION =
Tyler Gunn4a57b9b2014-10-30 14:27:48 -070046 new RemoteConnection("NULL", null, (ConnectionRequest) null);
Ihab Awadb8e85c72014-08-23 20:34:57 -070047
48 private static final RemoteConference NULL_CONFERENCE =
49 new RemoteConference("NULL", null);
Santos Cordon52d8a152014-06-17 19:08:45 -070050
Ihab Awad5d0410f2014-07-30 10:07:40 -070051 private final IConnectionServiceAdapter mServantDelegate = new IConnectionServiceAdapter() {
Sailesh Nepal48031592014-07-18 14:21:23 -070052 @Override
Ihab Awad6107bab2014-08-18 09:23:25 -070053 public void handleCreateConnectionComplete(
Ihab Awadb19a0bc2014-08-07 19:46:01 -070054 String id,
55 ConnectionRequest request,
Ihab Awad5d0410f2014-07-30 10:07:40 -070056 ParcelableConnection parcel) {
Ihab Awadb19a0bc2014-08-07 19:46:01 -070057 RemoteConnection connection =
58 findConnectionForAction(id, "handleCreateConnectionSuccessful");
Ihab Awad5d0410f2014-07-30 10:07:40 -070059 if (connection != NULL_CONNECTION && mPendingConnections.contains(connection)) {
60 mPendingConnections.remove(connection);
Ihab Awad6107bab2014-08-18 09:23:25 -070061 // Unconditionally initialize the connection ...
Ihab Awad5d0410f2014-07-30 10:07:40 -070062 connection.setCallCapabilities(parcel.getCapabilities());
Andrew Lee100e2932014-09-08 15:34:24 -070063 connection.setAddress(
Ihab Awad5d0410f2014-07-30 10:07:40 -070064 parcel.getHandle(), parcel.getHandlePresentation());
65 connection.setCallerDisplayName(
66 parcel.getCallerDisplayName(),
67 parcel.getCallerDisplayNamePresentation());
Sailesh Nepal70638f12014-09-09 21:49:14 -070068 // Set state after handle so that the client can identify the connection.
Sailesh Nepalc2a978d2014-09-20 18:23:05 -070069 if (parcel.getState() == Connection.STATE_DISCONNECTED) {
70 connection.setDisconnected(parcel.getDisconnectCause());
71 } else {
72 connection.setState(parcel.getState());
73 }
Ihab Awadb8e85c72014-08-23 20:34:57 -070074 List<RemoteConnection> conferenceable = new ArrayList<>();
75 for (String confId : parcel.getConferenceableConnectionIds()) {
76 if (mConnectionById.containsKey(confId)) {
77 conferenceable.add(mConnectionById.get(confId));
78 }
79 }
80 connection.setConferenceableConnections(conferenceable);
Ihab Awada64627c2014-08-20 09:36:40 -070081 connection.setVideoState(parcel.getVideoState());
Ihab Awad6107bab2014-08-18 09:23:25 -070082 if (connection.getState() == Connection.STATE_DISCONNECTED) {
83 // ... then, if it was created in a disconnected state, that indicates
84 // failure on the providing end, so immediately mark it destroyed
85 connection.setDestroyed();
86 }
Sailesh Nepal48031592014-07-18 14:21:23 -070087 }
88 }
Sailesh Nepal2ab88cc2014-07-18 14:49:18 -070089
Sailesh Nepal2a46b902014-07-04 17:21:07 -070090 @Override
Ihab Awad5d0410f2014-07-30 10:07:40 -070091 public void setActive(String callId) {
Ihab Awadb8e85c72014-08-23 20:34:57 -070092 if (mConnectionById.containsKey(callId)) {
93 findConnectionForAction(callId, "setActive")
94 .setState(Connection.STATE_ACTIVE);
95 } else {
96 findConferenceForAction(callId, "setActive")
97 .setState(Connection.STATE_ACTIVE);
98 }
Santos Cordon52d8a152014-06-17 19:08:45 -070099 }
100
Sailesh Nepal2a46b902014-07-04 17:21:07 -0700101 @Override
Ihab Awad5d0410f2014-07-30 10:07:40 -0700102 public void setRinging(String callId) {
103 findConnectionForAction(callId, "setRinging")
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700104 .setState(Connection.STATE_RINGING);
Andrew Lee5ffbe8b2014-06-20 16:29:33 -0700105 }
106
Sailesh Nepal2a46b902014-07-04 17:21:07 -0700107 @Override
Ihab Awad5d0410f2014-07-30 10:07:40 -0700108 public void setDialing(String callId) {
109 findConnectionForAction(callId, "setDialing")
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700110 .setState(Connection.STATE_DIALING);
Santos Cordon52d8a152014-06-17 19:08:45 -0700111 }
112
Sailesh Nepal2a46b902014-07-04 17:21:07 -0700113 @Override
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700114 public void setDisconnected(String callId, DisconnectCause disconnectCause) {
Ihab Awadb8e85c72014-08-23 20:34:57 -0700115 if (mConnectionById.containsKey(callId)) {
116 findConnectionForAction(callId, "setDisconnected")
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700117 .setDisconnected(disconnectCause);
Ihab Awadb8e85c72014-08-23 20:34:57 -0700118 } else {
119 findConferenceForAction(callId, "setDisconnected")
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700120 .setDisconnected(disconnectCause);
Ihab Awadb8e85c72014-08-23 20:34:57 -0700121 }
Santos Cordon52d8a152014-06-17 19:08:45 -0700122 }
123
Sailesh Nepal2a46b902014-07-04 17:21:07 -0700124 @Override
Ihab Awad5d0410f2014-07-30 10:07:40 -0700125 public void setOnHold(String callId) {
Ihab Awadb8e85c72014-08-23 20:34:57 -0700126 if (mConnectionById.containsKey(callId)) {
127 findConnectionForAction(callId, "setOnHold")
128 .setState(Connection.STATE_HOLDING);
129 } else {
130 findConferenceForAction(callId, "setOnHold")
131 .setState(Connection.STATE_HOLDING);
132 }
Santos Cordon52d8a152014-06-17 19:08:45 -0700133 }
134
Sailesh Nepal2a46b902014-07-04 17:21:07 -0700135 @Override
Andrew Lee100e2932014-09-08 15:34:24 -0700136 public void setRingbackRequested(String callId, boolean ringing) {
137 findConnectionForAction(callId, "setRingbackRequested")
138 .setRingbackRequested(ringing);
Santos Cordon52d8a152014-06-17 19:08:45 -0700139 }
140
Sailesh Nepal2a46b902014-07-04 17:21:07 -0700141 @Override
Ihab Awad5d0410f2014-07-30 10:07:40 -0700142 public void setCallCapabilities(String callId, int callCapabilities) {
Ihab Awadb8e85c72014-08-23 20:34:57 -0700143 if (mConnectionById.containsKey(callId)) {
144 findConnectionForAction(callId, "setCallCapabilities")
145 .setCallCapabilities(callCapabilities);
146 } else {
147 findConferenceForAction(callId, "setCallCapabilities")
148 .setCallCapabilities(callCapabilities);
149 }
Santos Cordon52d8a152014-06-17 19:08:45 -0700150 }
151
Sailesh Nepal2a46b902014-07-04 17:21:07 -0700152 @Override
Ihab Awad5d0410f2014-07-30 10:07:40 -0700153 public void setIsConferenced(String callId, String conferenceCallId) {
Ihab Awadb8e85c72014-08-23 20:34:57 -0700154 // Note: callId should not be null; conferenceCallId may be null
155 RemoteConnection connection =
156 findConnectionForAction(callId, "setIsConferenced");
157 if (connection != NULL_CONNECTION) {
158 if (conferenceCallId == null) {
159 // 'connection' is being split from its conference
160 if (connection.getConference() != null) {
161 connection.getConference().removeConnection(connection);
162 }
163 } else {
164 RemoteConference conference =
165 findConferenceForAction(conferenceCallId, "setIsConferenced");
166 if (conference != NULL_CONFERENCE) {
167 conference.addConnection(connection);
168 }
169 }
170 }
Santos Cordon52d8a152014-06-17 19:08:45 -0700171 }
172
Sailesh Nepal2a46b902014-07-04 17:21:07 -0700173 @Override
Ihab Awadb8e85c72014-08-23 20:34:57 -0700174 public void addConferenceCall(
175 final String callId,
176 ParcelableConference parcel) {
177 RemoteConference conference = new RemoteConference(callId,
178 mOutgoingConnectionServiceRpc);
179
180 for (String id : parcel.getConnectionIds()) {
181 RemoteConnection c = mConnectionById.get(id);
182 if (c != null) {
183 conference.addConnection(c);
184 }
185 }
186
187 if (conference.getConnections().size() == 0) {
188 // A conference was created, but none of its connections are ones that have been
189 // created by, and therefore being tracked by, this remote connection service. It
190 // is of no interest to us.
191 return;
192 }
193
194 conference.setState(parcel.getState());
195 conference.setCallCapabilities(parcel.getCapabilities());
196 mConferenceById.put(callId, conference);
Andrew Lee100e2932014-09-08 15:34:24 -0700197 conference.registerCallback(new RemoteConference.Callback() {
Ihab Awadb8e85c72014-08-23 20:34:57 -0700198 @Override
199 public void onDestroyed(RemoteConference c) {
200 mConferenceById.remove(callId);
201 maybeDisconnectAdapter();
202 }
203 });
204
205 mOurConnectionServiceImpl.addRemoteConference(conference);
Santos Cordon52d8a152014-06-17 19:08:45 -0700206 }
207
Sailesh Nepal2a46b902014-07-04 17:21:07 -0700208 @Override
Ihab Awad5d0410f2014-07-30 10:07:40 -0700209 public void removeCall(String callId) {
Ihab Awadb8e85c72014-08-23 20:34:57 -0700210 if (mConnectionById.containsKey(callId)) {
211 findConnectionForAction(callId, "removeCall")
212 .setDestroyed();
213 } else {
214 findConferenceForAction(callId, "removeCall")
215 .setDestroyed();
216 }
Santos Cordon52d8a152014-06-17 19:08:45 -0700217 }
218
Sailesh Nepal2a46b902014-07-04 17:21:07 -0700219 @Override
Ihab Awad5d0410f2014-07-30 10:07:40 -0700220 public void onPostDialWait(String callId, String remaining) {
221 findConnectionForAction(callId, "onPostDialWait")
222 .setPostDialWait(remaining);
Santos Cordon52d8a152014-06-17 19:08:45 -0700223 }
224
Santos Cordon52d8a152014-06-17 19:08:45 -0700225 @Override
226 public void queryRemoteConnectionServices(RemoteServiceCallback callback) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700227 // Not supported from remote connection service.
Santos Cordon52d8a152014-06-17 19:08:45 -0700228 }
Tyler Gunn8d83fa92014-07-01 11:31:21 -0700229
Sailesh Nepal33aaae42014-07-07 22:49:44 -0700230 @Override
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700231 public void setVideoProvider(String callId, IVideoProvider videoProvider) {
Ihab Awada64627c2014-08-20 09:36:40 -0700232 findConnectionForAction(callId, "setVideoProvider")
233 .setVideoProvider(new RemoteConnection.VideoProvider(videoProvider));
Tyler Gunnaa07df82014-07-17 07:50:22 -0700234 }
235
236 @Override
Ihab Awad5d0410f2014-07-30 10:07:40 -0700237 public void setVideoState(String callId, int videoState) {
238 findConnectionForAction(callId, "setVideoState")
239 .setVideoState(videoState);
Sailesh Nepal33aaae42014-07-07 22:49:44 -0700240 }
Sailesh Nepale7ef59a2014-07-08 21:48:22 -0700241
Sailesh Nepale7ef59a2014-07-08 21:48:22 -0700242 @Override
Andrew Lee100e2932014-09-08 15:34:24 -0700243 public void setIsVoipAudioMode(String callId, boolean isVoip) {
244 findConnectionForAction(callId, "setIsVoipAudioMode")
245 .setIsVoipAudioMode(isVoip);
Sailesh Nepale7ef59a2014-07-08 21:48:22 -0700246 }
Sailesh Nepal61203862014-07-11 14:50:13 -0700247
248 @Override
Ihab Awad5d0410f2014-07-30 10:07:40 -0700249 public void setStatusHints(String callId, StatusHints statusHints) {
250 findConnectionForAction(callId, "setStatusHints")
251 .setStatusHints(statusHints);
Sailesh Nepal61203862014-07-11 14:50:13 -0700252 }
253
254 @Override
Andrew Lee100e2932014-09-08 15:34:24 -0700255 public void setAddress(String callId, Uri address, int presentation) {
256 findConnectionForAction(callId, "setAddress")
257 .setAddress(address, presentation);
Sailesh Nepal61203862014-07-11 14:50:13 -0700258 }
Sailesh Nepal2ab88cc2014-07-18 14:49:18 -0700259
260 @Override
Ihab Awad5d0410f2014-07-30 10:07:40 -0700261 public void setCallerDisplayName(String callId, String callerDisplayName,
262 int presentation) {
263 findConnectionForAction(callId, "setCallerDisplayName")
264 .setCallerDisplayName(callerDisplayName, presentation);
265 }
266
267 @Override
Ihab Awad5d0410f2014-07-30 10:07:40 -0700268 public IBinder asBinder() {
269 throw new UnsupportedOperationException();
Sailesh Nepal2ab88cc2014-07-18 14:49:18 -0700270 }
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700271
272 @Override
273 public final void setConferenceableConnections(
274 String callId, List<String> conferenceableConnectionIds) {
Ihab Awadb8e85c72014-08-23 20:34:57 -0700275 List<RemoteConnection> conferenceable = new ArrayList<>();
276 for (String id : conferenceableConnectionIds) {
277 if (mConnectionById.containsKey(id)) {
278 conferenceable.add(mConnectionById.get(id));
279 }
280 }
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700281
Ihab Awad50e35062014-09-30 09:17:03 -0700282 if (hasConnection(callId)) {
283 findConnectionForAction(callId, "setConferenceableConnections")
284 .setConferenceableConnections(conferenceable);
285 } else {
286 findConferenceForAction(callId, "setConferenceableConnections")
287 .setConferenceableConnections(conferenceable);
288 }
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700289 }
Tyler Gunn4a57b9b2014-10-30 14:27:48 -0700290
291 @Override
292 public void addExistingConnection(String callId, ParcelableConnection connection) {
293 // TODO: add contents of this method
294 RemoteConnection remoteConnction = new RemoteConnection(callId,
295 mOutgoingConnectionServiceRpc, connection);
296
297 mOurConnectionServiceImpl.addRemoteExistingConnection(remoteConnction);
298 }
Santos Cordon52d8a152014-06-17 19:08:45 -0700299 };
300
Ihab Awad5d0410f2014-07-30 10:07:40 -0700301 private final ConnectionServiceAdapterServant mServant =
302 new ConnectionServiceAdapterServant(mServantDelegate);
Santos Cordon52d8a152014-06-17 19:08:45 -0700303
Ihab Awad5d0410f2014-07-30 10:07:40 -0700304 private final DeathRecipient mDeathRecipient = new DeathRecipient() {
305 @Override
306 public void binderDied() {
307 for (RemoteConnection c : mConnectionById.values()) {
308 c.setDestroyed();
309 }
Ihab Awadb8e85c72014-08-23 20:34:57 -0700310 for (RemoteConference c : mConferenceById.values()) {
311 c.setDestroyed();
312 }
Ihab Awad5d0410f2014-07-30 10:07:40 -0700313 mConnectionById.clear();
Ihab Awadb8e85c72014-08-23 20:34:57 -0700314 mConferenceById.clear();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700315 mPendingConnections.clear();
Ihab Awadb8e85c72014-08-23 20:34:57 -0700316 mOutgoingConnectionServiceRpc.asBinder().unlinkToDeath(mDeathRecipient, 0);
Ihab Awad5d0410f2014-07-30 10:07:40 -0700317 }
318 };
319
Ihab Awadb8e85c72014-08-23 20:34:57 -0700320 private final IConnectionService mOutgoingConnectionServiceRpc;
321 private final ConnectionService mOurConnectionServiceImpl;
Ihab Awad5d0410f2014-07-30 10:07:40 -0700322 private final Map<String, RemoteConnection> mConnectionById = new HashMap<>();
Ihab Awadb8e85c72014-08-23 20:34:57 -0700323 private final Map<String, RemoteConference> mConferenceById = new HashMap<>();
Ihab Awad5d0410f2014-07-30 10:07:40 -0700324 private final Set<RemoteConnection> mPendingConnections = new HashSet<>();
325
Ihab Awadb8e85c72014-08-23 20:34:57 -0700326 RemoteConnectionService(
327 IConnectionService outgoingConnectionServiceRpc,
328 ConnectionService ourConnectionServiceImpl) throws RemoteException {
329 mOutgoingConnectionServiceRpc = outgoingConnectionServiceRpc;
330 mOutgoingConnectionServiceRpc.asBinder().linkToDeath(mDeathRecipient, 0);
331 mOurConnectionServiceImpl = ourConnectionServiceImpl;
Santos Cordon52d8a152014-06-17 19:08:45 -0700332 }
333
334 @Override
335 public String toString() {
Ihab Awadb8e85c72014-08-23 20:34:57 -0700336 return "[RemoteCS - " + mOutgoingConnectionServiceRpc.asBinder().toString() + "]";
Santos Cordon52d8a152014-06-17 19:08:45 -0700337 }
338
Ihab Awadf8b69882014-07-25 15:14:01 -0700339 final RemoteConnection createRemoteConnection(
340 PhoneAccountHandle connectionManagerPhoneAccount,
341 ConnectionRequest request,
342 boolean isIncoming) {
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700343 final String id = UUID.randomUUID().toString();
Ihab Awad8aecfed2014-08-08 17:06:11 -0700344 final ConnectionRequest newRequest = new ConnectionRequest(
Ihab Awad5d0410f2014-07-30 10:07:40 -0700345 request.getAccountHandle(),
Nancy Chenea38cca2014-09-05 16:38:49 -0700346 request.getAddress(),
Ihab Awad5d0410f2014-07-30 10:07:40 -0700347 request.getExtras(),
348 request.getVideoState());
349 try {
Ihab Awad8aecfed2014-08-08 17:06:11 -0700350 if (mConnectionById.isEmpty()) {
Ihab Awadb8e85c72014-08-23 20:34:57 -0700351 mOutgoingConnectionServiceRpc.addConnectionServiceAdapter(mServant.getStub());
Ihab Awad8aecfed2014-08-08 17:06:11 -0700352 }
353 RemoteConnection connection =
Ihab Awadb8e85c72014-08-23 20:34:57 -0700354 new RemoteConnection(id, mOutgoingConnectionServiceRpc, newRequest);
Ihab Awad8aecfed2014-08-08 17:06:11 -0700355 mPendingConnections.add(connection);
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700356 mConnectionById.put(id, connection);
Ihab Awadb8e85c72014-08-23 20:34:57 -0700357 mOutgoingConnectionServiceRpc.createConnection(
Ihab Awad5d0410f2014-07-30 10:07:40 -0700358 connectionManagerPhoneAccount,
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700359 id,
Ihab Awad5d0410f2014-07-30 10:07:40 -0700360 newRequest,
Yorke Leec3cf9822014-10-02 09:38:39 -0700361 isIncoming,
362 false /* isUnknownCall */);
Andrew Lee100e2932014-09-08 15:34:24 -0700363 connection.registerCallback(new RemoteConnection.Callback() {
Ihab Awad8aecfed2014-08-08 17:06:11 -0700364 @Override
365 public void onDestroyed(RemoteConnection connection) {
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700366 mConnectionById.remove(id);
Ihab Awadb8e85c72014-08-23 20:34:57 -0700367 maybeDisconnectAdapter();
Ihab Awad8aecfed2014-08-08 17:06:11 -0700368 }
369 });
Ihab Awad5d0410f2014-07-30 10:07:40 -0700370 return connection;
371 } catch (RemoteException e) {
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700372 return RemoteConnection.failure(
373 new DisconnectCause(DisconnectCause.ERROR, e.toString()));
Santos Cordon52d8a152014-06-17 19:08:45 -0700374 }
375 }
376
Ihab Awad50e35062014-09-30 09:17:03 -0700377 private boolean hasConnection(String callId) {
mike dooley879142b2014-10-08 13:39:28 -0700378 return mConnectionById.containsKey(callId);
Ihab Awad50e35062014-09-30 09:17:03 -0700379 }
380
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700381 private RemoteConnection findConnectionForAction(
382 String callId, String action) {
Ihab Awad5d0410f2014-07-30 10:07:40 -0700383 if (mConnectionById.containsKey(callId)) {
384 return mConnectionById.get(callId);
385 }
386 Log.w(this, "%s - Cannot find Connection %s", action, callId);
387 return NULL_CONNECTION;
Santos Cordon52d8a152014-06-17 19:08:45 -0700388 }
Ihab Awadb8e85c72014-08-23 20:34:57 -0700389
390 private RemoteConference findConferenceForAction(
391 String callId, String action) {
392 if (mConferenceById.containsKey(callId)) {
393 return mConferenceById.get(callId);
394 }
395 Log.w(this, "%s - Cannot find Conference %s", action, callId);
396 return NULL_CONFERENCE;
397 }
398
399 private void maybeDisconnectAdapter() {
400 if (mConnectionById.isEmpty() && mConferenceById.isEmpty()) {
401 try {
402 mOutgoingConnectionServiceRpc.removeConnectionServiceAdapter(mServant.getStub());
403 } catch (RemoteException e) {
404 }
405 }
406 }
Santos Cordon52d8a152014-06-17 19:08:45 -0700407}