blob: 00ce14d5ba228b9c4208f66459178d17ab990185 [file] [log] [blame]
Ben Gilad0407fb22014-01-09 16:18:41 -08001/*
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
14 * limitations under the License.
15 */
16
Ben Gilad9f2bed32013-12-12 17:43:26 -080017package com.android.telecomm;
18
Sailesh Nepalce704b92014-03-17 18:31:43 -070019import android.net.Uri;
Sailesh Nepal84fa5f82014-04-02 11:01:11 -070020import android.os.Bundle;
Santos Cordon0b03b4b2014-01-29 18:01:59 -080021import android.telecomm.CallInfo;
Sailesh Nepal84fa5f82014-04-02 11:01:11 -070022import android.telecomm.CallServiceDescriptor;
Santos Cordon0b03b4b2014-01-29 18:01:59 -080023import android.telecomm.CallState;
Yorke Lee33501632014-03-17 19:24:12 -070024import android.telecomm.GatewayInfo;
Santos Cordon79ff2bc2014-03-27 15:31:27 -070025import android.telephony.DisconnectCause;
Sailesh Nepal6aca10a2014-03-24 16:11:02 -070026import android.telephony.PhoneNumberUtils;
Santos Cordon0b03b4b2014-01-29 18:01:59 -080027
Ben Gilad61925612014-03-11 19:06:36 -070028import com.google.android.collect.Sets;
Santos Cordon61d0f702014-02-19 02:52:23 -080029import com.google.common.base.Preconditions;
30
Ben Gilad0407fb22014-01-09 16:18:41 -080031import java.util.Date;
Sailesh Nepal91990782014-03-08 17:45:52 -080032import java.util.Locale;
Ben Gilad61925612014-03-11 19:06:36 -070033import java.util.Set;
Ben Gilad0407fb22014-01-09 16:18:41 -080034
Ben Gilad2495d572014-01-09 17:26:19 -080035/**
36 * Encapsulates all aspects of a given phone call throughout its lifecycle, starting
37 * from the time the call intent was received by Telecomm (vs. the time the call was
38 * connected etc).
39 */
Ben Gilad0407fb22014-01-09 16:18:41 -080040final class Call {
Ben Gilad0407fb22014-01-09 16:18:41 -080041 /** Additional contact information beyond handle above, optional. */
Ben Gilad0bf5b912014-01-28 17:55:57 -080042 private final ContactInfo mContactInfo;
Ben Gilad0407fb22014-01-09 16:18:41 -080043
Sailesh Nepal810735e2014-03-18 18:15:46 -070044 /** True if this is an incoming call. */
45 private final boolean mIsIncoming;
46
Ben Gilad0407fb22014-01-09 16:18:41 -080047 /**
48 * The time this call was created, typically also the time this call was added to the set
49 * of pending outgoing calls (mPendingOutgoingCalls) that's maintained by the switchboard.
50 * Beyond logging and such, may also be used for bookkeeping and specifically for marking
51 * certain call attempts as failed attempts.
52 */
53 private final Date mCreationTime;
54
Santos Cordon61d0f702014-02-19 02:52:23 -080055 /** The state of the call. */
56 private CallState mState;
57
58 /** The handle with which to establish this call. */
Sailesh Nepalce704b92014-03-17 18:31:43 -070059 private Uri mHandle;
Santos Cordon61d0f702014-02-19 02:52:23 -080060
Yorke Lee33501632014-03-17 19:24:12 -070061 /** The gateway information associated with this call. This stores the original call handle
62 * that the user is attempting to connect to via the gateway, the actual handle to dial in
63 * order to connect the call via the gateway, as well as the package name of the gateway
64 * service. */
65 private final GatewayInfo mGatewayInfo;
66
Ben Gilad0407fb22014-01-09 16:18:41 -080067 /**
Ben Gilad8e55d1d2014-02-26 16:25:56 -080068 * The call service which is attempted or already connecting this call.
Santos Cordon681663d2014-01-30 04:32:15 -080069 */
Santos Cordonc195e362014-02-11 17:05:31 -080070 private CallServiceWrapper mCallService;
Santos Cordon681663d2014-01-30 04:32:15 -080071
Ben Gilad8e55d1d2014-02-26 16:25:56 -080072 /**
73 * The call-service selector for this call.
Ben Gilad8e55d1d2014-02-26 16:25:56 -080074 */
Sailesh Nepal18386a82014-03-19 10:22:40 -070075 private CallServiceSelectorWrapper mCallServiceSelector;
Ben Gilad8e55d1d2014-02-26 16:25:56 -080076
Santos Cordon0b03b4b2014-01-29 18:01:59 -080077 /**
Ben Gilad61925612014-03-11 19:06:36 -070078 * The set of call services that were attempted in the process of placing/switching this call
79 * but turned out unsuitable. Only used in the context of call switching.
80 */
81 private Set<CallServiceWrapper> mIncompatibleCallServices;
82
Sailesh Nepal6aca10a2014-03-24 16:11:02 -070083 private boolean mIsEmergencyCall;
84
Ben Gilad61925612014-03-11 19:06:36 -070085 /**
Santos Cordon79ff2bc2014-03-27 15:31:27 -070086 * Disconnect cause for the call. Only valid if the state of the call is DISCONNECTED.
87 * See {@link android.telephony.DisconnectCause}.
88 */
89 private int mDisconnectCause;
90
91 /**
92 * Additional disconnect information provided by the call service.
93 */
94 private String mDisconnectMessage;
95
Sailesh Nepal84fa5f82014-04-02 11:01:11 -070096 /** Info used by the call services. */
97 private Bundle mExtras;
98
99 /** The Uri to dial to perform the handoff. If this is null then handoff is not supported. */
100 private Uri mHandoffHandle;
101
102 /**
103 * References the call that is being handed off. This value is non-null for untracked calls
104 * that are being used to perform a handoff.
105 */
106 private Call mOriginalCall;
107
Santos Cordon79ff2bc2014-03-27 15:31:27 -0700108 /**
Sailesh Nepale59bb192014-04-01 18:33:59 -0700109 * Creates an empty call object.
Sailesh Nepal810735e2014-03-18 18:15:46 -0700110 *
111 * @param isIncoming True if this is an incoming call.
Santos Cordon493e8f22014-02-19 03:15:12 -0800112 */
Sailesh Nepal810735e2014-03-18 18:15:46 -0700113 Call(boolean isIncoming) {
Yorke Lee33501632014-03-17 19:24:12 -0700114 this(null, null, null, isIncoming);
Santos Cordon493e8f22014-02-19 03:15:12 -0800115 }
116
117 /**
Ben Gilad0407fb22014-01-09 16:18:41 -0800118 * Persists the specified parameters and initializes the new instance.
119 *
120 * @param handle The handle to dial.
121 * @param contactInfo Information about the entity being called.
Yorke Lee33501632014-03-17 19:24:12 -0700122 * @param gatewayInfo Gateway information to use for the call.
Sailesh Nepal810735e2014-03-18 18:15:46 -0700123 * @param isIncoming True if this is an incoming call.
Ben Gilad0407fb22014-01-09 16:18:41 -0800124 */
Yorke Lee33501632014-03-17 19:24:12 -0700125 Call(Uri handle, ContactInfo contactInfo, GatewayInfo gatewayInfo, boolean isIncoming) {
Santos Cordon0b03b4b2014-01-29 18:01:59 -0800126 mState = CallState.NEW;
Sailesh Nepal6aca10a2014-03-24 16:11:02 -0700127 setHandle(handle);
Ben Gilad0407fb22014-01-09 16:18:41 -0800128 mContactInfo = contactInfo;
Yorke Lee33501632014-03-17 19:24:12 -0700129 mGatewayInfo = gatewayInfo;
Sailesh Nepal810735e2014-03-18 18:15:46 -0700130 mIsIncoming = isIncoming;
Ben Gilad0407fb22014-01-09 16:18:41 -0800131 mCreationTime = new Date();
Santos Cordon79ff2bc2014-03-27 15:31:27 -0700132 mDisconnectCause = DisconnectCause.NOT_VALID;
Sailesh Nepal84fa5f82014-04-02 11:01:11 -0700133 mExtras = Bundle.EMPTY;
Ben Gilad0407fb22014-01-09 16:18:41 -0800134 }
135
Santos Cordon61d0f702014-02-19 02:52:23 -0800136 /** {@inheritDoc} */
137 @Override public String toString() {
Sailesh Nepale59bb192014-04-01 18:33:59 -0700138 return String.format(Locale.US, "[%s, %s, %s]", mState,
Sailesh Nepal810735e2014-03-18 18:15:46 -0700139 mCallService == null ? "<null>" : mCallService.getComponentName(),
Santos Cordona0e5f1a2014-03-31 21:43:00 -0700140 Log.piiHandle(mHandle));
Santos Cordon61d0f702014-02-19 02:52:23 -0800141 }
142
Santos Cordon0b03b4b2014-01-29 18:01:59 -0800143 CallState getState() {
144 return mState;
145 }
146
147 /**
148 * Sets the call state. Although there exists the notion of appropriate state transitions
149 * (see {@link CallState}), in practice those expectations break down when cellular systems
150 * misbehave and they do this very often. The result is that we do not enforce state transitions
151 * and instead keep the code resilient to unexpected state changes.
152 */
Sailesh Nepal810735e2014-03-18 18:15:46 -0700153 void setState(CallState newState) {
Santos Cordon79ff2bc2014-03-27 15:31:27 -0700154 Preconditions.checkState(newState != CallState.DISCONNECTED ||
155 mDisconnectCause != DisconnectCause.NOT_VALID);
Sailesh Nepal810735e2014-03-18 18:15:46 -0700156 if (mState != newState) {
157 Log.v(this, "setState %s -> %s", mState, newState);
158 mState = newState;
Sailesh Nepal810735e2014-03-18 18:15:46 -0700159 }
Santos Cordon0b03b4b2014-01-29 18:01:59 -0800160 }
161
Sailesh Nepalce704b92014-03-17 18:31:43 -0700162 Uri getHandle() {
Ben Gilad0bf5b912014-01-28 17:55:57 -0800163 return mHandle;
164 }
165
Sailesh Nepalce704b92014-03-17 18:31:43 -0700166 void setHandle(Uri handle) {
Santos Cordon61d0f702014-02-19 02:52:23 -0800167 mHandle = handle;
Sailesh Nepal6aca10a2014-03-24 16:11:02 -0700168 mIsEmergencyCall = mHandle != null && PhoneNumberUtils.isLocalEmergencyNumber(
169 mHandle.getSchemeSpecificPart(), TelecommApp.getInstance());
170 }
171
Santos Cordon79ff2bc2014-03-27 15:31:27 -0700172 /**
173 * @param disconnectCause The reason for the disconnection, any of
174 * {@link android.telephony.DisconnectCause}.
175 * @param disconnectMessage Optional call-service-provided message about the disconnect.
176 */
177 void setDisconnectCause(int disconnectCause, String disconnectMessage) {
178 // TODO: Consider combining this method with a setDisconnected() method that is totally
179 // separate from setState.
180 mDisconnectCause = disconnectCause;
181 mDisconnectMessage = disconnectMessage;
182 }
183
184 int getDisconnectCause() {
185 return mDisconnectCause;
186 }
187
188 String getDisconnectMessage() {
189 return mDisconnectMessage;
190 }
191
Sailesh Nepal6aca10a2014-03-24 16:11:02 -0700192 boolean isEmergencyCall() {
193 return mIsEmergencyCall;
Santos Cordon61d0f702014-02-19 02:52:23 -0800194 }
195
Yorke Lee33501632014-03-17 19:24:12 -0700196 /**
197 * @return The original handle this call is associated with. In-call services should use this
198 * handle when indicating in their UI the handle that is being called.
199 */
200 public Uri getOriginalHandle() {
201 if (mGatewayInfo != null && !mGatewayInfo.isEmpty()) {
202 return mGatewayInfo.getOriginalHandle();
203 }
204 return getHandle();
205 }
206
207 GatewayInfo getGatewayInfo() {
208 return mGatewayInfo;
209 }
210
Ben Gilad0bf5b912014-01-28 17:55:57 -0800211 ContactInfo getContactInfo() {
212 return mContactInfo;
213 }
214
Sailesh Nepal810735e2014-03-18 18:15:46 -0700215 boolean isIncoming() {
216 return mIsIncoming;
217 }
218
Ben Gilad0407fb22014-01-09 16:18:41 -0800219 /**
220 * @return The "age" of this call object in milliseconds, which typically also represents the
221 * period since this call was added to the set pending outgoing calls, see mCreationTime.
222 */
Santos Cordona0e5f1a2014-03-31 21:43:00 -0700223 long getAgeMs() {
Ben Gilad0407fb22014-01-09 16:18:41 -0800224 return new Date().getTime() - mCreationTime.getTime();
225 }
Santos Cordon0b03b4b2014-01-29 18:01:59 -0800226
Yorke Leef98fb572014-03-05 10:56:55 -0800227 /**
228 * @return The time when this call object was created and added to the set of pending outgoing
229 * calls.
230 */
Santos Cordona0e5f1a2014-03-31 21:43:00 -0700231 long getCreationTimeMs() {
Yorke Leef98fb572014-03-05 10:56:55 -0800232 return mCreationTime.getTime();
233 }
234
Santos Cordonc195e362014-02-11 17:05:31 -0800235 CallServiceWrapper getCallService() {
Santos Cordon681663d2014-01-30 04:32:15 -0800236 return mCallService;
237 }
238
Santos Cordonc195e362014-02-11 17:05:31 -0800239 void setCallService(CallServiceWrapper callService) {
Sailesh Nepal0e5410a2014-04-04 01:20:58 -0700240 setCallService(callService, null);
241 }
242
243 /**
244 * Changes the call service this call is associated with. If callToReplace is non-null then this
245 * call takes its place within the call service.
246 */
247 void setCallService(CallServiceWrapper callService, Call callToReplace) {
Ben Gilad8e55d1d2014-02-26 16:25:56 -0800248 Preconditions.checkNotNull(callService);
249
Yorke Leeadee12d2014-03-13 12:08:30 -0700250 clearCallService();
Ben Gilad8e55d1d2014-02-26 16:25:56 -0800251
252 callService.incrementAssociatedCallCount();
Santos Cordon681663d2014-01-30 04:32:15 -0800253 mCallService = callService;
Sailesh Nepal0e5410a2014-04-04 01:20:58 -0700254 if (callToReplace == null) {
255 mCallService.addCall(this);
256 } else {
257 mCallService.replaceCall(this, callToReplace);
258 }
Santos Cordon681663d2014-01-30 04:32:15 -0800259 }
260
261 /**
262 * Clears the associated call service.
263 */
264 void clearCallService() {
Yorke Leeadee12d2014-03-13 12:08:30 -0700265 if (mCallService != null) {
266 decrementAssociatedCallCount(mCallService);
Sailesh Nepale59bb192014-04-01 18:33:59 -0700267 mCallService.removeCall(this);
Yorke Leeadee12d2014-03-13 12:08:30 -0700268 mCallService = null;
269 }
Ben Gilad8e55d1d2014-02-26 16:25:56 -0800270 }
271
Sailesh Nepal84fa5f82014-04-02 11:01:11 -0700272 CallServiceSelectorWrapper getCallServiceSelector() {
273 return mCallServiceSelector;
274 }
275
Sailesh Nepal18386a82014-03-19 10:22:40 -0700276 void setCallServiceSelector(CallServiceSelectorWrapper selector) {
Ben Gilad8e55d1d2014-02-26 16:25:56 -0800277 Preconditions.checkNotNull(selector);
Sailesh Nepale59bb192014-04-01 18:33:59 -0700278
279 clearCallServiceSelector();
280
Ben Gilad8e55d1d2014-02-26 16:25:56 -0800281 mCallServiceSelector = selector;
Sailesh Nepale59bb192014-04-01 18:33:59 -0700282 mCallServiceSelector.addCall(this);
Ben Gilad8e55d1d2014-02-26 16:25:56 -0800283 }
284
285 void clearCallServiceSelector() {
Sailesh Nepale59bb192014-04-01 18:33:59 -0700286 if (mCallServiceSelector != null) {
287 // TODO(sail): Stop leaking selectors.
288 // decrementAssociatedCallCount(mCallServiceSelector);
289 mCallServiceSelector.removeCall(this);
290 mCallServiceSelector = null;
291 }
Ben Gilad8e55d1d2014-02-26 16:25:56 -0800292 }
293
294 /**
Ben Gilad61925612014-03-11 19:06:36 -0700295 * Adds the specified call service to the list of incompatible services. The set is used when
296 * attempting to switch a phone call between call services such that incompatible services can
297 * be avoided.
298 *
299 * @param callService The incompatible call service.
300 */
301 void addIncompatibleCallService(CallServiceWrapper callService) {
302 if (mIncompatibleCallServices == null) {
303 mIncompatibleCallServices = Sets.newHashSet();
304 }
305 mIncompatibleCallServices.add(callService);
306 }
307
308 /**
309 * Checks whether or not the specified callService was identified as incompatible in the
310 * context of this call.
311 *
312 * @param callService The call service to evaluate.
313 * @return True upon incompatible call services and false otherwise.
314 */
315 boolean isIncompatibleCallService(CallServiceWrapper callService) {
316 return mIncompatibleCallServices != null &&
317 mIncompatibleCallServices.contains(callService);
318 }
319
320 /**
Ben Gilad28e8ad62014-03-06 17:01:54 -0800321 * Aborts ongoing attempts to connect this call. Only applicable to {@link CallState#NEW}
322 * outgoing calls. See {@link #disconnect} for already-connected calls.
Ben Gilad8e55d1d2014-02-26 16:25:56 -0800323 */
324 void abort() {
Ben Gilad28e8ad62014-03-06 17:01:54 -0800325 if (mState == CallState.NEW) {
326 if (mCallService != null) {
Sailesh Nepale59bb192014-04-01 18:33:59 -0700327 mCallService.abort(this);
Ben Gilad28e8ad62014-03-06 17:01:54 -0800328 }
Ben Gilad9c234112014-03-04 16:07:33 -0800329 clearCallService();
330 clearCallServiceSelector();
Ben Gilad8e55d1d2014-02-26 16:25:56 -0800331 }
Santos Cordon681663d2014-01-30 04:32:15 -0800332 }
333
Santos Cordonc195e362014-02-11 17:05:31 -0800334 /**
Ihab Awad74549ec2014-03-10 15:33:25 -0700335 * Plays the specified DTMF tone.
336 */
337 void playDtmfTone(char digit) {
338 if (mCallService == null) {
339 Log.w(this, "playDtmfTone() request on a call without a call service.");
340 } else {
Sailesh Nepale59bb192014-04-01 18:33:59 -0700341 Log.i(this, "Send playDtmfTone to call service for call %s", this);
342 mCallService.playDtmfTone(this, digit);
Ihab Awad74549ec2014-03-10 15:33:25 -0700343 }
344 }
345
346 /**
347 * Stops playing any currently playing DTMF tone.
348 */
349 void stopDtmfTone() {
350 if (mCallService == null) {
351 Log.w(this, "stopDtmfTone() request on a call without a call service.");
352 } else {
Sailesh Nepale59bb192014-04-01 18:33:59 -0700353 Log.i(this, "Send stopDtmfTone to call service for call %s", this);
354 mCallService.stopDtmfTone(this);
Ihab Awad74549ec2014-03-10 15:33:25 -0700355 }
356 }
357
358 /**
Santos Cordon049b7b62014-01-30 05:34:26 -0800359 * Attempts to disconnect the call through the call service.
360 */
361 void disconnect() {
362 if (mCallService == null) {
Sailesh Nepalf1c191d2014-03-07 18:17:39 -0800363 Log.w(this, "disconnect() request on a call without a call service.");
Santos Cordon049b7b62014-01-30 05:34:26 -0800364 } else {
Sailesh Nepale59bb192014-04-01 18:33:59 -0700365 Log.i(this, "Send disconnect to call service for call: %s", this);
Santos Cordonc195e362014-02-11 17:05:31 -0800366 // The call isn't officially disconnected until the call service confirms that the call
367 // was actually disconnected. Only then is the association between call and call service
368 // severed, see {@link CallsManager#markCallAsDisconnected}.
Sailesh Nepale59bb192014-04-01 18:33:59 -0700369 mCallService.disconnect(this);
Santos Cordon049b7b62014-01-30 05:34:26 -0800370 }
371 }
372
Santos Cordon0b03b4b2014-01-29 18:01:59 -0800373 /**
Santos Cordon61d0f702014-02-19 02:52:23 -0800374 * Answers the call if it is ringing.
375 */
376 void answer() {
377 Preconditions.checkNotNull(mCallService);
378
379 // Check to verify that the call is still in the ringing state. A call can change states
380 // between the time the user hits 'answer' and Telecomm receives the command.
381 if (isRinging("answer")) {
382 // At this point, we are asking the call service to answer but we don't assume that
383 // it will work. Instead, we wait until confirmation from the call service that the
384 // call is in a non-RINGING state before changing the UI. See
385 // {@link CallServiceAdapter#setActive} and other set* methods.
Sailesh Nepale59bb192014-04-01 18:33:59 -0700386 mCallService.answer(this);
Santos Cordon61d0f702014-02-19 02:52:23 -0800387 }
388 }
389
390 /**
391 * Rejects the call if it is ringing.
392 */
393 void reject() {
394 Preconditions.checkNotNull(mCallService);
395
396 // Check to verify that the call is still in the ringing state. A call can change states
397 // between the time the user hits 'reject' and Telecomm receives the command.
398 if (isRinging("reject")) {
Sailesh Nepale59bb192014-04-01 18:33:59 -0700399 mCallService.reject(this);
Santos Cordon61d0f702014-02-19 02:52:23 -0800400 }
401 }
402
403 /**
Yorke Leecdf3ebd2014-03-12 18:31:41 -0700404 * Puts the call on hold if it is currently active.
405 */
406 void hold() {
407 Preconditions.checkNotNull(mCallService);
408
409 if (mState == CallState.ACTIVE) {
Sailesh Nepale59bb192014-04-01 18:33:59 -0700410 mCallService.hold(this);
Yorke Leecdf3ebd2014-03-12 18:31:41 -0700411 }
412 }
413
414 /**
415 * Releases the call from hold if it is currently active.
416 */
417 void unhold() {
418 Preconditions.checkNotNull(mCallService);
419
420 if (mState == CallState.ON_HOLD) {
Sailesh Nepale59bb192014-04-01 18:33:59 -0700421 mCallService.unhold(this);
Yorke Leecdf3ebd2014-03-12 18:31:41 -0700422 }
423 }
424
425 /**
Santos Cordon0b03b4b2014-01-29 18:01:59 -0800426 * @return An object containing read-only information about this call.
427 */
Sailesh Nepale59bb192014-04-01 18:33:59 -0700428 CallInfo toCallInfo(String callId) {
Sailesh Nepal84fa5f82014-04-02 11:01:11 -0700429 CallServiceDescriptor descriptor = null;
430 if (mCallService != null) {
431 descriptor = mCallService.getDescriptor();
432 } else if (mOriginalCall != null && mOriginalCall.mCallService != null) {
433 descriptor = mOriginalCall.mCallService.getDescriptor();
434 }
435 return new CallInfo(callId, mState, mHandle, mGatewayInfo, mExtras, descriptor);
Santos Cordon0b03b4b2014-01-29 18:01:59 -0800436 }
437
Sailesh Nepal6aca10a2014-03-24 16:11:02 -0700438 /** Checks if this is a live call or not. */
439 boolean isAlive() {
440 switch (mState) {
441 case NEW:
442 case RINGING:
443 case DISCONNECTED:
444 case ABORTED:
445 return false;
446 default:
447 return true;
448 }
449 }
450
Sailesh Nepal84fa5f82014-04-02 11:01:11 -0700451 Bundle getExtras() {
452 return mExtras;
453 }
454
455 void setExtras(Bundle extras) {
456 mExtras = extras;
457 }
458
459 Uri getHandoffHandle() {
460 return mHandoffHandle;
461 }
462
463 void setHandoffHandle(Uri handoffHandle) {
464 mHandoffHandle = handoffHandle;
465 }
466
467 Call getOriginalCall() {
468 return mOriginalCall;
469 }
470
471 void setOriginalCall(Call originalCall) {
472 mOriginalCall = originalCall;
473 }
474
Santos Cordon0b03b4b2014-01-29 18:01:59 -0800475 /**
Santos Cordon61d0f702014-02-19 02:52:23 -0800476 * @return True if the call is ringing, else logs the action name.
477 */
478 private boolean isRinging(String actionName) {
479 if (mState == CallState.RINGING) {
480 return true;
481 }
482
Sailesh Nepalf1c191d2014-03-07 18:17:39 -0800483 Log.i(this, "Request to %s a non-ringing call %s", actionName, this);
Santos Cordon61d0f702014-02-19 02:52:23 -0800484 return false;
485 }
486
Ben Gilad8e55d1d2014-02-26 16:25:56 -0800487 @SuppressWarnings("rawtypes")
488 private void decrementAssociatedCallCount(ServiceBinder binder) {
489 if (binder != null) {
490 binder.decrementAssociatedCallCount();
491 }
492 }
Ben Gilad9f2bed32013-12-12 17:43:26 -0800493}