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