Ben Gilad | 0407fb2 | 2014-01-09 16:18:41 -0800 | [diff] [blame] | 1 | /* |
| 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 Gilad | 9f2bed3 | 2013-12-12 17:43:26 -0800 | [diff] [blame] | 17 | package com.android.telecomm; |
| 18 | |
Sailesh Nepal | ce704b9 | 2014-03-17 18:31:43 -0700 | [diff] [blame] | 19 | import android.net.Uri; |
Santos Cordon | 0b03b4b | 2014-01-29 18:01:59 -0800 | [diff] [blame] | 20 | import android.telecomm.CallInfo; |
| 21 | import android.telecomm.CallState; |
Yorke Lee | 3350163 | 2014-03-17 19:24:12 -0700 | [diff] [blame^] | 22 | import android.telecomm.GatewayInfo; |
Santos Cordon | 0b03b4b | 2014-01-29 18:01:59 -0800 | [diff] [blame] | 23 | |
Ben Gilad | 6192561 | 2014-03-11 19:06:36 -0700 | [diff] [blame] | 24 | import com.google.android.collect.Sets; |
Santos Cordon | 61d0f70 | 2014-02-19 02:52:23 -0800 | [diff] [blame] | 25 | import com.google.common.base.Preconditions; |
| 26 | |
Ben Gilad | 0407fb2 | 2014-01-09 16:18:41 -0800 | [diff] [blame] | 27 | import java.util.Date; |
Sailesh Nepal | 9199078 | 2014-03-08 17:45:52 -0800 | [diff] [blame] | 28 | import java.util.Locale; |
Ben Gilad | 6192561 | 2014-03-11 19:06:36 -0700 | [diff] [blame] | 29 | import java.util.Set; |
Santos Cordon | 61d0f70 | 2014-02-19 02:52:23 -0800 | [diff] [blame] | 30 | import java.util.UUID; |
Ben Gilad | 0407fb2 | 2014-01-09 16:18:41 -0800 | [diff] [blame] | 31 | |
Ben Gilad | 2495d57 | 2014-01-09 17:26:19 -0800 | [diff] [blame] | 32 | /** |
| 33 | * Encapsulates all aspects of a given phone call throughout its lifecycle, starting |
| 34 | * from the time the call intent was received by Telecomm (vs. the time the call was |
| 35 | * connected etc). |
| 36 | */ |
Ben Gilad | 0407fb2 | 2014-01-09 16:18:41 -0800 | [diff] [blame] | 37 | final class Call { |
Santos Cordon | 61d0f70 | 2014-02-19 02:52:23 -0800 | [diff] [blame] | 38 | /** Unique identifier for the call as a UUID string. */ |
Ben Gilad | 0bf5b91 | 2014-01-28 17:55:57 -0800 | [diff] [blame] | 39 | private final String mId; |
| 40 | |
Ben Gilad | 0407fb2 | 2014-01-09 16:18:41 -0800 | [diff] [blame] | 41 | /** Additional contact information beyond handle above, optional. */ |
Ben Gilad | 0bf5b91 | 2014-01-28 17:55:57 -0800 | [diff] [blame] | 42 | private final ContactInfo mContactInfo; |
Ben Gilad | 0407fb2 | 2014-01-09 16:18:41 -0800 | [diff] [blame] | 43 | |
Sailesh Nepal | 810735e | 2014-03-18 18:15:46 -0700 | [diff] [blame] | 44 | /** True if this is an incoming call. */ |
| 45 | private final boolean mIsIncoming; |
| 46 | |
Ben Gilad | 0407fb2 | 2014-01-09 16:18:41 -0800 | [diff] [blame] | 47 | /** |
| 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 Cordon | 61d0f70 | 2014-02-19 02:52:23 -0800 | [diff] [blame] | 55 | /** The state of the call. */ |
| 56 | private CallState mState; |
| 57 | |
| 58 | /** The handle with which to establish this call. */ |
Sailesh Nepal | ce704b9 | 2014-03-17 18:31:43 -0700 | [diff] [blame] | 59 | private Uri mHandle; |
Santos Cordon | 61d0f70 | 2014-02-19 02:52:23 -0800 | [diff] [blame] | 60 | |
Yorke Lee | 3350163 | 2014-03-17 19:24:12 -0700 | [diff] [blame^] | 61 | /** 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 Gilad | 0407fb2 | 2014-01-09 16:18:41 -0800 | [diff] [blame] | 67 | /** |
Ben Gilad | 8e55d1d | 2014-02-26 16:25:56 -0800 | [diff] [blame] | 68 | * The call service which is attempted or already connecting this call. |
Santos Cordon | 681663d | 2014-01-30 04:32:15 -0800 | [diff] [blame] | 69 | */ |
Santos Cordon | c195e36 | 2014-02-11 17:05:31 -0800 | [diff] [blame] | 70 | private CallServiceWrapper mCallService; |
Santos Cordon | 681663d | 2014-01-30 04:32:15 -0800 | [diff] [blame] | 71 | |
Ben Gilad | 8e55d1d | 2014-02-26 16:25:56 -0800 | [diff] [blame] | 72 | /** |
| 73 | * The call-service selector for this call. |
Ben Gilad | 8e55d1d | 2014-02-26 16:25:56 -0800 | [diff] [blame] | 74 | */ |
Sailesh Nepal | 18386a8 | 2014-03-19 10:22:40 -0700 | [diff] [blame] | 75 | private CallServiceSelectorWrapper mCallServiceSelector; |
Ben Gilad | 8e55d1d | 2014-02-26 16:25:56 -0800 | [diff] [blame] | 76 | |
Santos Cordon | 0b03b4b | 2014-01-29 18:01:59 -0800 | [diff] [blame] | 77 | /** |
Ben Gilad | 6192561 | 2014-03-11 19:06:36 -0700 | [diff] [blame] | 78 | * 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 | |
| 83 | /** |
Santos Cordon | 493e8f2 | 2014-02-19 03:15:12 -0800 | [diff] [blame] | 84 | * Creates an empty call object with a unique call ID. |
Sailesh Nepal | 810735e | 2014-03-18 18:15:46 -0700 | [diff] [blame] | 85 | * |
| 86 | * @param isIncoming True if this is an incoming call. |
Santos Cordon | 493e8f2 | 2014-02-19 03:15:12 -0800 | [diff] [blame] | 87 | */ |
Sailesh Nepal | 810735e | 2014-03-18 18:15:46 -0700 | [diff] [blame] | 88 | Call(boolean isIncoming) { |
Yorke Lee | 3350163 | 2014-03-17 19:24:12 -0700 | [diff] [blame^] | 89 | this(null, null, null, isIncoming); |
Santos Cordon | 493e8f2 | 2014-02-19 03:15:12 -0800 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | /** |
Ben Gilad | 0407fb2 | 2014-01-09 16:18:41 -0800 | [diff] [blame] | 93 | * Persists the specified parameters and initializes the new instance. |
| 94 | * |
| 95 | * @param handle The handle to dial. |
| 96 | * @param contactInfo Information about the entity being called. |
Yorke Lee | 3350163 | 2014-03-17 19:24:12 -0700 | [diff] [blame^] | 97 | * @param gatewayInfo Gateway information to use for the call. |
Sailesh Nepal | 810735e | 2014-03-18 18:15:46 -0700 | [diff] [blame] | 98 | * @param isIncoming True if this is an incoming call. |
Ben Gilad | 0407fb2 | 2014-01-09 16:18:41 -0800 | [diff] [blame] | 99 | */ |
Yorke Lee | 3350163 | 2014-03-17 19:24:12 -0700 | [diff] [blame^] | 100 | Call(Uri handle, ContactInfo contactInfo, GatewayInfo gatewayInfo, boolean isIncoming) { |
Santos Cordon | 61d0f70 | 2014-02-19 02:52:23 -0800 | [diff] [blame] | 101 | mId = UUID.randomUUID().toString(); // UUIDs should provide sufficient uniqueness. |
Santos Cordon | 0b03b4b | 2014-01-29 18:01:59 -0800 | [diff] [blame] | 102 | mState = CallState.NEW; |
Ben Gilad | 0407fb2 | 2014-01-09 16:18:41 -0800 | [diff] [blame] | 103 | mHandle = handle; |
| 104 | mContactInfo = contactInfo; |
Yorke Lee | 3350163 | 2014-03-17 19:24:12 -0700 | [diff] [blame^] | 105 | mGatewayInfo = gatewayInfo; |
Sailesh Nepal | 810735e | 2014-03-18 18:15:46 -0700 | [diff] [blame] | 106 | mIsIncoming = isIncoming; |
Ben Gilad | 0407fb2 | 2014-01-09 16:18:41 -0800 | [diff] [blame] | 107 | mCreationTime = new Date(); |
| 108 | } |
| 109 | |
Santos Cordon | 61d0f70 | 2014-02-19 02:52:23 -0800 | [diff] [blame] | 110 | /** {@inheritDoc} */ |
| 111 | @Override public String toString() { |
Sailesh Nepal | 9199078 | 2014-03-08 17:45:52 -0800 | [diff] [blame] | 112 | return String.format(Locale.US, "[%s, %s, %s, %s]", mId, mState, |
Sailesh Nepal | 810735e | 2014-03-18 18:15:46 -0700 | [diff] [blame] | 113 | mCallService == null ? "<null>" : mCallService.getComponentName(), |
| 114 | Log.pii(mHandle)); |
Santos Cordon | 61d0f70 | 2014-02-19 02:52:23 -0800 | [diff] [blame] | 115 | } |
| 116 | |
Ben Gilad | 0bf5b91 | 2014-01-28 17:55:57 -0800 | [diff] [blame] | 117 | String getId() { |
| 118 | return mId; |
| 119 | } |
| 120 | |
Santos Cordon | 0b03b4b | 2014-01-29 18:01:59 -0800 | [diff] [blame] | 121 | CallState getState() { |
| 122 | return mState; |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Sets the call state. Although there exists the notion of appropriate state transitions |
| 127 | * (see {@link CallState}), in practice those expectations break down when cellular systems |
| 128 | * misbehave and they do this very often. The result is that we do not enforce state transitions |
| 129 | * and instead keep the code resilient to unexpected state changes. |
| 130 | */ |
Sailesh Nepal | 810735e | 2014-03-18 18:15:46 -0700 | [diff] [blame] | 131 | void setState(CallState newState) { |
| 132 | if (mState != newState) { |
| 133 | Log.v(this, "setState %s -> %s", mState, newState); |
| 134 | mState = newState; |
Sailesh Nepal | 810735e | 2014-03-18 18:15:46 -0700 | [diff] [blame] | 135 | } |
Santos Cordon | 0b03b4b | 2014-01-29 18:01:59 -0800 | [diff] [blame] | 136 | } |
| 137 | |
Sailesh Nepal | ce704b9 | 2014-03-17 18:31:43 -0700 | [diff] [blame] | 138 | Uri getHandle() { |
Ben Gilad | 0bf5b91 | 2014-01-28 17:55:57 -0800 | [diff] [blame] | 139 | return mHandle; |
| 140 | } |
| 141 | |
Sailesh Nepal | ce704b9 | 2014-03-17 18:31:43 -0700 | [diff] [blame] | 142 | void setHandle(Uri handle) { |
Santos Cordon | 61d0f70 | 2014-02-19 02:52:23 -0800 | [diff] [blame] | 143 | mHandle = handle; |
| 144 | } |
| 145 | |
Yorke Lee | 3350163 | 2014-03-17 19:24:12 -0700 | [diff] [blame^] | 146 | /** |
| 147 | * @return The original handle this call is associated with. In-call services should use this |
| 148 | * handle when indicating in their UI the handle that is being called. |
| 149 | */ |
| 150 | public Uri getOriginalHandle() { |
| 151 | if (mGatewayInfo != null && !mGatewayInfo.isEmpty()) { |
| 152 | return mGatewayInfo.getOriginalHandle(); |
| 153 | } |
| 154 | return getHandle(); |
| 155 | } |
| 156 | |
| 157 | GatewayInfo getGatewayInfo() { |
| 158 | return mGatewayInfo; |
| 159 | } |
| 160 | |
Ben Gilad | 0bf5b91 | 2014-01-28 17:55:57 -0800 | [diff] [blame] | 161 | ContactInfo getContactInfo() { |
| 162 | return mContactInfo; |
| 163 | } |
| 164 | |
Sailesh Nepal | 810735e | 2014-03-18 18:15:46 -0700 | [diff] [blame] | 165 | boolean isIncoming() { |
| 166 | return mIsIncoming; |
| 167 | } |
| 168 | |
Ben Gilad | 0407fb2 | 2014-01-09 16:18:41 -0800 | [diff] [blame] | 169 | /** |
| 170 | * @return The "age" of this call object in milliseconds, which typically also represents the |
| 171 | * period since this call was added to the set pending outgoing calls, see mCreationTime. |
| 172 | */ |
Ben Gilad | 0bf5b91 | 2014-01-28 17:55:57 -0800 | [diff] [blame] | 173 | long getAgeInMilliseconds() { |
Ben Gilad | 0407fb2 | 2014-01-09 16:18:41 -0800 | [diff] [blame] | 174 | return new Date().getTime() - mCreationTime.getTime(); |
| 175 | } |
Santos Cordon | 0b03b4b | 2014-01-29 18:01:59 -0800 | [diff] [blame] | 176 | |
Yorke Lee | f98fb57 | 2014-03-05 10:56:55 -0800 | [diff] [blame] | 177 | /** |
| 178 | * @return The time when this call object was created and added to the set of pending outgoing |
| 179 | * calls. |
| 180 | */ |
| 181 | long getCreationTimeInMilliseconds() { |
| 182 | return mCreationTime.getTime(); |
| 183 | } |
| 184 | |
Santos Cordon | c195e36 | 2014-02-11 17:05:31 -0800 | [diff] [blame] | 185 | CallServiceWrapper getCallService() { |
Santos Cordon | 681663d | 2014-01-30 04:32:15 -0800 | [diff] [blame] | 186 | return mCallService; |
| 187 | } |
| 188 | |
Santos Cordon | c195e36 | 2014-02-11 17:05:31 -0800 | [diff] [blame] | 189 | void setCallService(CallServiceWrapper callService) { |
Ben Gilad | 8e55d1d | 2014-02-26 16:25:56 -0800 | [diff] [blame] | 190 | Preconditions.checkNotNull(callService); |
| 191 | |
Yorke Lee | adee12d | 2014-03-13 12:08:30 -0700 | [diff] [blame] | 192 | clearCallService(); |
Ben Gilad | 8e55d1d | 2014-02-26 16:25:56 -0800 | [diff] [blame] | 193 | |
| 194 | callService.incrementAssociatedCallCount(); |
Santos Cordon | 681663d | 2014-01-30 04:32:15 -0800 | [diff] [blame] | 195 | mCallService = callService; |
| 196 | } |
| 197 | |
| 198 | /** |
| 199 | * Clears the associated call service. |
| 200 | */ |
| 201 | void clearCallService() { |
Yorke Lee | adee12d | 2014-03-13 12:08:30 -0700 | [diff] [blame] | 202 | if (mCallService != null) { |
| 203 | decrementAssociatedCallCount(mCallService); |
| 204 | mCallService.cancelOutgoingCall(getId()); |
| 205 | mCallService = null; |
| 206 | } |
Ben Gilad | 8e55d1d | 2014-02-26 16:25:56 -0800 | [diff] [blame] | 207 | } |
| 208 | |
Sailesh Nepal | 18386a8 | 2014-03-19 10:22:40 -0700 | [diff] [blame] | 209 | void setCallServiceSelector(CallServiceSelectorWrapper selector) { |
Ben Gilad | 8e55d1d | 2014-02-26 16:25:56 -0800 | [diff] [blame] | 210 | Preconditions.checkNotNull(selector); |
| 211 | mCallServiceSelector = selector; |
| 212 | } |
| 213 | |
| 214 | void clearCallServiceSelector() { |
Ben Gilad | 8e55d1d | 2014-02-26 16:25:56 -0800 | [diff] [blame] | 215 | // TODO(gilad): Un-comment once selectors are converted into wrappers. |
| 216 | // decrementAssociatedCallCount(mCallServiceSelector); |
Ben Gilad | 9c23411 | 2014-03-04 16:07:33 -0800 | [diff] [blame] | 217 | |
| 218 | mCallServiceSelector = null; |
Ben Gilad | 8e55d1d | 2014-02-26 16:25:56 -0800 | [diff] [blame] | 219 | } |
| 220 | |
| 221 | /** |
Ben Gilad | 6192561 | 2014-03-11 19:06:36 -0700 | [diff] [blame] | 222 | * Adds the specified call service to the list of incompatible services. The set is used when |
| 223 | * attempting to switch a phone call between call services such that incompatible services can |
| 224 | * be avoided. |
| 225 | * |
| 226 | * @param callService The incompatible call service. |
| 227 | */ |
| 228 | void addIncompatibleCallService(CallServiceWrapper callService) { |
| 229 | if (mIncompatibleCallServices == null) { |
| 230 | mIncompatibleCallServices = Sets.newHashSet(); |
| 231 | } |
| 232 | mIncompatibleCallServices.add(callService); |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * Checks whether or not the specified callService was identified as incompatible in the |
| 237 | * context of this call. |
| 238 | * |
| 239 | * @param callService The call service to evaluate. |
| 240 | * @return True upon incompatible call services and false otherwise. |
| 241 | */ |
| 242 | boolean isIncompatibleCallService(CallServiceWrapper callService) { |
| 243 | return mIncompatibleCallServices != null && |
| 244 | mIncompatibleCallServices.contains(callService); |
| 245 | } |
| 246 | |
| 247 | /** |
Ben Gilad | 28e8ad6 | 2014-03-06 17:01:54 -0800 | [diff] [blame] | 248 | * Aborts ongoing attempts to connect this call. Only applicable to {@link CallState#NEW} |
| 249 | * outgoing calls. See {@link #disconnect} for already-connected calls. |
Ben Gilad | 8e55d1d | 2014-02-26 16:25:56 -0800 | [diff] [blame] | 250 | */ |
| 251 | void abort() { |
Ben Gilad | 28e8ad6 | 2014-03-06 17:01:54 -0800 | [diff] [blame] | 252 | if (mState == CallState.NEW) { |
| 253 | if (mCallService != null) { |
| 254 | mCallService.abort(mId); |
| 255 | } |
Ben Gilad | 9c23411 | 2014-03-04 16:07:33 -0800 | [diff] [blame] | 256 | clearCallService(); |
| 257 | clearCallServiceSelector(); |
Ben Gilad | 8e55d1d | 2014-02-26 16:25:56 -0800 | [diff] [blame] | 258 | } |
Santos Cordon | 681663d | 2014-01-30 04:32:15 -0800 | [diff] [blame] | 259 | } |
| 260 | |
Santos Cordon | c195e36 | 2014-02-11 17:05:31 -0800 | [diff] [blame] | 261 | /** |
Santos Cordon | 049b7b6 | 2014-01-30 05:34:26 -0800 | [diff] [blame] | 262 | * Attempts to disconnect the call through the call service. |
| 263 | */ |
| 264 | void disconnect() { |
| 265 | if (mCallService == null) { |
Sailesh Nepal | f1c191d | 2014-03-07 18:17:39 -0800 | [diff] [blame] | 266 | Log.w(this, "disconnect() request on a call without a call service."); |
Santos Cordon | 049b7b6 | 2014-01-30 05:34:26 -0800 | [diff] [blame] | 267 | } else { |
Sailesh Nepal | f1c191d | 2014-03-07 18:17:39 -0800 | [diff] [blame] | 268 | Log.i(this, "Send disconnect to call service for call with id %s", mId); |
Santos Cordon | c195e36 | 2014-02-11 17:05:31 -0800 | [diff] [blame] | 269 | // The call isn't officially disconnected until the call service confirms that the call |
| 270 | // was actually disconnected. Only then is the association between call and call service |
| 271 | // severed, see {@link CallsManager#markCallAsDisconnected}. |
| 272 | mCallService.disconnect(mId); |
Santos Cordon | 049b7b6 | 2014-01-30 05:34:26 -0800 | [diff] [blame] | 273 | } |
| 274 | } |
| 275 | |
Santos Cordon | 0b03b4b | 2014-01-29 18:01:59 -0800 | [diff] [blame] | 276 | /** |
Santos Cordon | 61d0f70 | 2014-02-19 02:52:23 -0800 | [diff] [blame] | 277 | * Answers the call if it is ringing. |
| 278 | */ |
| 279 | void answer() { |
| 280 | Preconditions.checkNotNull(mCallService); |
| 281 | |
| 282 | // Check to verify that the call is still in the ringing state. A call can change states |
| 283 | // between the time the user hits 'answer' and Telecomm receives the command. |
| 284 | if (isRinging("answer")) { |
| 285 | // At this point, we are asking the call service to answer but we don't assume that |
| 286 | // it will work. Instead, we wait until confirmation from the call service that the |
| 287 | // call is in a non-RINGING state before changing the UI. See |
| 288 | // {@link CallServiceAdapter#setActive} and other set* methods. |
| 289 | mCallService.answer(mId); |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | /** |
| 294 | * Rejects the call if it is ringing. |
| 295 | */ |
| 296 | void reject() { |
| 297 | Preconditions.checkNotNull(mCallService); |
| 298 | |
| 299 | // Check to verify that the call is still in the ringing state. A call can change states |
| 300 | // between the time the user hits 'reject' and Telecomm receives the command. |
| 301 | if (isRinging("reject")) { |
| 302 | mCallService.reject(mId); |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | /** |
Yorke Lee | cdf3ebd | 2014-03-12 18:31:41 -0700 | [diff] [blame] | 307 | * Puts the call on hold if it is currently active. |
| 308 | */ |
| 309 | void hold() { |
| 310 | Preconditions.checkNotNull(mCallService); |
| 311 | |
| 312 | if (mState == CallState.ACTIVE) { |
| 313 | mCallService.hold(mId); |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | /** |
| 318 | * Releases the call from hold if it is currently active. |
| 319 | */ |
| 320 | void unhold() { |
| 321 | Preconditions.checkNotNull(mCallService); |
| 322 | |
| 323 | if (mState == CallState.ON_HOLD) { |
| 324 | mCallService.unhold(mId); |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | /** |
Santos Cordon | 0b03b4b | 2014-01-29 18:01:59 -0800 | [diff] [blame] | 329 | * @return An object containing read-only information about this call. |
| 330 | */ |
| 331 | CallInfo toCallInfo() { |
Yorke Lee | 3350163 | 2014-03-17 19:24:12 -0700 | [diff] [blame^] | 332 | return new CallInfo(mId, mState, mHandle, mGatewayInfo); |
Santos Cordon | 0b03b4b | 2014-01-29 18:01:59 -0800 | [diff] [blame] | 333 | } |
| 334 | |
| 335 | /** |
Santos Cordon | 61d0f70 | 2014-02-19 02:52:23 -0800 | [diff] [blame] | 336 | * @return True if the call is ringing, else logs the action name. |
| 337 | */ |
| 338 | private boolean isRinging(String actionName) { |
| 339 | if (mState == CallState.RINGING) { |
| 340 | return true; |
| 341 | } |
| 342 | |
Sailesh Nepal | f1c191d | 2014-03-07 18:17:39 -0800 | [diff] [blame] | 343 | Log.i(this, "Request to %s a non-ringing call %s", actionName, this); |
Santos Cordon | 61d0f70 | 2014-02-19 02:52:23 -0800 | [diff] [blame] | 344 | return false; |
| 345 | } |
| 346 | |
Ben Gilad | 8e55d1d | 2014-02-26 16:25:56 -0800 | [diff] [blame] | 347 | @SuppressWarnings("rawtypes") |
| 348 | private void decrementAssociatedCallCount(ServiceBinder binder) { |
| 349 | if (binder != null) { |
| 350 | binder.decrementAssociatedCallCount(); |
| 351 | } |
| 352 | } |
Ben Gilad | 9f2bed3 | 2013-12-12 17:43:26 -0800 | [diff] [blame] | 353 | } |