1 /* 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 17 package android.telecom; 18 19 import android.annotation.Nullable; 20 import android.compat.annotation.UnsupportedAppUsage; 21 import android.net.Uri; 22 import android.os.Build; 23 import android.os.Bundle; 24 import android.os.Parcel; 25 import android.os.Parcelable; 26 import android.os.RemoteException; 27 import android.telecom.Call.Details.CallDirection; 28 29 import com.android.internal.telecom.IVideoProvider; 30 31 import java.util.ArrayList; 32 import java.util.Collections; 33 import java.util.List; 34 35 /** 36 * Information about a call that is used between InCallService and Telecom. 37 * @hide 38 */ 39 public final class ParcelableCall implements Parcelable { 40 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 setId(String id)73 public ParcelableCallBuilder setId(String id) { 74 mId = id; 75 return this; 76 } 77 setState(int state)78 public ParcelableCallBuilder setState(int state) { 79 mState = state; 80 return this; 81 } 82 setDisconnectCause(DisconnectCause disconnectCause)83 public ParcelableCallBuilder setDisconnectCause(DisconnectCause disconnectCause) { 84 mDisconnectCause = disconnectCause; 85 return this; 86 } 87 setCannedSmsResponses(List<String> cannedSmsResponses)88 public ParcelableCallBuilder setCannedSmsResponses(List<String> cannedSmsResponses) { 89 mCannedSmsResponses = cannedSmsResponses; 90 return this; 91 } 92 setCapabilities(int capabilities)93 public ParcelableCallBuilder setCapabilities(int capabilities) { 94 mCapabilities = capabilities; 95 return this; 96 } 97 setProperties(int properties)98 public ParcelableCallBuilder setProperties(int properties) { 99 mProperties = properties; 100 return this; 101 } 102 setSupportedAudioRoutes(int supportedAudioRoutes)103 public ParcelableCallBuilder setSupportedAudioRoutes(int supportedAudioRoutes) { 104 mSupportedAudioRoutes = supportedAudioRoutes; 105 return this; 106 } 107 setConnectTimeMillis(long connectTimeMillis)108 public ParcelableCallBuilder setConnectTimeMillis(long connectTimeMillis) { 109 mConnectTimeMillis = connectTimeMillis; 110 return this; 111 } 112 setHandle(Uri handle)113 public ParcelableCallBuilder setHandle(Uri handle) { 114 mHandle = handle; 115 return this; 116 } 117 setHandlePresentation(int handlePresentation)118 public ParcelableCallBuilder setHandlePresentation(int handlePresentation) { 119 mHandlePresentation = handlePresentation; 120 return this; 121 } 122 setCallerDisplayName(String callerDisplayName)123 public ParcelableCallBuilder setCallerDisplayName(String callerDisplayName) { 124 mCallerDisplayName = callerDisplayName; 125 return this; 126 } 127 setCallerDisplayNamePresentation( int callerDisplayNamePresentation)128 public ParcelableCallBuilder setCallerDisplayNamePresentation( 129 int callerDisplayNamePresentation) { 130 mCallerDisplayNamePresentation = callerDisplayNamePresentation; 131 return this; 132 } 133 setGatewayInfo(GatewayInfo gatewayInfo)134 public ParcelableCallBuilder setGatewayInfo(GatewayInfo gatewayInfo) { 135 mGatewayInfo = gatewayInfo; 136 return this; 137 } 138 setAccountHandle(PhoneAccountHandle accountHandle)139 public ParcelableCallBuilder setAccountHandle(PhoneAccountHandle accountHandle) { 140 mAccountHandle = accountHandle; 141 return this; 142 } 143 setIsVideoCallProviderChanged( boolean isVideoCallProviderChanged)144 public ParcelableCallBuilder setIsVideoCallProviderChanged( 145 boolean isVideoCallProviderChanged) { 146 mIsVideoCallProviderChanged = isVideoCallProviderChanged; 147 return this; 148 } 149 setVideoCallProvider(IVideoProvider videoCallProvider)150 public ParcelableCallBuilder setVideoCallProvider(IVideoProvider videoCallProvider) { 151 mVideoCallProvider = videoCallProvider; 152 return this; 153 } 154 setIsRttCallChanged(boolean isRttCallChanged)155 public ParcelableCallBuilder setIsRttCallChanged(boolean isRttCallChanged) { 156 mIsRttCallChanged = isRttCallChanged; 157 return this; 158 } 159 setRttCall(ParcelableRttCall rttCall)160 public ParcelableCallBuilder setRttCall(ParcelableRttCall rttCall) { 161 mRttCall = rttCall; 162 return this; 163 } 164 setParentCallId(String parentCallId)165 public ParcelableCallBuilder setParentCallId(String parentCallId) { 166 mParentCallId = parentCallId; 167 return this; 168 } 169 setChildCallIds(List<String> childCallIds)170 public ParcelableCallBuilder setChildCallIds(List<String> childCallIds) { 171 mChildCallIds = childCallIds; 172 return this; 173 } 174 setStatusHints(StatusHints statusHints)175 public ParcelableCallBuilder setStatusHints(StatusHints statusHints) { 176 mStatusHints = statusHints; 177 return this; 178 } 179 setVideoState(int videoState)180 public ParcelableCallBuilder setVideoState(int videoState) { 181 mVideoState = videoState; 182 return this; 183 } 184 setConferenceableCallIds( List<String> conferenceableCallIds)185 public ParcelableCallBuilder setConferenceableCallIds( 186 List<String> conferenceableCallIds) { 187 mConferenceableCallIds = conferenceableCallIds; 188 return this; 189 } 190 setIntentExtras(Bundle intentExtras)191 public ParcelableCallBuilder setIntentExtras(Bundle intentExtras) { 192 mIntentExtras = intentExtras; 193 return this; 194 } 195 setExtras(Bundle extras)196 public ParcelableCallBuilder setExtras(Bundle extras) { 197 mExtras = extras; 198 return this; 199 } 200 setCreationTimeMillis(long creationTimeMillis)201 public ParcelableCallBuilder setCreationTimeMillis(long creationTimeMillis) { 202 mCreationTimeMillis = creationTimeMillis; 203 return this; 204 } 205 setCallDirection(int callDirection)206 public ParcelableCallBuilder setCallDirection(int callDirection) { 207 mCallDirection = callDirection; 208 return this; 209 } 210 setCallerNumberVerificationStatus( int callerNumberVerificationStatus)211 public ParcelableCallBuilder setCallerNumberVerificationStatus( 212 int callerNumberVerificationStatus) { 213 mCallerNumberVerificationStatus = callerNumberVerificationStatus; 214 return this; 215 } 216 setContactDisplayName(String contactDisplayName)217 public ParcelableCallBuilder setContactDisplayName(String contactDisplayName) { 218 mContactDisplayName = contactDisplayName; 219 return this; 220 } 221 setActiveChildCallId(String activeChildCallId)222 public ParcelableCallBuilder setActiveChildCallId(String activeChildCallId) { 223 mActiveChildCallId = activeChildCallId; 224 return this; 225 } 226 createParcelableCall()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 fromParcelableCall(ParcelableCall parcelableCall)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 299 private final String mId; 300 private final int mState; 301 private final DisconnectCause mDisconnectCause; 302 private final List<String> mCannedSmsResponses; 303 private final int mCapabilities; 304 private final int mProperties; 305 private final int mSupportedAudioRoutes; 306 private final long mConnectTimeMillis; 307 private final Uri mHandle; 308 private final int mHandlePresentation; 309 private final String mCallerDisplayName; 310 private final int mCallerDisplayNamePresentation; 311 private final GatewayInfo mGatewayInfo; 312 private final PhoneAccountHandle mAccountHandle; 313 private final boolean mIsVideoCallProviderChanged; 314 private final IVideoProvider mVideoCallProvider; 315 private VideoCallImpl mVideoCall; 316 private final boolean mIsRttCallChanged; 317 private final ParcelableRttCall mRttCall; 318 private final String mParentCallId; 319 private final List<String> mChildCallIds; 320 private final StatusHints mStatusHints; 321 private final int mVideoState; 322 private final List<String> mConferenceableCallIds; 323 private final Bundle mIntentExtras; 324 private final Bundle mExtras; 325 private final long mCreationTimeMillis; 326 private final int mCallDirection; 327 private final int mCallerNumberVerificationStatus; 328 private final String mContactDisplayName; 329 private final String mActiveChildCallId; // Only valid for CDMA conferences 330 ParcelableCall( String id, int state, DisconnectCause disconnectCause, List<String> cannedSmsResponses, int capabilities, int properties, int supportedAudioRoutes, long connectTimeMillis, Uri handle, int handlePresentation, String callerDisplayName, int callerDisplayNamePresentation, GatewayInfo gatewayInfo, PhoneAccountHandle accountHandle, boolean isVideoCallProviderChanged, IVideoProvider videoCallProvider, boolean isRttCallChanged, ParcelableRttCall rttCall, String parentCallId, List<String> childCallIds, StatusHints statusHints, int videoState, List<String> conferenceableCallIds, Bundle intentExtras, Bundle extras, long creationTimeMillis, int callDirection, int callerNumberVerificationStatus, String contactDisplayName, String activeChildCallId )331 public ParcelableCall( 332 String id, 333 int state, 334 DisconnectCause disconnectCause, 335 List<String> cannedSmsResponses, 336 int capabilities, 337 int properties, 338 int supportedAudioRoutes, 339 long connectTimeMillis, 340 Uri handle, 341 int handlePresentation, 342 String callerDisplayName, 343 int callerDisplayNamePresentation, 344 GatewayInfo gatewayInfo, 345 PhoneAccountHandle accountHandle, 346 boolean isVideoCallProviderChanged, 347 IVideoProvider videoCallProvider, 348 boolean isRttCallChanged, 349 ParcelableRttCall rttCall, 350 String parentCallId, 351 List<String> childCallIds, 352 StatusHints statusHints, 353 int videoState, 354 List<String> conferenceableCallIds, 355 Bundle intentExtras, 356 Bundle extras, 357 long creationTimeMillis, 358 int callDirection, 359 int callerNumberVerificationStatus, 360 String contactDisplayName, 361 String activeChildCallId 362 ) { 363 mId = id; 364 mState = state; 365 mDisconnectCause = disconnectCause; 366 mCannedSmsResponses = cannedSmsResponses; 367 mCapabilities = capabilities; 368 mProperties = properties; 369 mSupportedAudioRoutes = supportedAudioRoutes; 370 mConnectTimeMillis = connectTimeMillis; 371 mHandle = handle; 372 mHandlePresentation = handlePresentation; 373 mCallerDisplayName = callerDisplayName; 374 mCallerDisplayNamePresentation = callerDisplayNamePresentation; 375 mGatewayInfo = gatewayInfo; 376 mAccountHandle = accountHandle; 377 mIsVideoCallProviderChanged = isVideoCallProviderChanged; 378 mVideoCallProvider = videoCallProvider; 379 mIsRttCallChanged = isRttCallChanged; 380 mRttCall = rttCall; 381 mParentCallId = parentCallId; 382 mChildCallIds = childCallIds; 383 mStatusHints = statusHints; 384 mVideoState = videoState; 385 mConferenceableCallIds = Collections.unmodifiableList(conferenceableCallIds); 386 mIntentExtras = intentExtras; 387 mExtras = extras; 388 mCreationTimeMillis = creationTimeMillis; 389 mCallDirection = callDirection; 390 mCallerNumberVerificationStatus = callerNumberVerificationStatus; 391 mContactDisplayName = contactDisplayName; 392 mActiveChildCallId = activeChildCallId; 393 } 394 395 /** The unique ID of the call. */ 396 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) getId()397 public String getId() { 398 return mId; 399 } 400 401 /** The current state of the call. */ getState()402 public @Call.CallState int getState() { 403 return mState; 404 } 405 406 /** 407 * Reason for disconnection, as described by {@link android.telecomm.DisconnectCause}. Valid 408 * when call state is {@link CallState#DISCONNECTED}. 409 */ 410 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) getDisconnectCause()411 public DisconnectCause getDisconnectCause() { 412 return mDisconnectCause; 413 } 414 415 /** 416 * The set of possible text message responses when this call is incoming. 417 */ getCannedSmsResponses()418 public List<String> getCannedSmsResponses() { 419 return mCannedSmsResponses; 420 } 421 422 // Bit mask of actions a call supports, values are defined in {@link CallCapabilities}. getCapabilities()423 public int getCapabilities() { 424 return mCapabilities; 425 } 426 427 /** Bitmask of properties of the call. */ getProperties()428 public int getProperties() { return mProperties; } 429 430 /** Bitmask of supported routes of the call */ getSupportedAudioRoutes()431 public int getSupportedAudioRoutes() { 432 return mSupportedAudioRoutes; 433 } 434 435 /** The time that the call switched to the active state. */ 436 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) getConnectTimeMillis()437 public long getConnectTimeMillis() { 438 return mConnectTimeMillis; 439 } 440 441 /** The endpoint to which the call is connected. */ 442 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) getHandle()443 public Uri getHandle() { 444 return mHandle; 445 } 446 447 /** 448 * The presentation requirements for the handle. See {@link TelecomManager} for valid values. 449 */ getHandlePresentation()450 public int getHandlePresentation() { 451 return mHandlePresentation; 452 } 453 454 /** The endpoint to which the call is connected. */ getCallerDisplayName()455 public String getCallerDisplayName() { 456 return mCallerDisplayName; 457 } 458 459 /** 460 * The presentation requirements for the caller display name. 461 * See {@link TelecomManager} for valid values. 462 */ getCallerDisplayNamePresentation()463 public int getCallerDisplayNamePresentation() { 464 return mCallerDisplayNamePresentation; 465 } 466 467 /** Gateway information for the call. */ getGatewayInfo()468 public GatewayInfo getGatewayInfo() { 469 return mGatewayInfo; 470 } 471 472 /** PhoneAccountHandle information for the call. */ getAccountHandle()473 public PhoneAccountHandle getAccountHandle() { 474 return mAccountHandle; 475 } 476 477 /** 478 * Returns an object for remotely communicating through the video call provider's binder. 479 * 480 * @param callingPackageName the package name of the calling InCallService. 481 * @param targetSdkVersion the target SDK version of the calling InCallService. 482 * @return The video call. 483 */ getVideoCallImpl(String callingPackageName, int targetSdkVersion)484 public VideoCallImpl getVideoCallImpl(String callingPackageName, int targetSdkVersion) { 485 if (mVideoCall == null && mVideoCallProvider != null) { 486 try { 487 mVideoCall = new VideoCallImpl(mVideoCallProvider, callingPackageName, 488 targetSdkVersion); 489 } catch (RemoteException ignored) { 490 // Ignore RemoteException. 491 } 492 } 493 494 return mVideoCall; 495 } 496 getVideoProvider()497 public IVideoProvider getVideoProvider() { 498 return mVideoCallProvider; 499 } 500 getIsRttCallChanged()501 public boolean getIsRttCallChanged() { 502 return mIsRttCallChanged; 503 } 504 505 /** 506 * RTT communication channel information 507 * @return The ParcelableRttCall 508 */ getParcelableRttCall()509 public ParcelableRttCall getParcelableRttCall() { 510 return mRttCall; 511 } 512 513 /** 514 * The conference call to which this call is conferenced. Null if not conferenced. 515 */ getParentCallId()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. 523 */ getChildCallIds()524 public List<String> getChildCallIds() { 525 return mChildCallIds; 526 } 527 getConferenceableCallIds()528 public List<String> getConferenceableCallIds() { 529 return mConferenceableCallIds; 530 } 531 532 /** 533 * The status label and icon. 534 * 535 * @return Status hints. 536 */ getStatusHints()537 public StatusHints getStatusHints() { 538 return mStatusHints; 539 } 540 541 /** 542 * The video state. 543 * @return The video state of the call. 544 */ getVideoState()545 public int getVideoState() { 546 return mVideoState; 547 } 548 549 /** 550 * Any extras associated with this call. 551 * 552 * @return a bundle of extras 553 */ getExtras()554 public Bundle getExtras() { 555 return mExtras; 556 } 557 558 /** 559 * Extras passed in as part of the original call intent. 560 * 561 * @return The intent extras. 562 */ getIntentExtras()563 public Bundle getIntentExtras() { 564 return mIntentExtras; 565 } 566 567 /** 568 * 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 */ isVideoCallProviderChanged()575 public boolean isVideoCallProviderChanged() { 576 return mIsVideoCallProviderChanged; 577 } 578 579 /** 580 * @return The time the call was created, in milliseconds since the epoch. 581 */ getCreationTimeMillis()582 public long getCreationTimeMillis() { 583 return mCreationTimeMillis; 584 } 585 586 /** 587 * Indicates whether the call is an incoming or outgoing call. 588 */ getCallDirection()589 public @CallDirection int getCallDirection() { 590 return mCallDirection; 591 } 592 593 /** 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 */ getCallerNumberVerificationStatus()598 public @Connection.VerificationStatus int getCallerNumberVerificationStatus() { 599 return mCallerNumberVerificationStatus; 600 } 601 602 /** 603 * @return the name of the remote party as derived from a contacts DB lookup. 604 */ getContactDisplayName()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 */ getActiveChildCallId()613 public @Nullable String getActiveChildCallId() { 614 return mActiveChildCallId; 615 } 616 617 /** Responsible for creating ParcelableCall objects for deserialized Parcels. */ 618 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) 619 public static final @android.annotation.NonNull Parcelable.Creator<ParcelableCall> CREATOR = 620 new Parcelable.Creator<ParcelableCall> () { 621 @Override 622 public ParcelableCall createFromParcel(Parcel source) { 623 ClassLoader classLoader = ParcelableCall.class.getClassLoader(); 624 String id = source.readString(); 625 int state = source.readInt(); 626 DisconnectCause disconnectCause = source.readParcelable(classLoader, android.telecom.DisconnectCause.class); 627 List<String> cannedSmsResponses = new ArrayList<>(); 628 source.readList(cannedSmsResponses, classLoader, java.lang.String.class); 629 int capabilities = source.readInt(); 630 int properties = source.readInt(); 631 long connectTimeMillis = source.readLong(); 632 Uri handle = Uri.CREATOR.createFromParcel(source); 633 int handlePresentation = source.readInt(); 634 String callerDisplayName = source.readString(); 635 int callerDisplayNamePresentation = source.readInt(); 636 GatewayInfo gatewayInfo = source.readParcelable(classLoader, android.telecom.GatewayInfo.class); 637 PhoneAccountHandle accountHandle = source.readParcelable(classLoader, android.telecom.PhoneAccountHandle.class); 638 boolean isVideoCallProviderChanged = source.readByte() == 1; 639 IVideoProvider videoCallProvider = 640 IVideoProvider.Stub.asInterface(source.readStrongBinder()); 641 String parentCallId = source.readString(); 642 List<String> childCallIds = new ArrayList<>(); 643 source.readList(childCallIds, classLoader, java.lang.String.class); 644 StatusHints statusHints = source.readParcelable(classLoader, android.telecom.StatusHints.class); 645 int videoState = source.readInt(); 646 List<String> conferenceableCallIds = new ArrayList<>(); 647 source.readList(conferenceableCallIds, classLoader, java.lang.String.class); 648 Bundle intentExtras = source.readBundle(classLoader); 649 Bundle extras = source.readBundle(classLoader); 650 int supportedAudioRoutes = source.readInt(); 651 boolean isRttCallChanged = source.readByte() == 1; 652 ParcelableRttCall rttCall = source.readParcelable(classLoader, android.telecom.ParcelableRttCall.class); 653 long creationTimeMillis = source.readLong(); 654 int callDirection = source.readInt(); 655 int callerNumberVerificationStatus = source.readInt(); 656 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(); 690 } 691 692 @Override 693 public ParcelableCall[] newArray(int size) { 694 return new ParcelableCall[size]; 695 } 696 }; 697 698 /** {@inheritDoc} */ 699 @Override describeContents()700 public int describeContents() { 701 return 0; 702 } 703 704 /** Writes ParcelableCall object into a Parcel. */ 705 @Override writeToParcel(Parcel destination, int flags)706 public void writeToParcel(Parcel destination, int flags) { 707 destination.writeString(mId); 708 destination.writeInt(mState); 709 destination.writeParcelable(mDisconnectCause, 0); 710 destination.writeList(mCannedSmsResponses); 711 destination.writeInt(mCapabilities); 712 destination.writeInt(mProperties); 713 destination.writeLong(mConnectTimeMillis); 714 Uri.writeToParcel(destination, mHandle); 715 destination.writeInt(mHandlePresentation); 716 destination.writeString(mCallerDisplayName); 717 destination.writeInt(mCallerDisplayNamePresentation); 718 destination.writeParcelable(mGatewayInfo, 0); 719 destination.writeParcelable(mAccountHandle, 0); 720 destination.writeByte((byte) (mIsVideoCallProviderChanged ? 1 : 0)); 721 destination.writeStrongBinder( 722 mVideoCallProvider != null ? mVideoCallProvider.asBinder() : null); 723 destination.writeString(mParentCallId); 724 destination.writeList(mChildCallIds); 725 destination.writeParcelable(mStatusHints, 0); 726 destination.writeInt(mVideoState); 727 destination.writeList(mConferenceableCallIds); 728 destination.writeBundle(mIntentExtras); 729 destination.writeBundle(mExtras); 730 destination.writeInt(mSupportedAudioRoutes); 731 destination.writeByte((byte) (mIsRttCallChanged ? 1 : 0)); 732 destination.writeParcelable(mRttCall, 0); 733 destination.writeLong(mCreationTimeMillis); 734 destination.writeInt(mCallDirection); 735 destination.writeInt(mCallerNumberVerificationStatus); 736 destination.writeString(mContactDisplayName); 737 destination.writeString(mActiveChildCallId); 738 } 739 740 @Override toString()741 public String toString() { 742 return String.format("[%s, parent:%s, children:%s]", mId, mParentCallId, mChildCallIds); 743 } 744 } 745