blob: 6a1318982e77addd35b2379a3fa5082d279700f1 [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;
Edgar Arriagae5bec822022-10-14 14:25:43 -070072 private Uri mContactPhotoUri;
Hall Liuef98bf82020-01-09 15:22:44 -080073
74 public ParcelableCallBuilder setId(String id) {
75 mId = id;
76 return this;
77 }
78
79 public ParcelableCallBuilder setState(int state) {
80 mState = state;
81 return this;
82 }
83
84 public ParcelableCallBuilder setDisconnectCause(DisconnectCause disconnectCause) {
85 mDisconnectCause = disconnectCause;
86 return this;
87 }
88
89 public ParcelableCallBuilder setCannedSmsResponses(List<String> cannedSmsResponses) {
90 mCannedSmsResponses = cannedSmsResponses;
91 return this;
92 }
93
94 public ParcelableCallBuilder setCapabilities(int capabilities) {
95 mCapabilities = capabilities;
96 return this;
97 }
98
99 public ParcelableCallBuilder setProperties(int properties) {
100 mProperties = properties;
101 return this;
102 }
103
104 public ParcelableCallBuilder setSupportedAudioRoutes(int supportedAudioRoutes) {
105 mSupportedAudioRoutes = supportedAudioRoutes;
106 return this;
107 }
108
109 public ParcelableCallBuilder setConnectTimeMillis(long connectTimeMillis) {
110 mConnectTimeMillis = connectTimeMillis;
111 return this;
112 }
113
114 public ParcelableCallBuilder setHandle(Uri handle) {
115 mHandle = handle;
116 return this;
117 }
118
119 public ParcelableCallBuilder setHandlePresentation(int handlePresentation) {
120 mHandlePresentation = handlePresentation;
121 return this;
122 }
123
124 public ParcelableCallBuilder setCallerDisplayName(String callerDisplayName) {
125 mCallerDisplayName = callerDisplayName;
126 return this;
127 }
128
129 public ParcelableCallBuilder setCallerDisplayNamePresentation(
130 int callerDisplayNamePresentation) {
131 mCallerDisplayNamePresentation = callerDisplayNamePresentation;
132 return this;
133 }
134
135 public ParcelableCallBuilder setGatewayInfo(GatewayInfo gatewayInfo) {
136 mGatewayInfo = gatewayInfo;
137 return this;
138 }
139
140 public ParcelableCallBuilder setAccountHandle(PhoneAccountHandle accountHandle) {
141 mAccountHandle = accountHandle;
142 return this;
143 }
144
145 public ParcelableCallBuilder setIsVideoCallProviderChanged(
146 boolean isVideoCallProviderChanged) {
147 mIsVideoCallProviderChanged = isVideoCallProviderChanged;
148 return this;
149 }
150
151 public ParcelableCallBuilder setVideoCallProvider(IVideoProvider videoCallProvider) {
152 mVideoCallProvider = videoCallProvider;
153 return this;
154 }
155
156 public ParcelableCallBuilder setIsRttCallChanged(boolean isRttCallChanged) {
157 mIsRttCallChanged = isRttCallChanged;
158 return this;
159 }
160
161 public ParcelableCallBuilder setRttCall(ParcelableRttCall rttCall) {
162 mRttCall = rttCall;
163 return this;
164 }
165
166 public ParcelableCallBuilder setParentCallId(String parentCallId) {
167 mParentCallId = parentCallId;
168 return this;
169 }
170
171 public ParcelableCallBuilder setChildCallIds(List<String> childCallIds) {
172 mChildCallIds = childCallIds;
173 return this;
174 }
175
176 public ParcelableCallBuilder setStatusHints(StatusHints statusHints) {
177 mStatusHints = statusHints;
178 return this;
179 }
180
181 public ParcelableCallBuilder setVideoState(int videoState) {
182 mVideoState = videoState;
183 return this;
184 }
185
186 public ParcelableCallBuilder setConferenceableCallIds(
187 List<String> conferenceableCallIds) {
188 mConferenceableCallIds = conferenceableCallIds;
189 return this;
190 }
191
192 public ParcelableCallBuilder setIntentExtras(Bundle intentExtras) {
193 mIntentExtras = intentExtras;
194 return this;
195 }
196
197 public ParcelableCallBuilder setExtras(Bundle extras) {
198 mExtras = extras;
199 return this;
200 }
201
202 public ParcelableCallBuilder setCreationTimeMillis(long creationTimeMillis) {
203 mCreationTimeMillis = creationTimeMillis;
204 return this;
205 }
206
207 public ParcelableCallBuilder setCallDirection(int callDirection) {
208 mCallDirection = callDirection;
209 return this;
210 }
211
212 public ParcelableCallBuilder setCallerNumberVerificationStatus(
213 int callerNumberVerificationStatus) {
214 mCallerNumberVerificationStatus = callerNumberVerificationStatus;
215 return this;
216 }
217
218 public ParcelableCallBuilder setContactDisplayName(String contactDisplayName) {
219 mContactDisplayName = contactDisplayName;
220 return this;
221 }
222
223 public ParcelableCallBuilder setActiveChildCallId(String activeChildCallId) {
224 mActiveChildCallId = activeChildCallId;
225 return this;
226 }
227
Edgar Arriagae5bec822022-10-14 14:25:43 -0700228 public ParcelableCallBuilder setContactPhotoUri(Uri contactPhotoUri) {
229 mContactPhotoUri = contactPhotoUri;
230 return this;
231 }
232
Hall Liuef98bf82020-01-09 15:22:44 -0800233 public ParcelableCall createParcelableCall() {
234 return new ParcelableCall(
235 mId,
236 mState,
237 mDisconnectCause,
238 mCannedSmsResponses,
239 mCapabilities,
240 mProperties,
241 mSupportedAudioRoutes,
242 mConnectTimeMillis,
243 mHandle,
244 mHandlePresentation,
245 mCallerDisplayName,
246 mCallerDisplayNamePresentation,
247 mGatewayInfo,
248 mAccountHandle,
249 mIsVideoCallProviderChanged,
250 mVideoCallProvider,
251 mIsRttCallChanged,
252 mRttCall,
253 mParentCallId,
254 mChildCallIds,
255 mStatusHints,
256 mVideoState,
257 mConferenceableCallIds,
258 mIntentExtras,
259 mExtras,
260 mCreationTimeMillis,
261 mCallDirection,
262 mCallerNumberVerificationStatus,
263 mContactDisplayName,
Edgar Arriagae5bec822022-10-14 14:25:43 -0700264 mActiveChildCallId,
265 mContactPhotoUri);
Hall Liuef98bf82020-01-09 15:22:44 -0800266 }
267
268 public static ParcelableCallBuilder fromParcelableCall(ParcelableCall parcelableCall) {
269 ParcelableCallBuilder newBuilder = new ParcelableCallBuilder();
270 newBuilder.mId = parcelableCall.mId;
271 newBuilder.mState = parcelableCall.mState;
272 newBuilder.mDisconnectCause = parcelableCall.mDisconnectCause;
273 newBuilder.mCannedSmsResponses = parcelableCall.mCannedSmsResponses;
274 newBuilder.mCapabilities = parcelableCall.mCapabilities;
275 newBuilder.mProperties = parcelableCall.mProperties;
276 newBuilder.mSupportedAudioRoutes = parcelableCall.mSupportedAudioRoutes;
277 newBuilder.mConnectTimeMillis = parcelableCall.mConnectTimeMillis;
278 newBuilder.mHandle = parcelableCall.mHandle;
279 newBuilder.mHandlePresentation = parcelableCall.mHandlePresentation;
280 newBuilder.mCallerDisplayName = parcelableCall.mCallerDisplayName;
281 newBuilder.mCallerDisplayNamePresentation =
282 parcelableCall.mCallerDisplayNamePresentation;
283 newBuilder.mGatewayInfo = parcelableCall.mGatewayInfo;
284 newBuilder.mAccountHandle = parcelableCall.mAccountHandle;
285 newBuilder.mIsVideoCallProviderChanged = parcelableCall.mIsVideoCallProviderChanged;
286 newBuilder.mVideoCallProvider = parcelableCall.mVideoCallProvider;
287 newBuilder.mIsRttCallChanged = parcelableCall.mIsRttCallChanged;
288 newBuilder.mRttCall = parcelableCall.mRttCall;
289 newBuilder.mParentCallId = parcelableCall.mParentCallId;
290 newBuilder.mChildCallIds = parcelableCall.mChildCallIds;
291 newBuilder.mStatusHints = parcelableCall.mStatusHints;
292 newBuilder.mVideoState = parcelableCall.mVideoState;
293 newBuilder.mConferenceableCallIds = parcelableCall.mConferenceableCallIds;
294 newBuilder.mIntentExtras = parcelableCall.mIntentExtras;
295 newBuilder.mExtras = parcelableCall.mExtras;
296 newBuilder.mCreationTimeMillis = parcelableCall.mCreationTimeMillis;
297 newBuilder.mCallDirection = parcelableCall.mCallDirection;
298 newBuilder.mCallerNumberVerificationStatus =
299 parcelableCall.mCallerNumberVerificationStatus;
300 newBuilder.mContactDisplayName = parcelableCall.mContactDisplayName;
301 newBuilder.mActiveChildCallId = parcelableCall.mActiveChildCallId;
Edgar Arriagae5bec822022-10-14 14:25:43 -0700302 newBuilder.mContactPhotoUri = parcelableCall.mContactPhotoUri;
Hall Liuef98bf82020-01-09 15:22:44 -0800303 return newBuilder;
304 }
305 }
306
Sailesh Nepal60437932014-04-05 16:44:55 -0700307 private final String mId;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700308 private final int mState;
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700309 private final DisconnectCause mDisconnectCause;
Ihab Awadc0677542014-06-10 13:29:47 -0700310 private final List<String> mCannedSmsResponses;
Sailesh Nepal60437932014-04-05 16:44:55 -0700311 private final int mCapabilities;
Andrew Lee223ad142014-08-27 16:33:08 -0700312 private final int mProperties;
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800313 private final int mSupportedAudioRoutes;
Sailesh Nepal60437932014-04-05 16:44:55 -0700314 private final long mConnectTimeMillis;
315 private final Uri mHandle;
Sailesh Nepal61203862014-07-11 14:50:13 -0700316 private final int mHandlePresentation;
317 private final String mCallerDisplayName;
318 private final int mCallerDisplayNamePresentation;
Sailesh Nepal60437932014-04-05 16:44:55 -0700319 private final GatewayInfo mGatewayInfo;
Evan Charlton8c8a0622014-07-20 12:31:00 -0700320 private final PhoneAccountHandle mAccountHandle;
Tyler Gunn75958422015-04-15 14:23:42 -0700321 private final boolean mIsVideoCallProviderChanged;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700322 private final IVideoProvider mVideoCallProvider;
Tyler Gunn584ba6c2015-12-08 10:53:41 -0800323 private VideoCallImpl mVideoCall;
Hall Liu95d55872017-01-25 17:12:49 -0800324 private final boolean mIsRttCallChanged;
325 private final ParcelableRttCall mRttCall;
Santos Cordon980acb92014-05-31 10:31:19 -0700326 private final String mParentCallId;
327 private final List<String> mChildCallIds;
Sailesh Nepale7ef59a2014-07-08 21:48:22 -0700328 private final StatusHints mStatusHints;
Andrew Lee85f5d422014-07-11 17:22:03 -0700329 private final int mVideoState;
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700330 private final List<String> mConferenceableCallIds;
Santos Cordon6b7f9552015-05-27 17:21:45 -0700331 private final Bundle mIntentExtras;
Nancy Chen10798dc2014-08-08 14:00:25 -0700332 private final Bundle mExtras;
Tyler Gunnc0bf6de2017-03-17 11:27:09 -0700333 private final long mCreationTimeMillis;
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800334 private final int mCallDirection;
Tyler Gunnd57d76c2019-09-24 14:53:23 -0700335 private final int mCallerNumberVerificationStatus;
Hall Liuef98bf82020-01-09 15:22:44 -0800336 private final String mContactDisplayName;
337 private final String mActiveChildCallId; // Only valid for CDMA conferences
Edgar Arriagae5bec822022-10-14 14:25:43 -0700338 private final Uri mContactPhotoUri;
Santos Cordon980acb92014-05-31 10:31:19 -0700339
Santos Cordon88b771d2014-07-19 13:10:40 -0700340 public ParcelableCall(
Sailesh Nepal60437932014-04-05 16:44:55 -0700341 String id,
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700342 int state,
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700343 DisconnectCause disconnectCause,
Ihab Awadc0677542014-06-10 13:29:47 -0700344 List<String> cannedSmsResponses,
Sailesh Nepal60437932014-04-05 16:44:55 -0700345 int capabilities,
Andrew Lee223ad142014-08-27 16:33:08 -0700346 int properties,
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800347 int supportedAudioRoutes,
Sailesh Nepal60437932014-04-05 16:44:55 -0700348 long connectTimeMillis,
349 Uri handle,
Sailesh Nepal61203862014-07-11 14:50:13 -0700350 int handlePresentation,
351 String callerDisplayName,
352 int callerDisplayNamePresentation,
Sailesh Nepal60437932014-04-05 16:44:55 -0700353 GatewayInfo gatewayInfo,
Evan Charlton8c8a0622014-07-20 12:31:00 -0700354 PhoneAccountHandle accountHandle,
Tyler Gunn75958422015-04-15 14:23:42 -0700355 boolean isVideoCallProviderChanged,
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700356 IVideoProvider videoCallProvider,
Hall Liu95d55872017-01-25 17:12:49 -0800357 boolean isRttCallChanged,
358 ParcelableRttCall rttCall,
Santos Cordon980acb92014-05-31 10:31:19 -0700359 String parentCallId,
Tyler Gunn8d83fa92014-07-01 11:31:21 -0700360 List<String> childCallIds,
Andrew Lee85f5d422014-07-11 17:22:03 -0700361 StatusHints statusHints,
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700362 int videoState,
Nancy Chen10798dc2014-08-08 14:00:25 -0700363 List<String> conferenceableCallIds,
Santos Cordon6b7f9552015-05-27 17:21:45 -0700364 Bundle intentExtras,
Tyler Gunnc0bf6de2017-03-17 11:27:09 -0700365 Bundle extras,
Tyler Gunn7e45b722018-12-04 12:56:45 -0800366 long creationTimeMillis,
Tyler Gunnd57d76c2019-09-24 14:53:23 -0700367 int callDirection,
Hall Liuef98bf82020-01-09 15:22:44 -0800368 int callerNumberVerificationStatus,
369 String contactDisplayName,
Edgar Arriagae5bec822022-10-14 14:25:43 -0700370 String activeChildCallId,
371 Uri contactPhotoUri
Hall Liuef98bf82020-01-09 15:22:44 -0800372 ) {
Sailesh Nepal60437932014-04-05 16:44:55 -0700373 mId = id;
374 mState = state;
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700375 mDisconnectCause = disconnectCause;
Ihab Awadc0677542014-06-10 13:29:47 -0700376 mCannedSmsResponses = cannedSmsResponses;
Sailesh Nepal60437932014-04-05 16:44:55 -0700377 mCapabilities = capabilities;
Andrew Lee223ad142014-08-27 16:33:08 -0700378 mProperties = properties;
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800379 mSupportedAudioRoutes = supportedAudioRoutes;
Sailesh Nepal60437932014-04-05 16:44:55 -0700380 mConnectTimeMillis = connectTimeMillis;
381 mHandle = handle;
Sailesh Nepal61203862014-07-11 14:50:13 -0700382 mHandlePresentation = handlePresentation;
383 mCallerDisplayName = callerDisplayName;
384 mCallerDisplayNamePresentation = callerDisplayNamePresentation;
Sailesh Nepal60437932014-04-05 16:44:55 -0700385 mGatewayInfo = gatewayInfo;
Evan Charlton8c8a0622014-07-20 12:31:00 -0700386 mAccountHandle = accountHandle;
Tyler Gunn75958422015-04-15 14:23:42 -0700387 mIsVideoCallProviderChanged = isVideoCallProviderChanged;
Andrew Lee50aca232014-07-22 16:41:54 -0700388 mVideoCallProvider = videoCallProvider;
Hall Liu95d55872017-01-25 17:12:49 -0800389 mIsRttCallChanged = isRttCallChanged;
390 mRttCall = rttCall;
Santos Cordon980acb92014-05-31 10:31:19 -0700391 mParentCallId = parentCallId;
392 mChildCallIds = childCallIds;
Sailesh Nepale7ef59a2014-07-08 21:48:22 -0700393 mStatusHints = statusHints;
Andrew Lee85f5d422014-07-11 17:22:03 -0700394 mVideoState = videoState;
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700395 mConferenceableCallIds = Collections.unmodifiableList(conferenceableCallIds);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700396 mIntentExtras = intentExtras;
Nancy Chen10798dc2014-08-08 14:00:25 -0700397 mExtras = extras;
Tyler Gunnc0bf6de2017-03-17 11:27:09 -0700398 mCreationTimeMillis = creationTimeMillis;
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800399 mCallDirection = callDirection;
Tyler Gunnd57d76c2019-09-24 14:53:23 -0700400 mCallerNumberVerificationStatus = callerNumberVerificationStatus;
Hall Liuef98bf82020-01-09 15:22:44 -0800401 mContactDisplayName = contactDisplayName;
402 mActiveChildCallId = activeChildCallId;
Edgar Arriagae5bec822022-10-14 14:25:43 -0700403 mContactPhotoUri = contactPhotoUri;
Sailesh Nepal60437932014-04-05 16:44:55 -0700404 }
405
406 /** The unique ID of the call. */
Mathew Inwood8c854f82018-09-14 12:35:36 +0100407 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Sailesh Nepal60437932014-04-05 16:44:55 -0700408 public String getId() {
409 return mId;
410 }
411
412 /** The current state of the call. */
Tyler Gunn1e406ca2021-03-18 16:47:14 -0700413 public @Call.CallState int getState() {
Sailesh Nepal60437932014-04-05 16:44:55 -0700414 return mState;
415 }
416
417 /**
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700418 * Reason for disconnection, as described by {@link android.telecomm.DisconnectCause}. Valid
419 * when call state is {@link CallState#DISCONNECTED}.
Sailesh Nepal60437932014-04-05 16:44:55 -0700420 */
Tyler Gunn7e45b722018-12-04 12:56:45 -0800421 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700422 public DisconnectCause getDisconnectCause() {
423 return mDisconnectCause;
Sailesh Nepal60437932014-04-05 16:44:55 -0700424 }
425
Ihab Awadc0677542014-06-10 13:29:47 -0700426 /**
427 * The set of possible text message responses when this call is incoming.
428 */
429 public List<String> getCannedSmsResponses() {
430 return mCannedSmsResponses;
431 }
432
Sailesh Nepal60437932014-04-05 16:44:55 -0700433 // Bit mask of actions a call supports, values are defined in {@link CallCapabilities}.
434 public int getCapabilities() {
435 return mCapabilities;
436 }
437
Andrew Lee223ad142014-08-27 16:33:08 -0700438 /** Bitmask of properties of the call. */
439 public int getProperties() { return mProperties; }
440
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800441 /** Bitmask of supported routes of the call */
442 public int getSupportedAudioRoutes() {
443 return mSupportedAudioRoutes;
444 }
445
Sailesh Nepal60437932014-04-05 16:44:55 -0700446 /** The time that the call switched to the active state. */
Tyler Gunn7e45b722018-12-04 12:56:45 -0800447 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Sailesh Nepal60437932014-04-05 16:44:55 -0700448 public long getConnectTimeMillis() {
449 return mConnectTimeMillis;
450 }
451
452 /** The endpoint to which the call is connected. */
Tyler Gunn7e45b722018-12-04 12:56:45 -0800453 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Sailesh Nepal60437932014-04-05 16:44:55 -0700454 public Uri getHandle() {
455 return mHandle;
456 }
457
Nancy Chen9d568c02014-09-08 14:17:59 -0700458 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700459 * The presentation requirements for the handle. See {@link TelecomManager} for valid values.
Nancy Chen9d568c02014-09-08 14:17:59 -0700460 */
Sailesh Nepal61203862014-07-11 14:50:13 -0700461 public int getHandlePresentation() {
462 return mHandlePresentation;
463 }
464
465 /** The endpoint to which the call is connected. */
466 public String getCallerDisplayName() {
467 return mCallerDisplayName;
468 }
469
Nancy Chen9d568c02014-09-08 14:17:59 -0700470 /**
471 * The presentation requirements for the caller display name.
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700472 * See {@link TelecomManager} for valid values.
Nancy Chen9d568c02014-09-08 14:17:59 -0700473 */
Sailesh Nepal61203862014-07-11 14:50:13 -0700474 public int getCallerDisplayNamePresentation() {
475 return mCallerDisplayNamePresentation;
476 }
477
Sailesh Nepal60437932014-04-05 16:44:55 -0700478 /** Gateway information for the call. */
479 public GatewayInfo getGatewayInfo() {
480 return mGatewayInfo;
481 }
482
Evan Charlton6eb262c2014-07-19 18:18:19 -0700483 /** PhoneAccountHandle information for the call. */
Evan Charlton8c8a0622014-07-20 12:31:00 -0700484 public PhoneAccountHandle getAccountHandle() {
485 return mAccountHandle;
Nancy Chen5ffbfcc2014-06-25 14:22:55 -0700486 }
487
Sailesh Nepal60437932014-04-05 16:44:55 -0700488 /**
Andrew Lee50aca232014-07-22 16:41:54 -0700489 * Returns an object for remotely communicating through the video call provider's binder.
Tyler Gunn159f35c2017-03-02 09:28:37 -0800490 *
491 * @param callingPackageName the package name of the calling InCallService.
492 * @param targetSdkVersion the target SDK version of the calling InCallService.
Andrew Lee50aca232014-07-22 16:41:54 -0700493 * @return The video call.
Andrew Lee5dc30752014-06-27 17:02:19 -0700494 */
Tyler Gunn159f35c2017-03-02 09:28:37 -0800495 public VideoCallImpl getVideoCallImpl(String callingPackageName, int targetSdkVersion) {
Andrew Lee50aca232014-07-22 16:41:54 -0700496 if (mVideoCall == null && mVideoCallProvider != null) {
Andrew Lee5dc30752014-06-27 17:02:19 -0700497 try {
Tyler Gunn159f35c2017-03-02 09:28:37 -0800498 mVideoCall = new VideoCallImpl(mVideoCallProvider, callingPackageName,
499 targetSdkVersion);
Andrew Lee5dc30752014-06-27 17:02:19 -0700500 } catch (RemoteException ignored) {
501 // Ignore RemoteException.
502 }
503 }
504
Andrew Lee50aca232014-07-22 16:41:54 -0700505 return mVideoCall;
Andrew Lee5dc30752014-06-27 17:02:19 -0700506 }
507
Tyler Gunnd1fdf3a2019-11-05 15:47:58 -0800508 public IVideoProvider getVideoProvider() {
509 return mVideoCallProvider;
510 }
511
Hall Liu95d55872017-01-25 17:12:49 -0800512 public boolean getIsRttCallChanged() {
513 return mIsRttCallChanged;
514 }
515
516 /**
517 * RTT communication channel information
518 * @return The ParcelableRttCall
519 */
520 public ParcelableRttCall getParcelableRttCall() {
521 return mRttCall;
522 }
523
Andrew Lee5dc30752014-06-27 17:02:19 -0700524 /**
Santos Cordon980acb92014-05-31 10:31:19 -0700525 * The conference call to which this call is conferenced. Null if not conferenced.
Santos Cordon980acb92014-05-31 10:31:19 -0700526 */
527 public String getParentCallId() {
528 return mParentCallId;
529 }
530
531 /**
532 * The child call-IDs if this call is a conference call. Returns an empty list if this is not
533 * a conference call or if the conference call contains no children.
Santos Cordon980acb92014-05-31 10:31:19 -0700534 */
535 public List<String> getChildCallIds() {
536 return mChildCallIds;
537 }
538
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700539 public List<String> getConferenceableCallIds() {
540 return mConferenceableCallIds;
541 }
542
Tyler Gunn8d83fa92014-07-01 11:31:21 -0700543 /**
Sailesh Nepale7ef59a2014-07-08 21:48:22 -0700544 * The status label and icon.
545 *
546 * @return Status hints.
547 */
548 public StatusHints getStatusHints() {
549 return mStatusHints;
550 }
551
Andrew Lee85f5d422014-07-11 17:22:03 -0700552 /**
553 * The video state.
554 * @return The video state of the call.
555 */
556 public int getVideoState() {
557 return mVideoState;
558 }
559
Nancy Chen10798dc2014-08-08 14:00:25 -0700560 /**
Santos Cordon6b7f9552015-05-27 17:21:45 -0700561 * Any extras associated with this call.
Nancy Chen10798dc2014-08-08 14:00:25 -0700562 *
563 * @return a bundle of extras
564 */
565 public Bundle getExtras() {
566 return mExtras;
567 }
568
Rekha Kumar07366812015-03-24 16:42:31 -0700569 /**
Santos Cordon6b7f9552015-05-27 17:21:45 -0700570 * Extras passed in as part of the original call intent.
571 *
572 * @return The intent extras.
573 */
574 public Bundle getIntentExtras() {
575 return mIntentExtras;
576 }
577
578 /**
Tyler Gunn75958422015-04-15 14:23:42 -0700579 * Indicates to the receiver of the {@link ParcelableCall} whether a change has occurred in the
580 * {@link android.telecom.InCallService.VideoCall} associated with this call. Since
581 * {@link #getVideoCall()} creates a new {@link VideoCallImpl}, it is useful to know whether
582 * the provider has changed (which can influence whether it is accessed).
583 *
584 * @return {@code true} if the video call changed, {@code false} otherwise.
585 */
586 public boolean isVideoCallProviderChanged() {
587 return mIsVideoCallProviderChanged;
588 }
589
Tyler Gunnc0bf6de2017-03-17 11:27:09 -0700590 /**
591 * @return The time the call was created, in milliseconds since the epoch.
592 */
593 public long getCreationTimeMillis() {
594 return mCreationTimeMillis;
595 }
596
Tyler Gunn7e45b722018-12-04 12:56:45 -0800597 /**
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800598 * Indicates whether the call is an incoming or outgoing call.
599 */
600 public @CallDirection int getCallDirection() {
601 return mCallDirection;
602 }
603
Tyler Gunnd57d76c2019-09-24 14:53:23 -0700604 /**
605 * Gets the verification status for the phone number of an incoming call as identified in
606 * ATIS-1000082.
607 * @return the verification status.
608 */
609 public @Connection.VerificationStatus int getCallerNumberVerificationStatus() {
610 return mCallerNumberVerificationStatus;
611 }
612
Hall Liuef98bf82020-01-09 15:22:44 -0800613 /**
614 * @return the name of the remote party as derived from a contacts DB lookup.
615 */
616 public @Nullable String getContactDisplayName() {
617 return mContactDisplayName;
618 }
619
620 /**
Edgar Arriagae5bec822022-10-14 14:25:43 -0700621 * @return the caller photo URI.
622 */
623 public @Nullable Uri getContactPhotoUri() {
624 return mContactPhotoUri;
625 }
626
627
628 /**
Hall Liuef98bf82020-01-09 15:22:44 -0800629 * @return On a CDMA conference with two participants, returns the ID of the child call that's
630 * currently active.
631 */
632 public @Nullable String getActiveChildCallId() {
633 return mActiveChildCallId;
634 }
635
Santos Cordon88b771d2014-07-19 13:10:40 -0700636 /** Responsible for creating ParcelableCall objects for deserialized Parcels. */
Tyler Gunn7e45b722018-12-04 12:56:45 -0800637 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -0700638 public static final @android.annotation.NonNull Parcelable.Creator<ParcelableCall> CREATOR =
Santos Cordon88b771d2014-07-19 13:10:40 -0700639 new Parcelable.Creator<ParcelableCall> () {
Sailesh Nepal60437932014-04-05 16:44:55 -0700640 @Override
Santos Cordon88b771d2014-07-19 13:10:40 -0700641 public ParcelableCall createFromParcel(Parcel source) {
642 ClassLoader classLoader = ParcelableCall.class.getClassLoader();
Sailesh Nepal60437932014-04-05 16:44:55 -0700643 String id = source.readString();
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700644 int state = source.readInt();
Bernardo Rufino90bb3702021-12-07 20:01:45 +0000645 DisconnectCause disconnectCause = source.readParcelable(classLoader, android.telecom.DisconnectCause.class);
Ihab Awadc0677542014-06-10 13:29:47 -0700646 List<String> cannedSmsResponses = new ArrayList<>();
Bernardo Rufino90bb3702021-12-07 20:01:45 +0000647 source.readList(cannedSmsResponses, classLoader, java.lang.String.class);
Sailesh Nepal60437932014-04-05 16:44:55 -0700648 int capabilities = source.readInt();
Andrew Lee223ad142014-08-27 16:33:08 -0700649 int properties = source.readInt();
Sailesh Nepal60437932014-04-05 16:44:55 -0700650 long connectTimeMillis = source.readLong();
Tyler Gunn7c613062020-04-13 17:19:24 -0700651 Uri handle = Uri.CREATOR.createFromParcel(source);
Sailesh Nepal61203862014-07-11 14:50:13 -0700652 int handlePresentation = source.readInt();
653 String callerDisplayName = source.readString();
654 int callerDisplayNamePresentation = source.readInt();
Bernardo Rufino90bb3702021-12-07 20:01:45 +0000655 GatewayInfo gatewayInfo = source.readParcelable(classLoader, android.telecom.GatewayInfo.class);
656 PhoneAccountHandle accountHandle = source.readParcelable(classLoader, android.telecom.PhoneAccountHandle.class);
Tyler Gunn75958422015-04-15 14:23:42 -0700657 boolean isVideoCallProviderChanged = source.readByte() == 1;
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700658 IVideoProvider videoCallProvider =
659 IVideoProvider.Stub.asInterface(source.readStrongBinder());
Santos Cordon980acb92014-05-31 10:31:19 -0700660 String parentCallId = source.readString();
661 List<String> childCallIds = new ArrayList<>();
Bernardo Rufino90bb3702021-12-07 20:01:45 +0000662 source.readList(childCallIds, classLoader, java.lang.String.class);
663 StatusHints statusHints = source.readParcelable(classLoader, android.telecom.StatusHints.class);
Andrew Lee85f5d422014-07-11 17:22:03 -0700664 int videoState = source.readInt();
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700665 List<String> conferenceableCallIds = new ArrayList<>();
Bernardo Rufino90bb3702021-12-07 20:01:45 +0000666 source.readList(conferenceableCallIds, classLoader, java.lang.String.class);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700667 Bundle intentExtras = source.readBundle(classLoader);
668 Bundle extras = source.readBundle(classLoader);
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800669 int supportedAudioRoutes = source.readInt();
Hall Liu95d55872017-01-25 17:12:49 -0800670 boolean isRttCallChanged = source.readByte() == 1;
Bernardo Rufino90bb3702021-12-07 20:01:45 +0000671 ParcelableRttCall rttCall = source.readParcelable(classLoader, android.telecom.ParcelableRttCall.class);
Tyler Gunnc0bf6de2017-03-17 11:27:09 -0700672 long creationTimeMillis = source.readLong();
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800673 int callDirection = source.readInt();
Tyler Gunnd57d76c2019-09-24 14:53:23 -0700674 int callerNumberVerificationStatus = source.readInt();
Hall Liuef98bf82020-01-09 15:22:44 -0800675 String contactDisplayName = source.readString();
676 String activeChildCallId = source.readString();
Edgar Arriagae5bec822022-10-14 14:25:43 -0700677 Uri contactPhotoUri = source.readParcelable(classLoader, Uri.class);
Hall Liuef98bf82020-01-09 15:22:44 -0800678 return new ParcelableCallBuilder()
679 .setId(id)
680 .setState(state)
681 .setDisconnectCause(disconnectCause)
682 .setCannedSmsResponses(cannedSmsResponses)
683 .setCapabilities(capabilities)
684 .setProperties(properties)
685 .setSupportedAudioRoutes(supportedAudioRoutes)
686 .setConnectTimeMillis(connectTimeMillis)
687 .setHandle(handle)
688 .setHandlePresentation(handlePresentation)
689 .setCallerDisplayName(callerDisplayName)
690 .setCallerDisplayNamePresentation(callerDisplayNamePresentation)
691 .setGatewayInfo(gatewayInfo)
692 .setAccountHandle(accountHandle)
693 .setIsVideoCallProviderChanged(isVideoCallProviderChanged)
694 .setVideoCallProvider(videoCallProvider)
695 .setIsRttCallChanged(isRttCallChanged)
696 .setRttCall(rttCall)
697 .setParentCallId(parentCallId)
698 .setChildCallIds(childCallIds)
699 .setStatusHints(statusHints)
700 .setVideoState(videoState)
701 .setConferenceableCallIds(conferenceableCallIds)
702 .setIntentExtras(intentExtras)
703 .setExtras(extras)
704 .setCreationTimeMillis(creationTimeMillis)
705 .setCallDirection(callDirection)
706 .setCallerNumberVerificationStatus(callerNumberVerificationStatus)
707 .setContactDisplayName(contactDisplayName)
708 .setActiveChildCallId(activeChildCallId)
Edgar Arriagae5bec822022-10-14 14:25:43 -0700709 .setContactPhotoUri(contactPhotoUri)
Hall Liuef98bf82020-01-09 15:22:44 -0800710 .createParcelableCall();
Sailesh Nepal60437932014-04-05 16:44:55 -0700711 }
712
713 @Override
Santos Cordon88b771d2014-07-19 13:10:40 -0700714 public ParcelableCall[] newArray(int size) {
715 return new ParcelableCall[size];
Sailesh Nepal60437932014-04-05 16:44:55 -0700716 }
717 };
718
719 /** {@inheritDoc} */
720 @Override
721 public int describeContents() {
722 return 0;
723 }
724
Santos Cordon88b771d2014-07-19 13:10:40 -0700725 /** Writes ParcelableCall object into a Parcel. */
Sailesh Nepal60437932014-04-05 16:44:55 -0700726 @Override
727 public void writeToParcel(Parcel destination, int flags) {
728 destination.writeString(mId);
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700729 destination.writeInt(mState);
Andrew Lee7f3d41f2014-09-11 17:33:16 -0700730 destination.writeParcelable(mDisconnectCause, 0);
Ihab Awadc0677542014-06-10 13:29:47 -0700731 destination.writeList(mCannedSmsResponses);
Sailesh Nepal60437932014-04-05 16:44:55 -0700732 destination.writeInt(mCapabilities);
Andrew Lee223ad142014-08-27 16:33:08 -0700733 destination.writeInt(mProperties);
Sailesh Nepal60437932014-04-05 16:44:55 -0700734 destination.writeLong(mConnectTimeMillis);
Tyler Gunn7c613062020-04-13 17:19:24 -0700735 Uri.writeToParcel(destination, mHandle);
Sailesh Nepal61203862014-07-11 14:50:13 -0700736 destination.writeInt(mHandlePresentation);
737 destination.writeString(mCallerDisplayName);
738 destination.writeInt(mCallerDisplayNamePresentation);
Sailesh Nepal60437932014-04-05 16:44:55 -0700739 destination.writeParcelable(mGatewayInfo, 0);
Evan Charlton8c8a0622014-07-20 12:31:00 -0700740 destination.writeParcelable(mAccountHandle, 0);
Tyler Gunn75958422015-04-15 14:23:42 -0700741 destination.writeByte((byte) (mIsVideoCallProviderChanged ? 1 : 0));
Tyler Gunn807de8a2014-06-30 14:22:57 -0700742 destination.writeStrongBinder(
Andrew Lee50aca232014-07-22 16:41:54 -0700743 mVideoCallProvider != null ? mVideoCallProvider.asBinder() : null);
Santos Cordon980acb92014-05-31 10:31:19 -0700744 destination.writeString(mParentCallId);
745 destination.writeList(mChildCallIds);
Sailesh Nepale7ef59a2014-07-08 21:48:22 -0700746 destination.writeParcelable(mStatusHints, 0);
Andrew Lee85f5d422014-07-11 17:22:03 -0700747 destination.writeInt(mVideoState);
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700748 destination.writeList(mConferenceableCallIds);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700749 destination.writeBundle(mIntentExtras);
750 destination.writeBundle(mExtras);
Christine Hallstrom2830ce92016-11-30 16:06:42 -0800751 destination.writeInt(mSupportedAudioRoutes);
Hall Liu95d55872017-01-25 17:12:49 -0800752 destination.writeByte((byte) (mIsRttCallChanged ? 1 : 0));
753 destination.writeParcelable(mRttCall, 0);
Tyler Gunnc0bf6de2017-03-17 11:27:09 -0700754 destination.writeLong(mCreationTimeMillis);
Tyler Gunn9e76fd19b2018-12-17 09:56:11 -0800755 destination.writeInt(mCallDirection);
Tyler Gunnd57d76c2019-09-24 14:53:23 -0700756 destination.writeInt(mCallerNumberVerificationStatus);
Hall Liuef98bf82020-01-09 15:22:44 -0800757 destination.writeString(mContactDisplayName);
758 destination.writeString(mActiveChildCallId);
Edgar Arriagae5bec822022-10-14 14:25:43 -0700759 destination.writeParcelable(mContactPhotoUri, 0);
Sailesh Nepal60437932014-04-05 16:44:55 -0700760 }
Santos Cordonb6939982014-06-04 20:20:58 -0700761
762 @Override
763 public String toString() {
764 return String.format("[%s, parent:%s, children:%s]", mId, mParentCallId, mChildCallIds);
765 }
Sailesh Nepal60437932014-04-05 16:44:55 -0700766}