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