blob: 182dc8bb83250d01b4df68d1937eb3703ced0fe4 [file] [log] [blame]
Sailesh Nepal60437932014-04-05 16:44:55 -07001/*
2 * Copyright 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
Tyler Gunnef9f6f92014-09-12 22:16:17 -070017package android.telecom;
Sailesh Nepal60437932014-04-05 16:44:55 -070018
Hall Liuef98bf82020-01-09 15:22:44 -080019import android.annotation.Nullable;
Artur Satayev53ada2a2019-12-10 17:47:56 +000020import android.compat.annotation.UnsupportedAppUsage;
Sailesh Nepal60437932014-04-05 16:44:55 -070021import android.net.Uri;
Mathew Inwood8c854f82018-09-14 12:35:36 +010022import android.os.Build;
Nancy Chen10798dc2014-08-08 14:00:25 -070023import android.os.Bundle;
Sailesh Nepal60437932014-04-05 16:44:55 -070024import android.os.Parcel;
25import android.os.Parcelable;
Andrew Lee5dc30752014-06-27 17:02:19 -070026import android.os.RemoteException;
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -080027import android.telecom.Call.Details.CallDirection;
Sailesh Nepal60437932014-04-05 16:44:55 -070028
Artur Satayev53ada2a2019-12-10 17:47:56 +000029import com.android.internal.telecom.IVideoProvider;
30
Santos Cordon980acb92014-05-31 10:31:19 -070031import java.util.ArrayList;
Santos Cordon7c7bc7f2014-07-28 18:15:48 -070032import java.util.Collections;
Santos Cordon980acb92014-05-31 10:31:19 -070033import java.util.List;
Sailesh Nepal60437932014-04-05 16:44:55 -070034
35/**
Tyler Gunnef9f6f92014-09-12 22:16:17 -070036 * Information about a call that is used between InCallService and Telecom.
Santos Cordon88b771d2014-07-19 13:10:40 -070037 * @hide
Sailesh Nepal60437932014-04-05 16:44:55 -070038 */
Santos Cordon88b771d2014-07-19 13:10:40 -070039public final class ParcelableCall implements Parcelable {
Hall Liuef98bf82020-01-09 15:22:44 -080040
41 public static class ParcelableCallBuilder {
42 private String mId;
43 private int mState;
44 private DisconnectCause mDisconnectCause;
45 private List<String> mCannedSmsResponses;
46 private int mCapabilities;
47 private int mProperties;
48 private int mSupportedAudioRoutes;
49 private long mConnectTimeMillis;
50 private Uri mHandle;
51 private int mHandlePresentation;
52 private String mCallerDisplayName;
53 private int mCallerDisplayNamePresentation;
54 private GatewayInfo mGatewayInfo;
55 private PhoneAccountHandle mAccountHandle;
56 private boolean mIsVideoCallProviderChanged;
57 private IVideoProvider mVideoCallProvider;
58 private boolean mIsRttCallChanged;
59 private ParcelableRttCall mRttCall;
60 private String mParentCallId;
61 private List<String> mChildCallIds;
62 private StatusHints mStatusHints;
63 private int mVideoState;
64 private List<String> mConferenceableCallIds;
65 private Bundle mIntentExtras;
66 private Bundle mExtras;
67 private long mCreationTimeMillis;
68 private int mCallDirection;
69 private int mCallerNumberVerificationStatus;
70 private String mContactDisplayName;
71 private String mActiveChildCallId;
72
73 public ParcelableCallBuilder setId(String id) {
74 mId = id;
75 return this;
76 }
77
78 public ParcelableCallBuilder setState(int state) {
79 mState = state;
80 return this;
81 }
82
83 public ParcelableCallBuilder setDisconnectCause(DisconnectCause disconnectCause) {
84 mDisconnectCause = disconnectCause;
85 return this;
86 }
87
88 public ParcelableCallBuilder setCannedSmsResponses(List<String> cannedSmsResponses) {
89 mCannedSmsResponses = cannedSmsResponses;
90 return this;
91 }
92
93 public ParcelableCallBuilder setCapabilities(int capabilities) {
94 mCapabilities = capabilities;
95 return this;
96 }
97
98 public ParcelableCallBuilder setProperties(int properties) {
99 mProperties = properties;
100 return this;
101 }
102
103 public ParcelableCallBuilder setSupportedAudioRoutes(int supportedAudioRoutes) {
104 mSupportedAudioRoutes = supportedAudioRoutes;
105 return this;
106 }
107
108 public ParcelableCallBuilder setConnectTimeMillis(long connectTimeMillis) {
109 mConnectTimeMillis = connectTimeMillis;
110 return this;
111 }
112
113 public ParcelableCallBuilder setHandle(Uri handle) {
114 mHandle = handle;
115 return this;
116 }
117
118 public ParcelableCallBuilder setHandlePresentation(int handlePresentation) {
119 mHandlePresentation = handlePresentation;
120 return this;
121 }
122
123 public ParcelableCallBuilder setCallerDisplayName(String callerDisplayName) {
124 mCallerDisplayName = callerDisplayName;
125 return this;
126 }
127
128 public ParcelableCallBuilder setCallerDisplayNamePresentation(
129 int callerDisplayNamePresentation) {
130 mCallerDisplayNamePresentation = callerDisplayNamePresentation;
131 return this;
132 }
133
134 public ParcelableCallBuilder setGatewayInfo(GatewayInfo gatewayInfo) {
135 mGatewayInfo = gatewayInfo;
136 return this;
137 }
138
139 public ParcelableCallBuilder setAccountHandle(PhoneAccountHandle accountHandle) {
140 mAccountHandle = accountHandle;
141 return this;
142 }
143
144 public ParcelableCallBuilder setIsVideoCallProviderChanged(
145 boolean isVideoCallProviderChanged) {
146 mIsVideoCallProviderChanged = isVideoCallProviderChanged;
147 return this;
148 }
149
150 public ParcelableCallBuilder setVideoCallProvider(IVideoProvider videoCallProvider) {
151 mVideoCallProvider = videoCallProvider;
152 return this;
153 }
154
155 public ParcelableCallBuilder setIsRttCallChanged(boolean isRttCallChanged) {
156 mIsRttCallChanged = isRttCallChanged;
157 return this;
158 }
159
160 public ParcelableCallBuilder setRttCall(ParcelableRttCall rttCall) {
161 mRttCall = rttCall;
162 return this;
163 }
164
165 public ParcelableCallBuilder setParentCallId(String parentCallId) {
166 mParentCallId = parentCallId;
167 return this;
168 }
169
170 public ParcelableCallBuilder setChildCallIds(List<String> childCallIds) {
171 mChildCallIds = childCallIds;
172 return this;
173 }
174
175 public ParcelableCallBuilder setStatusHints(StatusHints statusHints) {
176 mStatusHints = statusHints;
177 return this;
178 }
179
180 public ParcelableCallBuilder setVideoState(int videoState) {
181 mVideoState = videoState;
182 return this;
183 }
184
185 public ParcelableCallBuilder setConferenceableCallIds(
186 List<String> conferenceableCallIds) {
187 mConferenceableCallIds = conferenceableCallIds;
188 return this;
189 }
190
191 public ParcelableCallBuilder setIntentExtras(Bundle intentExtras) {
192 mIntentExtras = intentExtras;
193 return this;
194 }
195
196 public ParcelableCallBuilder setExtras(Bundle extras) {
197 mExtras = extras;
198 return this;
199 }
200
201 public ParcelableCallBuilder setCreationTimeMillis(long creationTimeMillis) {
202 mCreationTimeMillis = creationTimeMillis;
203 return this;
204 }
205
206 public ParcelableCallBuilder setCallDirection(int callDirection) {
207 mCallDirection = callDirection;
208 return this;
209 }
210
211 public ParcelableCallBuilder setCallerNumberVerificationStatus(
212 int callerNumberVerificationStatus) {
213 mCallerNumberVerificationStatus = callerNumberVerificationStatus;
214 return this;
215 }
216
217 public ParcelableCallBuilder setContactDisplayName(String contactDisplayName) {
218 mContactDisplayName = contactDisplayName;
219 return this;
220 }
221
222 public ParcelableCallBuilder setActiveChildCallId(String activeChildCallId) {
223 mActiveChildCallId = activeChildCallId;
224 return this;
225 }
226
227 public ParcelableCall createParcelableCall() {
228 return new ParcelableCall(
229 mId,
230 mState,
231 mDisconnectCause,
232 mCannedSmsResponses,
233 mCapabilities,
234 mProperties,
235 mSupportedAudioRoutes,
236 mConnectTimeMillis,
237 mHandle,
238 mHandlePresentation,
239 mCallerDisplayName,
240 mCallerDisplayNamePresentation,
241 mGatewayInfo,
242 mAccountHandle,
243 mIsVideoCallProviderChanged,
244 mVideoCallProvider,
245 mIsRttCallChanged,
246 mRttCall,
247 mParentCallId,
248 mChildCallIds,
249 mStatusHints,
250 mVideoState,
251 mConferenceableCallIds,
252 mIntentExtras,
253 mExtras,
254 mCreationTimeMillis,
255 mCallDirection,
256 mCallerNumberVerificationStatus,
257 mContactDisplayName,
258 mActiveChildCallId);
259 }
260
261 public static ParcelableCallBuilder fromParcelableCall(ParcelableCall parcelableCall) {
262 ParcelableCallBuilder newBuilder = new ParcelableCallBuilder();
263 newBuilder.mId = parcelableCall.mId;
264 newBuilder.mState = parcelableCall.mState;
265 newBuilder.mDisconnectCause = parcelableCall.mDisconnectCause;
266 newBuilder.mCannedSmsResponses = parcelableCall.mCannedSmsResponses;
267 newBuilder.mCapabilities = parcelableCall.mCapabilities;
268 newBuilder.mProperties = parcelableCall.mProperties;
269 newBuilder.mSupportedAudioRoutes = parcelableCall.mSupportedAudioRoutes;
270 newBuilder.mConnectTimeMillis = parcelableCall.mConnectTimeMillis;
271 newBuilder.mHandle = parcelableCall.mHandle;
272 newBuilder.mHandlePresentation = parcelableCall.mHandlePresentation;
273 newBuilder.mCallerDisplayName = parcelableCall.mCallerDisplayName;
274 newBuilder.mCallerDisplayNamePresentation =
275 parcelableCall.mCallerDisplayNamePresentation;
276 newBuilder.mGatewayInfo = parcelableCall.mGatewayInfo;
277 newBuilder.mAccountHandle = parcelableCall.mAccountHandle;
278 newBuilder.mIsVideoCallProviderChanged = parcelableCall.mIsVideoCallProviderChanged;
279 newBuilder.mVideoCallProvider = parcelableCall.mVideoCallProvider;
280 newBuilder.mIsRttCallChanged = parcelableCall.mIsRttCallChanged;
281 newBuilder.mRttCall = parcelableCall.mRttCall;
282 newBuilder.mParentCallId = parcelableCall.mParentCallId;
283 newBuilder.mChildCallIds = parcelableCall.mChildCallIds;
284 newBuilder.mStatusHints = parcelableCall.mStatusHints;
285 newBuilder.mVideoState = parcelableCall.mVideoState;
286 newBuilder.mConferenceableCallIds = parcelableCall.mConferenceableCallIds;
287 newBuilder.mIntentExtras = parcelableCall.mIntentExtras;
288 newBuilder.mExtras = parcelableCall.mExtras;
289 newBuilder.mCreationTimeMillis = parcelableCall.mCreationTimeMillis;
290 newBuilder.mCallDirection = parcelableCall.mCallDirection;
291 newBuilder.mCallerNumberVerificationStatus =
292 parcelableCall.mCallerNumberVerificationStatus;
293 newBuilder.mContactDisplayName = parcelableCall.mContactDisplayName;
294 newBuilder.mActiveChildCallId = parcelableCall.mActiveChildCallId;
295 return newBuilder;
296 }
297 }
298
Sailesh Nepal60437932014-04-05 16:44:55 -0700299 private final String mId;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700300 private final int mState;
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700301 private final DisconnectCause mDisconnectCause;
Ihab Awadc0677542014-06-10 13:29:47 -0700302 private final List<String> mCannedSmsResponses;
Sailesh Nepal60437932014-04-05 16:44:55 -0700303 private final int mCapabilities;
Andrew Lee223ad142014-08-27 16:33:08 -0700304 private final int mProperties;
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800305 private final int mSupportedAudioRoutes;
Sailesh Nepal60437932014-04-05 16:44:55 -0700306 private final long mConnectTimeMillis;
307 private final Uri mHandle;
Sailesh Nepal61203862014-07-11 14:50:13 -0700308 private final int mHandlePresentation;
309 private final String mCallerDisplayName;
310 private final int mCallerDisplayNamePresentation;
Sailesh Nepal60437932014-04-05 16:44:55 -0700311 private final GatewayInfo mGatewayInfo;
Evan Charlton8c8a0622014-07-20 12:31:00 -0700312 private final PhoneAccountHandle mAccountHandle;
Tyler Gunn75958422015-04-15 14:23:42 -0700313 private final boolean mIsVideoCallProviderChanged;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700314 private final IVideoProvider mVideoCallProvider;
Tyler Gunn584ba6c2015-12-08 10:53:41 -0800315 private VideoCallImpl mVideoCall;
Hall Liu95d55872017-01-25 17:12:49 -0800316 private final boolean mIsRttCallChanged;
317 private final ParcelableRttCall mRttCall;
Santos Cordon980acb92014-05-31 10:31:19 -0700318 private final String mParentCallId;
319 private final List<String> mChildCallIds;
Sailesh Nepale7ef59a2014-07-08 21:48:22 -0700320 private final StatusHints mStatusHints;
Andrew Lee85f5d422014-07-11 17:22:03 -0700321 private final int mVideoState;
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700322 private final List<String> mConferenceableCallIds;
Santos Cordon6b7f9552015-05-27 17:21:45 -0700323 private final Bundle mIntentExtras;
Nancy Chen10798dc2014-08-08 14:00:25 -0700324 private final Bundle mExtras;
Tyler Gunnc0bf6de2017-03-17 11:27:09 -0700325 private final long mCreationTimeMillis;
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800326 private final int mCallDirection;
Tyler Gunnd57d76c2019-09-24 14:53:23 -0700327 private final int mCallerNumberVerificationStatus;
Hall Liuef98bf82020-01-09 15:22:44 -0800328 private final String mContactDisplayName;
329 private final String mActiveChildCallId; // Only valid for CDMA conferences
Santos Cordon980acb92014-05-31 10:31:19 -0700330
Santos Cordon88b771d2014-07-19 13:10:40 -0700331 public ParcelableCall(
Sailesh Nepal60437932014-04-05 16:44:55 -0700332 String id,
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700333 int state,
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700334 DisconnectCause disconnectCause,
Ihab Awadc0677542014-06-10 13:29:47 -0700335 List<String> cannedSmsResponses,
Sailesh Nepal60437932014-04-05 16:44:55 -0700336 int capabilities,
Andrew Lee223ad142014-08-27 16:33:08 -0700337 int properties,
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800338 int supportedAudioRoutes,
Sailesh Nepal60437932014-04-05 16:44:55 -0700339 long connectTimeMillis,
340 Uri handle,
Sailesh Nepal61203862014-07-11 14:50:13 -0700341 int handlePresentation,
342 String callerDisplayName,
343 int callerDisplayNamePresentation,
Sailesh Nepal60437932014-04-05 16:44:55 -0700344 GatewayInfo gatewayInfo,
Evan Charlton8c8a0622014-07-20 12:31:00 -0700345 PhoneAccountHandle accountHandle,
Tyler Gunn75958422015-04-15 14:23:42 -0700346 boolean isVideoCallProviderChanged,
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700347 IVideoProvider videoCallProvider,
Hall Liu95d55872017-01-25 17:12:49 -0800348 boolean isRttCallChanged,
349 ParcelableRttCall rttCall,
Santos Cordon980acb92014-05-31 10:31:19 -0700350 String parentCallId,
Tyler Gunn8d83fa92014-07-01 11:31:21 -0700351 List<String> childCallIds,
Andrew Lee85f5d422014-07-11 17:22:03 -0700352 StatusHints statusHints,
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700353 int videoState,
Nancy Chen10798dc2014-08-08 14:00:25 -0700354 List<String> conferenceableCallIds,
Santos Cordon6b7f9552015-05-27 17:21:45 -0700355 Bundle intentExtras,
Tyler Gunnc0bf6de2017-03-17 11:27:09 -0700356 Bundle extras,
Tyler Gunn7e45b722018-12-04 12:56:45 -0800357 long creationTimeMillis,
Tyler Gunnd57d76c2019-09-24 14:53:23 -0700358 int callDirection,
Hall Liuef98bf82020-01-09 15:22:44 -0800359 int callerNumberVerificationStatus,
360 String contactDisplayName,
361 String activeChildCallId
362 ) {
Sailesh Nepal60437932014-04-05 16:44:55 -0700363 mId = id;
364 mState = state;
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700365 mDisconnectCause = disconnectCause;
Ihab Awadc0677542014-06-10 13:29:47 -0700366 mCannedSmsResponses = cannedSmsResponses;
Sailesh Nepal60437932014-04-05 16:44:55 -0700367 mCapabilities = capabilities;
Andrew Lee223ad142014-08-27 16:33:08 -0700368 mProperties = properties;
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800369 mSupportedAudioRoutes = supportedAudioRoutes;
Sailesh Nepal60437932014-04-05 16:44:55 -0700370 mConnectTimeMillis = connectTimeMillis;
371 mHandle = handle;
Sailesh Nepal61203862014-07-11 14:50:13 -0700372 mHandlePresentation = handlePresentation;
373 mCallerDisplayName = callerDisplayName;
374 mCallerDisplayNamePresentation = callerDisplayNamePresentation;
Sailesh Nepal60437932014-04-05 16:44:55 -0700375 mGatewayInfo = gatewayInfo;
Evan Charlton8c8a0622014-07-20 12:31:00 -0700376 mAccountHandle = accountHandle;
Tyler Gunn75958422015-04-15 14:23:42 -0700377 mIsVideoCallProviderChanged = isVideoCallProviderChanged;
Andrew Lee50aca232014-07-22 16:41:54 -0700378 mVideoCallProvider = videoCallProvider;
Hall Liu95d55872017-01-25 17:12:49 -0800379 mIsRttCallChanged = isRttCallChanged;
380 mRttCall = rttCall;
Santos Cordon980acb92014-05-31 10:31:19 -0700381 mParentCallId = parentCallId;
382 mChildCallIds = childCallIds;
Sailesh Nepale7ef59a2014-07-08 21:48:22 -0700383 mStatusHints = statusHints;
Andrew Lee85f5d422014-07-11 17:22:03 -0700384 mVideoState = videoState;
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700385 mConferenceableCallIds = Collections.unmodifiableList(conferenceableCallIds);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700386 mIntentExtras = intentExtras;
Nancy Chen10798dc2014-08-08 14:00:25 -0700387 mExtras = extras;
Tyler Gunnc0bf6de2017-03-17 11:27:09 -0700388 mCreationTimeMillis = creationTimeMillis;
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800389 mCallDirection = callDirection;
Tyler Gunnd57d76c2019-09-24 14:53:23 -0700390 mCallerNumberVerificationStatus = callerNumberVerificationStatus;
Hall Liuef98bf82020-01-09 15:22:44 -0800391 mContactDisplayName = contactDisplayName;
392 mActiveChildCallId = activeChildCallId;
Sailesh Nepal60437932014-04-05 16:44:55 -0700393 }
394
395 /** The unique ID of the call. */
Mathew Inwood8c854f82018-09-14 12:35:36 +0100396 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Sailesh Nepal60437932014-04-05 16:44:55 -0700397 public String getId() {
398 return mId;
399 }
400
401 /** The current state of the call. */
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700402 public int getState() {
Sailesh Nepal60437932014-04-05 16:44:55 -0700403 return mState;
404 }
405
406 /**
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700407 * Reason for disconnection, as described by {@link android.telecomm.DisconnectCause}. Valid
408 * when call state is {@link CallState#DISCONNECTED}.
Sailesh Nepal60437932014-04-05 16:44:55 -0700409 */
Tyler Gunn7e45b722018-12-04 12:56:45 -0800410 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700411 public DisconnectCause getDisconnectCause() {
412 return mDisconnectCause;
Sailesh Nepal60437932014-04-05 16:44:55 -0700413 }
414
Ihab Awadc0677542014-06-10 13:29:47 -0700415 /**
416 * The set of possible text message responses when this call is incoming.
417 */
418 public List<String> getCannedSmsResponses() {
419 return mCannedSmsResponses;
420 }
421
Sailesh Nepal60437932014-04-05 16:44:55 -0700422 // Bit mask of actions a call supports, values are defined in {@link CallCapabilities}.
423 public int getCapabilities() {
424 return mCapabilities;
425 }
426
Andrew Lee223ad142014-08-27 16:33:08 -0700427 /** Bitmask of properties of the call. */
428 public int getProperties() { return mProperties; }
429
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800430 /** Bitmask of supported routes of the call */
431 public int getSupportedAudioRoutes() {
432 return mSupportedAudioRoutes;
433 }
434
Sailesh Nepal60437932014-04-05 16:44:55 -0700435 /** The time that the call switched to the active state. */
Tyler Gunn7e45b722018-12-04 12:56:45 -0800436 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Sailesh Nepal60437932014-04-05 16:44:55 -0700437 public long getConnectTimeMillis() {
438 return mConnectTimeMillis;
439 }
440
441 /** The endpoint to which the call is connected. */
Tyler Gunn7e45b722018-12-04 12:56:45 -0800442 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Sailesh Nepal60437932014-04-05 16:44:55 -0700443 public Uri getHandle() {
444 return mHandle;
445 }
446
Nancy Chen9d568c02014-09-08 14:17:59 -0700447 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700448 * The presentation requirements for the handle. See {@link TelecomManager} for valid values.
Nancy Chen9d568c02014-09-08 14:17:59 -0700449 */
Sailesh Nepal61203862014-07-11 14:50:13 -0700450 public int getHandlePresentation() {
451 return mHandlePresentation;
452 }
453
454 /** The endpoint to which the call is connected. */
455 public String getCallerDisplayName() {
456 return mCallerDisplayName;
457 }
458
Nancy Chen9d568c02014-09-08 14:17:59 -0700459 /**
460 * The presentation requirements for the caller display name.
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700461 * See {@link TelecomManager} for valid values.
Nancy Chen9d568c02014-09-08 14:17:59 -0700462 */
Sailesh Nepal61203862014-07-11 14:50:13 -0700463 public int getCallerDisplayNamePresentation() {
464 return mCallerDisplayNamePresentation;
465 }
466
Sailesh Nepal60437932014-04-05 16:44:55 -0700467 /** Gateway information for the call. */
468 public GatewayInfo getGatewayInfo() {
469 return mGatewayInfo;
470 }
471
Evan Charlton6eb262c2014-07-19 18:18:19 -0700472 /** PhoneAccountHandle information for the call. */
Evan Charlton8c8a0622014-07-20 12:31:00 -0700473 public PhoneAccountHandle getAccountHandle() {
474 return mAccountHandle;
Nancy Chen5ffbfcc2014-06-25 14:22:55 -0700475 }
476
Sailesh Nepal60437932014-04-05 16:44:55 -0700477 /**
Andrew Lee50aca232014-07-22 16:41:54 -0700478 * Returns an object for remotely communicating through the video call provider's binder.
Tyler Gunn159f35c2017-03-02 09:28:37 -0800479 *
480 * @param callingPackageName the package name of the calling InCallService.
481 * @param targetSdkVersion the target SDK version of the calling InCallService.
Andrew Lee50aca232014-07-22 16:41:54 -0700482 * @return The video call.
Andrew Lee5dc30752014-06-27 17:02:19 -0700483 */
Tyler Gunn159f35c2017-03-02 09:28:37 -0800484 public VideoCallImpl getVideoCallImpl(String callingPackageName, int targetSdkVersion) {
Andrew Lee50aca232014-07-22 16:41:54 -0700485 if (mVideoCall == null && mVideoCallProvider != null) {
Andrew Lee5dc30752014-06-27 17:02:19 -0700486 try {
Tyler Gunn159f35c2017-03-02 09:28:37 -0800487 mVideoCall = new VideoCallImpl(mVideoCallProvider, callingPackageName,
488 targetSdkVersion);
Andrew Lee5dc30752014-06-27 17:02:19 -0700489 } catch (RemoteException ignored) {
490 // Ignore RemoteException.
491 }
492 }
493
Andrew Lee50aca232014-07-22 16:41:54 -0700494 return mVideoCall;
Andrew Lee5dc30752014-06-27 17:02:19 -0700495 }
496
Tyler Gunnd1fdf3a2019-11-05 15:47:58 -0800497 public IVideoProvider getVideoProvider() {
498 return mVideoCallProvider;
499 }
500
Hall Liu95d55872017-01-25 17:12:49 -0800501 public boolean getIsRttCallChanged() {
502 return mIsRttCallChanged;
503 }
504
505 /**
506 * RTT communication channel information
507 * @return The ParcelableRttCall
508 */
509 public ParcelableRttCall getParcelableRttCall() {
510 return mRttCall;
511 }
512
Andrew Lee5dc30752014-06-27 17:02:19 -0700513 /**
Santos Cordon980acb92014-05-31 10:31:19 -0700514 * The conference call to which this call is conferenced. Null if not conferenced.
Santos Cordon980acb92014-05-31 10:31:19 -0700515 */
516 public String getParentCallId() {
517 return mParentCallId;
518 }
519
520 /**
521 * The child call-IDs if this call is a conference call. Returns an empty list if this is not
522 * a conference call or if the conference call contains no children.
Santos Cordon980acb92014-05-31 10:31:19 -0700523 */
524 public List<String> getChildCallIds() {
525 return mChildCallIds;
526 }
527
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700528 public List<String> getConferenceableCallIds() {
529 return mConferenceableCallIds;
530 }
531
Tyler Gunn8d83fa92014-07-01 11:31:21 -0700532 /**
Sailesh Nepale7ef59a2014-07-08 21:48:22 -0700533 * The status label and icon.
534 *
535 * @return Status hints.
536 */
537 public StatusHints getStatusHints() {
538 return mStatusHints;
539 }
540
Andrew Lee85f5d422014-07-11 17:22:03 -0700541 /**
542 * The video state.
543 * @return The video state of the call.
544 */
545 public int getVideoState() {
546 return mVideoState;
547 }
548
Nancy Chen10798dc2014-08-08 14:00:25 -0700549 /**
Santos Cordon6b7f9552015-05-27 17:21:45 -0700550 * Any extras associated with this call.
Nancy Chen10798dc2014-08-08 14:00:25 -0700551 *
552 * @return a bundle of extras
553 */
554 public Bundle getExtras() {
555 return mExtras;
556 }
557
Rekha Kumar07366812015-03-24 16:42:31 -0700558 /**
Santos Cordon6b7f9552015-05-27 17:21:45 -0700559 * Extras passed in as part of the original call intent.
560 *
561 * @return The intent extras.
562 */
563 public Bundle getIntentExtras() {
564 return mIntentExtras;
565 }
566
567 /**
Tyler Gunn75958422015-04-15 14:23:42 -0700568 * Indicates to the receiver of the {@link ParcelableCall} whether a change has occurred in the
569 * {@link android.telecom.InCallService.VideoCall} associated with this call. Since
570 * {@link #getVideoCall()} creates a new {@link VideoCallImpl}, it is useful to know whether
571 * the provider has changed (which can influence whether it is accessed).
572 *
573 * @return {@code true} if the video call changed, {@code false} otherwise.
574 */
575 public boolean isVideoCallProviderChanged() {
576 return mIsVideoCallProviderChanged;
577 }
578
Tyler Gunnc0bf6de2017-03-17 11:27:09 -0700579 /**
580 * @return The time the call was created, in milliseconds since the epoch.
581 */
582 public long getCreationTimeMillis() {
583 return mCreationTimeMillis;
584 }
585
Tyler Gunn7e45b722018-12-04 12:56:45 -0800586 /**
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800587 * Indicates whether the call is an incoming or outgoing call.
588 */
589 public @CallDirection int getCallDirection() {
590 return mCallDirection;
591 }
592
Tyler Gunnd57d76c2019-09-24 14:53:23 -0700593 /**
594 * Gets the verification status for the phone number of an incoming call as identified in
595 * ATIS-1000082.
596 * @return the verification status.
597 */
598 public @Connection.VerificationStatus int getCallerNumberVerificationStatus() {
599 return mCallerNumberVerificationStatus;
600 }
601
Hall Liuef98bf82020-01-09 15:22:44 -0800602 /**
603 * @return the name of the remote party as derived from a contacts DB lookup.
604 */
605 public @Nullable String getContactDisplayName() {
606 return mContactDisplayName;
607 }
608
609 /**
610 * @return On a CDMA conference with two participants, returns the ID of the child call that's
611 * currently active.
612 */
613 public @Nullable String getActiveChildCallId() {
614 return mActiveChildCallId;
615 }
616
Santos Cordon88b771d2014-07-19 13:10:40 -0700617 /** Responsible for creating ParcelableCall objects for deserialized Parcels. */
Tyler Gunn7e45b722018-12-04 12:56:45 -0800618 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -0700619 public static final @android.annotation.NonNull Parcelable.Creator<ParcelableCall> CREATOR =
Santos Cordon88b771d2014-07-19 13:10:40 -0700620 new Parcelable.Creator<ParcelableCall> () {
Sailesh Nepal60437932014-04-05 16:44:55 -0700621 @Override
Santos Cordon88b771d2014-07-19 13:10:40 -0700622 public ParcelableCall createFromParcel(Parcel source) {
623 ClassLoader classLoader = ParcelableCall.class.getClassLoader();
Sailesh Nepal60437932014-04-05 16:44:55 -0700624 String id = source.readString();
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700625 int state = source.readInt();
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700626 DisconnectCause disconnectCause = source.readParcelable(classLoader);
Ihab Awadc0677542014-06-10 13:29:47 -0700627 List<String> cannedSmsResponses = new ArrayList<>();
628 source.readList(cannedSmsResponses, classLoader);
Sailesh Nepal60437932014-04-05 16:44:55 -0700629 int capabilities = source.readInt();
Andrew Lee223ad142014-08-27 16:33:08 -0700630 int properties = source.readInt();
Sailesh Nepal60437932014-04-05 16:44:55 -0700631 long connectTimeMillis = source.readLong();
Tyler Gunn7c613062020-04-13 17:19:24 -0700632 Uri handle = Uri.CREATOR.createFromParcel(source);
Sailesh Nepal61203862014-07-11 14:50:13 -0700633 int handlePresentation = source.readInt();
634 String callerDisplayName = source.readString();
635 int callerDisplayNamePresentation = source.readInt();
Sailesh Nepal60437932014-04-05 16:44:55 -0700636 GatewayInfo gatewayInfo = source.readParcelable(classLoader);
Evan Charlton8c8a0622014-07-20 12:31:00 -0700637 PhoneAccountHandle accountHandle = source.readParcelable(classLoader);
Tyler Gunn75958422015-04-15 14:23:42 -0700638 boolean isVideoCallProviderChanged = source.readByte() == 1;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700639 IVideoProvider videoCallProvider =
640 IVideoProvider.Stub.asInterface(source.readStrongBinder());
Santos Cordon980acb92014-05-31 10:31:19 -0700641 String parentCallId = source.readString();
642 List<String> childCallIds = new ArrayList<>();
643 source.readList(childCallIds, classLoader);
Sailesh Nepale7ef59a2014-07-08 21:48:22 -0700644 StatusHints statusHints = source.readParcelable(classLoader);
Andrew Lee85f5d422014-07-11 17:22:03 -0700645 int videoState = source.readInt();
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700646 List<String> conferenceableCallIds = new ArrayList<>();
647 source.readList(conferenceableCallIds, classLoader);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700648 Bundle intentExtras = source.readBundle(classLoader);
649 Bundle extras = source.readBundle(classLoader);
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800650 int supportedAudioRoutes = source.readInt();
Hall Liu95d55872017-01-25 17:12:49 -0800651 boolean isRttCallChanged = source.readByte() == 1;
652 ParcelableRttCall rttCall = source.readParcelable(classLoader);
Tyler Gunnc0bf6de2017-03-17 11:27:09 -0700653 long creationTimeMillis = source.readLong();
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800654 int callDirection = source.readInt();
Tyler Gunnd57d76c2019-09-24 14:53:23 -0700655 int callerNumberVerificationStatus = source.readInt();
Hall Liuef98bf82020-01-09 15:22:44 -0800656 String contactDisplayName = source.readString();
657 String activeChildCallId = source.readString();
658 return new ParcelableCallBuilder()
659 .setId(id)
660 .setState(state)
661 .setDisconnectCause(disconnectCause)
662 .setCannedSmsResponses(cannedSmsResponses)
663 .setCapabilities(capabilities)
664 .setProperties(properties)
665 .setSupportedAudioRoutes(supportedAudioRoutes)
666 .setConnectTimeMillis(connectTimeMillis)
667 .setHandle(handle)
668 .setHandlePresentation(handlePresentation)
669 .setCallerDisplayName(callerDisplayName)
670 .setCallerDisplayNamePresentation(callerDisplayNamePresentation)
671 .setGatewayInfo(gatewayInfo)
672 .setAccountHandle(accountHandle)
673 .setIsVideoCallProviderChanged(isVideoCallProviderChanged)
674 .setVideoCallProvider(videoCallProvider)
675 .setIsRttCallChanged(isRttCallChanged)
676 .setRttCall(rttCall)
677 .setParentCallId(parentCallId)
678 .setChildCallIds(childCallIds)
679 .setStatusHints(statusHints)
680 .setVideoState(videoState)
681 .setConferenceableCallIds(conferenceableCallIds)
682 .setIntentExtras(intentExtras)
683 .setExtras(extras)
684 .setCreationTimeMillis(creationTimeMillis)
685 .setCallDirection(callDirection)
686 .setCallerNumberVerificationStatus(callerNumberVerificationStatus)
687 .setContactDisplayName(contactDisplayName)
688 .setActiveChildCallId(activeChildCallId)
689 .createParcelableCall();
Sailesh Nepal60437932014-04-05 16:44:55 -0700690 }
691
692 @Override
Santos Cordon88b771d2014-07-19 13:10:40 -0700693 public ParcelableCall[] newArray(int size) {
694 return new ParcelableCall[size];
Sailesh Nepal60437932014-04-05 16:44:55 -0700695 }
696 };
697
698 /** {@inheritDoc} */
699 @Override
700 public int describeContents() {
701 return 0;
702 }
703
Santos Cordon88b771d2014-07-19 13:10:40 -0700704 /** Writes ParcelableCall object into a Parcel. */
Sailesh Nepal60437932014-04-05 16:44:55 -0700705 @Override
706 public void writeToParcel(Parcel destination, int flags) {
707 destination.writeString(mId);
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700708 destination.writeInt(mState);
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700709 destination.writeParcelable(mDisconnectCause, 0);
Ihab Awadc0677542014-06-10 13:29:47 -0700710 destination.writeList(mCannedSmsResponses);
Sailesh Nepal60437932014-04-05 16:44:55 -0700711 destination.writeInt(mCapabilities);
Andrew Lee223ad142014-08-27 16:33:08 -0700712 destination.writeInt(mProperties);
Sailesh Nepal60437932014-04-05 16:44:55 -0700713 destination.writeLong(mConnectTimeMillis);
Tyler Gunn7c613062020-04-13 17:19:24 -0700714 Uri.writeToParcel(destination, mHandle);
Sailesh Nepal61203862014-07-11 14:50:13 -0700715 destination.writeInt(mHandlePresentation);
716 destination.writeString(mCallerDisplayName);
717 destination.writeInt(mCallerDisplayNamePresentation);
Sailesh Nepal60437932014-04-05 16:44:55 -0700718 destination.writeParcelable(mGatewayInfo, 0);
Evan Charlton8c8a0622014-07-20 12:31:00 -0700719 destination.writeParcelable(mAccountHandle, 0);
Tyler Gunn75958422015-04-15 14:23:42 -0700720 destination.writeByte((byte) (mIsVideoCallProviderChanged ? 1 : 0));
Tyler Gunn807de8a2014-06-30 14:22:57 -0700721 destination.writeStrongBinder(
Andrew Lee50aca232014-07-22 16:41:54 -0700722 mVideoCallProvider != null ? mVideoCallProvider.asBinder() : null);
Santos Cordon980acb92014-05-31 10:31:19 -0700723 destination.writeString(mParentCallId);
724 destination.writeList(mChildCallIds);
Sailesh Nepale7ef59a2014-07-08 21:48:22 -0700725 destination.writeParcelable(mStatusHints, 0);
Andrew Lee85f5d422014-07-11 17:22:03 -0700726 destination.writeInt(mVideoState);
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700727 destination.writeList(mConferenceableCallIds);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700728 destination.writeBundle(mIntentExtras);
729 destination.writeBundle(mExtras);
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800730 destination.writeInt(mSupportedAudioRoutes);
Hall Liu95d55872017-01-25 17:12:49 -0800731 destination.writeByte((byte) (mIsRttCallChanged ? 1 : 0));
732 destination.writeParcelable(mRttCall, 0);
Tyler Gunnc0bf6de2017-03-17 11:27:09 -0700733 destination.writeLong(mCreationTimeMillis);
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800734 destination.writeInt(mCallDirection);
Tyler Gunnd57d76c2019-09-24 14:53:23 -0700735 destination.writeInt(mCallerNumberVerificationStatus);
Hall Liuef98bf82020-01-09 15:22:44 -0800736 destination.writeString(mContactDisplayName);
737 destination.writeString(mActiveChildCallId);
Sailesh Nepal60437932014-04-05 16:44:55 -0700738 }
Santos Cordonb6939982014-06-04 20:20:58 -0700739
740 @Override
741 public String toString() {
742 return String.format("[%s, parent:%s, children:%s]", mId, mParentCallId, mChildCallIds);
743 }
Sailesh Nepal60437932014-04-05 16:44:55 -0700744}