blob: b8150fdac1eb39a872f20dc71867d684edf3ae68 [file] [log] [blame]
Santos Cordon8e8b8d22013-12-19 14:14:05 -08001/*
2 * Copyright (C) 2013 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
14 * limitations under the License.
15 */
16
Ben Gilad9f2bed32013-12-12 17:43:26 -080017package com.android.telecomm;
18
Evan Charlton5c670a92014-03-06 14:58:20 -080019import android.Manifest;
Sailesh Nepal1cecc7c2014-03-10 17:03:08 -070020import android.content.Context;
Evan Charlton5c670a92014-03-06 14:58:20 -080021import android.content.Intent;
Sailesh Nepal1cecc7c2014-03-10 17:03:08 -070022import android.media.AudioManager;
Evan Charltona05805b2014-03-05 08:21:46 -080023import android.os.Bundle;
Evan Charlton5c670a92014-03-06 14:58:20 -080024import android.telecomm.CallService;
Ben Giladc5b22692014-02-18 20:03:22 -080025import android.telecomm.CallServiceDescriptor;
Santos Cordon681663d2014-01-30 04:32:15 -080026import android.telecomm.CallState;
Evan Charlton5c670a92014-03-06 14:58:20 -080027import android.telephony.TelephonyManager;
Santos Cordon8e8b8d22013-12-19 14:14:05 -080028
Sailesh Nepala439e1b2014-03-11 18:19:58 -070029import com.android.internal.telecomm.ICallService;
Santos Cordon681663d2014-01-30 04:32:15 -080030import com.google.common.base.Preconditions;
31import com.google.common.base.Strings;
Santos Cordon8e8b8d22013-12-19 14:14:05 -080032import com.google.common.collect.Lists;
Santos Cordon681663d2014-01-30 04:32:15 -080033import com.google.common.collect.Maps;
Ben Gilad9f2bed32013-12-12 17:43:26 -080034
Ben Gilad9f2bed32013-12-12 17:43:26 -080035import java.util.List;
Santos Cordon681663d2014-01-30 04:32:15 -080036import java.util.Map;
Ben Gilad9f2bed32013-12-12 17:43:26 -080037
Ben Giladdd8c6082013-12-30 14:44:08 -080038/**
39 * Singleton.
40 *
41 * NOTE(gilad): by design most APIs are package private, use the relevant adapter/s to allow
42 * access from other packages specifically refraining from passing the CallsManager instance
43 * beyond the com.android.telecomm package boundary.
44 */
Santos Cordon8e8b8d22013-12-19 14:14:05 -080045public final class CallsManager {
Ben Gilada0d9f752014-02-26 11:49:03 -080046
Santos Cordon8e8b8d22013-12-19 14:14:05 -080047 private static final CallsManager INSTANCE = new CallsManager();
Ben Gilad9f2bed32013-12-12 17:43:26 -080048
Santos Cordone3d76ab2014-01-28 17:25:20 -080049 private final Switchboard mSwitchboard;
50
51 /** Used to control the in-call app. */
52 private final InCallController mInCallController;
53
Santos Cordon4e9fffe2014-03-04 18:13:41 -080054 private final Ringer mRinger;
55
Santos Cordon8e8b8d22013-12-19 14:14:05 -080056 /**
Santos Cordon681663d2014-01-30 04:32:15 -080057 * The main call repository. Keeps an instance of all live calls keyed by call ID. New incoming
58 * and outgoing calls are added to the map and removed when the calls move to the disconnected
59 * state.
60 * TODO(santoscordon): Add new CallId class and use it in place of String.
61 */
62 private final Map<String, Call> mCalls = Maps.newHashMap();
63
64 /**
Santos Cordon4e9fffe2014-03-04 18:13:41 -080065 * Used to keep ordering of unanswered incoming calls. The existence of multiple call services
66 * means that there can easily exist multiple incoming calls and explicit ordering is useful for
67 * maintaining the proper state of the ringer.
68 * TODO(santoscordon): May want to add comments about ITelephony.answerCall() method since
69 * ordering may also apply to that case.
70 */
71 private final List<Call> mUnansweredIncomingCalls = Lists.newLinkedList();
72
73 /**
Santos Cordon8e8b8d22013-12-19 14:14:05 -080074 * May be unnecessary per off-line discussions (between santoscordon and gilad) since the set
75 * of CallsManager APIs that need to be exposed to the dialer (or any application firing call
76 * intents) may be empty.
77 */
78 private DialerAdapter mDialerAdapter;
Ben Gilad9f2bed32013-12-12 17:43:26 -080079
Santos Cordon8e8b8d22013-12-19 14:14:05 -080080 private InCallAdapter mInCallAdapter;
Ben Gilad9f2bed32013-12-12 17:43:26 -080081
Santos Cordon8e8b8d22013-12-19 14:14:05 -080082 private CallLogManager mCallLogManager;
Ben Gilad9f2bed32013-12-12 17:43:26 -080083
Santos Cordon8e8b8d22013-12-19 14:14:05 -080084 private VoicemailManager mVoicemailManager;
Ben Gilad9f2bed32013-12-12 17:43:26 -080085
Evan Charltonf02e9882014-03-06 12:54:52 -080086 private final List<OutgoingCallValidator> mOutgoingCallValidators = Lists.newArrayList();
Ben Gilad9f2bed32013-12-12 17:43:26 -080087
Evan Charltonf02e9882014-03-06 12:54:52 -080088 private final List<IncomingCallValidator> mIncomingCallValidators = Lists.newArrayList();
Ben Gilad9f2bed32013-12-12 17:43:26 -080089
Santos Cordon8e8b8d22013-12-19 14:14:05 -080090 /**
Ben Gilad8bdaa462014-02-05 12:53:19 -080091 * Initializes the required Telecomm components.
Santos Cordon8e8b8d22013-12-19 14:14:05 -080092 */
93 private CallsManager() {
Santos Cordon6242b132014-02-07 16:24:42 -080094 mSwitchboard = new Switchboard(this);
95 mInCallController = new InCallController(this);
Santos Cordon4e9fffe2014-03-04 18:13:41 -080096 mRinger = new Ringer();
Santos Cordon8e8b8d22013-12-19 14:14:05 -080097 }
98
Ben Gilada0d9f752014-02-26 11:49:03 -080099 static CallsManager getInstance() {
100 return INSTANCE;
101 }
102
Santos Cordon8e8b8d22013-12-19 14:14:05 -0800103 /**
Santos Cordon493e8f22014-02-19 03:15:12 -0800104 * Starts the incoming call sequence by having switchboard gather more information about the
105 * specified call; using the specified call service descriptor. Upon success, execution returns
106 * to {@link #handleSuccessfulIncomingCall} to start the in-call UI.
Santos Cordon80d9bdc2014-02-13 18:28:46 -0800107 *
Ben Giladc5b22692014-02-18 20:03:22 -0800108 * @param descriptor The descriptor of the call service to use for this incoming call.
Evan Charltona05805b2014-03-05 08:21:46 -0800109 * @param extras The optional extras Bundle passed with the intent used for the incoming call.
Santos Cordon80d9bdc2014-02-13 18:28:46 -0800110 */
Evan Charltona05805b2014-03-05 08:21:46 -0800111 void processIncomingCallIntent(CallServiceDescriptor descriptor, Bundle extras) {
Sailesh Nepalf1c191d2014-03-07 18:17:39 -0800112 Log.d(this, "processIncomingCallIntent");
Santos Cordon80d9bdc2014-02-13 18:28:46 -0800113 // Create a call with no handle. Eventually, switchboard will update the call with
114 // additional information from the call service, but for now we just need one to pass around
115 // with a unique call ID.
Santos Cordon493e8f22014-02-19 03:15:12 -0800116 Call call = new Call();
Santos Cordon80d9bdc2014-02-13 18:28:46 -0800117
Evan Charltona05805b2014-03-05 08:21:46 -0800118 mSwitchboard.retrieveIncomingCall(call, descriptor, extras);
Santos Cordon80d9bdc2014-02-13 18:28:46 -0800119 }
120
121 /**
Ben Gilada0d9f752014-02-26 11:49:03 -0800122 * Validates the specified call and, upon no objection to connect it, adds the new call to the
123 * list of live calls. Also notifies the in-call app so the user can answer or reject the call.
124 *
125 * @param call The new incoming call.
126 */
127 void handleSuccessfulIncomingCall(Call call) {
Sailesh Nepalf1c191d2014-03-07 18:17:39 -0800128 Log.d(this, "handleSuccessfulIncomingCall");
Ben Gilada0d9f752014-02-26 11:49:03 -0800129 Preconditions.checkState(call.getState() == CallState.RINGING);
130
131 String handle = call.getHandle();
132 ContactInfo contactInfo = call.getContactInfo();
133 for (IncomingCallValidator validator : mIncomingCallValidators) {
134 if (!validator.isValid(handle, contactInfo)) {
135 // TODO(gilad): Consider displaying an error message.
Sailesh Nepalf1c191d2014-03-07 18:17:39 -0800136 Log.i(this, "Dropping restricted incoming call");
Ben Gilada0d9f752014-02-26 11:49:03 -0800137 return;
138 }
139 }
140
141 // No objection to accept the incoming call, proceed with potentially connecting it (based
142 // on the user's action, or lack thereof).
143 addCall(call);
Santos Cordon4e9fffe2014-03-04 18:13:41 -0800144
145 mUnansweredIncomingCalls.add(call);
146 if (mUnansweredIncomingCalls.size() == 1) {
147 // Start the ringer if we are the top-most incoming call (the only one in this case).
148 mRinger.startRinging();
149 }
Ben Gilada0d9f752014-02-26 11:49:03 -0800150 }
151
152 /**
Santos Cordon8e8b8d22013-12-19 14:14:05 -0800153 * Attempts to issue/connect the specified call. From an (arbitrary) application standpoint,
154 * all that is required to initiate this flow is to fire either of the CALL, CALL_PRIVILEGED,
155 * and CALL_EMERGENCY intents. These are listened to by CallActivity.java which then invokes
156 * this method.
157 *
158 * @param handle The handle to dial.
159 * @param contactInfo Information about the entity being called.
Santos Cordon8e8b8d22013-12-19 14:14:05 -0800160 */
Ben Gilada0d9f752014-02-26 11:49:03 -0800161 void processOutgoingCallIntent(String handle, ContactInfo contactInfo) {
Ben Gilad8bdaa462014-02-05 12:53:19 -0800162 for (OutgoingCallValidator validator : mOutgoingCallValidators) {
Ben Gilada0d9f752014-02-26 11:49:03 -0800163 if (!validator.isValid(handle, contactInfo)) {
164 // TODO(gilad): Display an error message.
Sailesh Nepalf1c191d2014-03-07 18:17:39 -0800165 Log.i(this, "Dropping restricted outgoing call.");
Ben Gilada0d9f752014-02-26 11:49:03 -0800166 return;
167 }
Santos Cordon8e8b8d22013-12-19 14:14:05 -0800168 }
169
170 // No objection to issue the call, proceed with trying to put it through.
Ben Gilad13329fd2014-02-11 17:20:29 -0800171 Call call = new Call(handle, contactInfo);
Santos Cordonc195e362014-02-11 17:05:31 -0800172 mSwitchboard.placeOutgoingCall(call);
Santos Cordon8e8b8d22013-12-19 14:14:05 -0800173 }
Santos Cordone3d76ab2014-01-28 17:25:20 -0800174
175 /**
Santos Cordon681663d2014-01-30 04:32:15 -0800176 * Adds a new outgoing call to the list of live calls and notifies the in-call app.
177 *
178 * @param call The new outgoing call.
179 */
180 void handleSuccessfulOutgoingCall(Call call) {
181 // OutgoingCallProcessor sets the call state to DIALING when it receives confirmation of the
182 // placed call from the call service so there is no need to set it here. Instead, check that
183 // the state is appropriate.
184 Preconditions.checkState(call.getState() == CallState.DIALING);
Santos Cordon681663d2014-01-30 04:32:15 -0800185 addCall(call);
Santos Cordon681663d2014-01-30 04:32:15 -0800186 }
187
188 /**
Santos Cordone3d76ab2014-01-28 17:25:20 -0800189 * Instructs Telecomm to answer the specified call. Intended to be invoked by the in-call
190 * app through {@link InCallAdapter} after Telecomm notifies it of an incoming call followed by
191 * the user opting to answer said call.
192 *
193 * @param callId The ID of the call.
194 */
195 void answerCall(String callId) {
Santos Cordon61d0f702014-02-19 02:52:23 -0800196 Call call = mCalls.get(callId);
197 if (call == null) {
Sailesh Nepalf1c191d2014-03-07 18:17:39 -0800198 Log.i(this, "Request to answer a non-existent call %s", callId);
Santos Cordon61d0f702014-02-19 02:52:23 -0800199 } else {
Santos Cordon4e9fffe2014-03-04 18:13:41 -0800200 stopRinging(call);
201
Santos Cordon61d0f702014-02-19 02:52:23 -0800202 // We do not update the UI until we get confirmation of the answer() through
203 // {@link #markCallAsActive}. However, if we ever change that to look more responsive,
204 // then we need to make sure we add a timeout for the answer() in case the call never
205 // comes out of RINGING.
206 call.answer();
207 }
Santos Cordone3d76ab2014-01-28 17:25:20 -0800208 }
209
210 /**
211 * Instructs Telecomm to reject the specified call. Intended to be invoked by the in-call
212 * app through {@link InCallAdapter} after Telecomm notifies it of an incoming call followed by
213 * the user opting to reject said call.
214 *
215 * @param callId The ID of the call.
216 */
217 void rejectCall(String callId) {
Santos Cordon61d0f702014-02-19 02:52:23 -0800218 Call call = mCalls.get(callId);
219 if (call == null) {
Sailesh Nepalf1c191d2014-03-07 18:17:39 -0800220 Log.i(this, "Request to reject a non-existent call %s", callId);
Santos Cordon61d0f702014-02-19 02:52:23 -0800221 } else {
Santos Cordon4e9fffe2014-03-04 18:13:41 -0800222 stopRinging(call);
Santos Cordon61d0f702014-02-19 02:52:23 -0800223 call.reject();
224 }
Santos Cordone3d76ab2014-01-28 17:25:20 -0800225 }
226
227 /**
228 * Instructs Telecomm to disconnect the specified call. Intended to be invoked by the
229 * in-call app through {@link InCallAdapter} for an ongoing call. This is usually triggered by
230 * the user hitting the end-call button.
231 *
232 * @param callId The ID of the call.
233 */
234 void disconnectCall(String callId) {
Santos Cordon049b7b62014-01-30 05:34:26 -0800235 Call call = mCalls.get(callId);
236 if (call == null) {
Sailesh Nepalf1c191d2014-03-07 18:17:39 -0800237 Log.w(this, "Unknown call (%s) asked to disconnect", callId);
Santos Cordon049b7b62014-01-30 05:34:26 -0800238 } else {
239 call.disconnect();
240 }
241
Sailesh Nepal1cecc7c2014-03-10 17:03:08 -0700242 // TODO(sail): Replace with CallAudioManager.
243 Log.v(this, "disconnectCall, abandoning audio focus");
244 Context context = TelecommApp.getInstance().getApplicationContext();
245 AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
246 audioManager.setMode(AudioManager.MODE_NORMAL);
247 audioManager.abandonAudioFocusForCall();
Santos Cordone3d76ab2014-01-28 17:25:20 -0800248 }
Santos Cordon681663d2014-01-30 04:32:15 -0800249
250 void markCallAsRinging(String callId) {
251 setCallState(callId, CallState.RINGING);
252 }
253
254 void markCallAsDialing(String callId) {
255 setCallState(callId, CallState.DIALING);
256 }
257
258 void markCallAsActive(String callId) {
259 setCallState(callId, CallState.ACTIVE);
Santos Cordon4e9fffe2014-03-04 18:13:41 -0800260 removeFromUnansweredCalls(callId);
Sailesh Nepalfc511ca2014-02-20 18:48:53 -0800261 mInCallController.markCallAsActive(callId);
Sailesh Nepal1cecc7c2014-03-10 17:03:08 -0700262
263 // TODO(sail): Replace with CallAudioManager.
264 Log.v(this, "markCallAsActive, requesting audio focus");
265 Context context = TelecommApp.getInstance().getApplicationContext();
266 AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
267 audioManager.requestAudioFocusForCall(AudioManager.STREAM_VOICE_CALL,
268 AudioManager.AUDIOFOCUS_GAIN_TRANSIENT);
269 audioManager.setMode(AudioManager.MODE_IN_CALL);
270 audioManager.setMicrophoneMute(false);
271 audioManager.setSpeakerphoneOn(false);
Santos Cordon681663d2014-01-30 04:32:15 -0800272 }
273
Santos Cordon049b7b62014-01-30 05:34:26 -0800274 /**
275 * Marks the specified call as DISCONNECTED and notifies the in-call app. If this was the last
276 * live call, then also disconnect from the in-call controller.
277 *
278 * @param callId The ID of the call.
279 */
Santos Cordon681663d2014-01-30 04:32:15 -0800280 void markCallAsDisconnected(String callId) {
281 setCallState(callId, CallState.DISCONNECTED);
Santos Cordon4e9fffe2014-03-04 18:13:41 -0800282 removeFromUnansweredCalls(callId);
Santos Cordonc195e362014-02-11 17:05:31 -0800283
284 Call call = mCalls.remove(callId);
285 // At this point the call service has confirmed that the call is disconnected to it is
286 // safe to disassociate the call from its call service.
287 call.clearCallService();
Santos Cordon049b7b62014-01-30 05:34:26 -0800288
289 // Notify the in-call UI
290 mInCallController.markCallAsDisconnected(callId);
291 if (mCalls.isEmpty()) {
292 mInCallController.unbind();
293 }
Santos Cordon681663d2014-01-30 04:32:15 -0800294 }
295
296 /**
Ben Gilada0d9f752014-02-26 11:49:03 -0800297 * Sends all the live calls to the in-call app if any exist. If there are no live calls, then
298 * tells the in-call controller to unbind since it is not needed.
299 */
300 void updateInCall() {
301 if (mCalls.isEmpty()) {
302 mInCallController.unbind();
303 } else {
304 for (Call call : mCalls.values()) {
305 addInCallEntry(call);
306 }
307 }
308 }
309
310 /**
311 * Adds the specified call to the main list of live calls.
312 *
313 * @param call The call to add.
314 */
315 private void addCall(Call call) {
316 mCalls.put(call.getId(), call);
317 addInCallEntry(call);
318 }
319
320 /**
321 * Notifies the in-call app of the specified (new) call.
322 */
323 private void addInCallEntry(Call call) {
324 mInCallController.addCall(call.toCallInfo());
325 }
326
327 /**
Santos Cordon4e9fffe2014-03-04 18:13:41 -0800328 * Sets the specified state on the specified call. Updates the ringer if the call is exiting
329 * the RINGING state.
Santos Cordon681663d2014-01-30 04:32:15 -0800330 *
331 * @param callId The ID of the call to update.
Santos Cordon4e9fffe2014-03-04 18:13:41 -0800332 * @param newState The new state of the call.
Santos Cordon681663d2014-01-30 04:32:15 -0800333 */
Santos Cordon4e9fffe2014-03-04 18:13:41 -0800334 private void setCallState(String callId, CallState newState) {
Santos Cordon681663d2014-01-30 04:32:15 -0800335 Preconditions.checkState(!Strings.isNullOrEmpty(callId));
Santos Cordon4e9fffe2014-03-04 18:13:41 -0800336 Preconditions.checkNotNull(newState);
Santos Cordon681663d2014-01-30 04:32:15 -0800337
338 Call call = mCalls.get(callId);
339 if (call == null) {
Sailesh Nepalf1c191d2014-03-07 18:17:39 -0800340 Log.w(this, "Call %s was not found while attempting to update the state to %s.",
341 callId, newState );
Santos Cordon681663d2014-01-30 04:32:15 -0800342 } else {
Santos Cordon4e9fffe2014-03-04 18:13:41 -0800343 if (newState != call.getState()) {
344 // Unfortunately, in the telephony world the radio is king. So if the call notifies
345 // us that the call is in a particular state, we allow it even if it doesn't make
346 // sense (e.g., ACTIVE -> RINGING).
347 // TODO(santoscordon): Consider putting a stop to the above and turning CallState
348 // into a well-defined state machine.
349 // TODO(santoscordon): Define expected state transitions here, and log when an
350 // unexpected transition occurs.
351 call.setState(newState);
352 // TODO(santoscordon): Notify the in-call app whenever a call changes state.
Evan Charlton5c670a92014-03-06 14:58:20 -0800353
354 broadcastState(call);
Santos Cordon4e9fffe2014-03-04 18:13:41 -0800355 }
356 }
357 }
358
359 /**
Evan Charlton5c670a92014-03-06 14:58:20 -0800360 * Send a {@link TelephonyManager#ACTION_PHONE_STATE_CHANGED} broadcast when the call state
361 * changes. TODO: Split this out into a separate class and do it properly; this is just a first
362 * pass over the functionality.
363 *
364 * @param call The {@link Call} being updated.
365 */
366 private void broadcastState(Call call) {
367 final String callState;
368 switch (call.getState()) {
369 case DIALING:
370 case ACTIVE:
371 callState = TelephonyManager.EXTRA_STATE_OFFHOOK;
372 break;
373
374 case RINGING:
375 callState = TelephonyManager.EXTRA_STATE_RINGING;
376 break;
377
378 case DISCONNECTED:
379 case ABORTED:
380 callState = TelephonyManager.EXTRA_STATE_IDLE;
381 break;
382
383 default:
Sailesh Nepalf1c191d2014-03-07 18:17:39 -0800384 Log.w(this, "Call is in an unknown state (%s), not broadcasting: %s", call.getState(),
385 call.getId());
Evan Charlton5c670a92014-03-06 14:58:20 -0800386 return;
387 }
388
389 Intent updateIntent = new Intent(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
390 updateIntent.putExtra(TelephonyManager.EXTRA_STATE, callState);
391
392 // Populate both, since the original API was needlessly complicated.
393 updateIntent.putExtra(TelephonyManager.EXTRA_INCOMING_NUMBER, call.getHandle());
394 // TODO: See if we can add this (the current API only sets this on NEW_OUTGOING_CALL).
395 updateIntent.putExtra(Intent.EXTRA_PHONE_NUMBER, call.getHandle());
396
397 // TODO: Replace these with real constants once this API has been vetted.
398 CallServiceWrapper callService = call.getCallService();
399 if (callService != null) {
400 updateIntent.putExtra(CallService.class.getName(), callService.getComponentName());
401 }
402 TelecommApp.getInstance().sendBroadcast(updateIntent, Manifest.permission.READ_PHONE_STATE);
Sailesh Nepalf1c191d2014-03-07 18:17:39 -0800403 Log.i(this, "Broadcasted state change: %s", callState);
Evan Charlton5c670a92014-03-06 14:58:20 -0800404 }
405
406 /**
Santos Cordon4e9fffe2014-03-04 18:13:41 -0800407 * Removes the specified call from the list of unanswered incoming calls and updates the ringer
408 * based on the new state of {@link #mUnansweredIncomingCalls}. Safe to call with a call ID that
409 * is not present in the list of incoming calls.
410 *
411 * @param callId The ID of the call.
412 */
413 private void removeFromUnansweredCalls(String callId) {
414 Call call = mCalls.get(callId);
415 if (call != null && mUnansweredIncomingCalls.remove(call)) {
416 if (mUnansweredIncomingCalls.isEmpty()) {
417 mRinger.stopRinging();
418 } else {
419 mRinger.startRinging();
420 }
421 }
422 }
423
424 /**
425 * Stops playing the ringer if the specified call is the top-most incoming call. This exists
426 * separately from {@link #removeIncomingCall} for cases where we would like to stop playing the
427 * ringer for a call, but that call may still exist in {@link #mUnansweredIncomingCalls} - See
428 * {@link #rejectCall}, {@link #answerCall}.
429 *
430 * @param call The call for which we should stop ringing.
431 */
432 private void stopRinging(Call call) {
433 // Only stop the ringer if this call is the top-most incoming call.
434 if (!mUnansweredIncomingCalls.isEmpty() && mUnansweredIncomingCalls.get(0) == call) {
435 mRinger.stopRinging();
Santos Cordon681663d2014-01-30 04:32:15 -0800436 }
437 }
Ben Gilad9f2bed32013-12-12 17:43:26 -0800438}