CallControl
  public
  
  final
  
  class
  CallControl
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.telecom.CallControl | 
CallControl provides client side control of a call.  Each Call will get an individual CallControl
 instance in which the client can alter the state of the associated call.  Outgoing and incoming
 calls should move to active (via CallControl.setActive(Executor, OutcomeReceiver) or
 answered (via CallControl.answer(int, Executor, OutcomeReceiver) before 60 seconds.  If
 the new call is not moved to active or answered before 60 seconds, the call will be disconnected.
 
 Each method is Transactional meaning that it can succeed or fail. If a transaction succeeds,
 the OutcomeReceiver.onResult will be called by Telecom.  Otherwise, the
 OutcomeReceiver.onError is called and provides a CallException that details why
 the operation failed.
Summary
| Public methods | |
|---|---|
| 
        
        
        
        
        
        void | 
      answer(int videoState, Executor executor, OutcomeReceiver<Void, CallException> callback)
      Request Telecom answer an incoming call. | 
| 
        
        
        
        
        
        void | 
      disconnect(DisconnectCause disconnectCause, Executor executor, OutcomeReceiver<Void, CallException> callback)
      Request Telecom disconnect the call and remove the call from telecom tracking. | 
| 
        
        
        
        
        
        ParcelUuid | 
      getCallId()
       | 
| 
        
        
        
        
        
        void | 
      requestCallEndpointChange(CallEndpoint callEndpoint, Executor executor, OutcomeReceiver<Void, CallException> callback)
      Request a CallEndpoint change. | 
| 
        
        
        
        
        
        void | 
      requestMuteState(boolean isMuted, Executor executor, OutcomeReceiver<Void, CallException> callback)
      Request a new mute state. | 
| 
        
        
        
        
        
        void | 
      requestVideoState(int videoState, Executor executor, OutcomeReceiver<Void, CallException> callback)
      Request a new video state for the ongoing call. | 
| 
        
        
        
        
        
        void | 
      sendEvent(String event, Bundle extras)
      Raises an event to the  | 
| 
        
        
        
        
        
        void | 
      setActive(Executor executor, OutcomeReceiver<Void, CallException> callback)
      Request Telecom set the call state to active. | 
| 
        
        
        
        
        
        void | 
      setInactive(Executor executor, OutcomeReceiver<Void, CallException> callback)
      Request Telecom set the call state to inactive. | 
| 
        
        
        
        
        
        void | 
      startCallStreaming(Executor executor, OutcomeReceiver<Void, CallException> callback)
      Request start a call streaming session. | 
| Inherited methods | |
|---|---|
Public methods
answer
public void answer (int videoState, 
                Executor executor, 
                OutcomeReceiver<Void, CallException> callback)Request Telecom answer an incoming call.  For outgoing calls and calls that have been placed
 on hold, use CallControl.setActive(Executor, OutcomeReceiver).
| Parameters | |
|---|---|
| videoState | int: to report to Telecom. Telecom will store VideoState in the event another
                   service/device requests it in order to continue the call on another screen.
 Value isCallAttributes.AUDIO_CALL, orCallAttributes.VIDEO_CALL | 
| executor | Executor: TheExecutoron which theOutcomeReceivercallback
                   will be called on.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread.
 This value cannot benull. | 
| callback | OutcomeReceiver: that will be completed on the Telecom side that details success or failure
                   of the requested operation.OutcomeReceiver.onResultwill be called if Telecom has successfully
                   switched the call state to activeOutcomeReceiver.onErrorwill be called if Telecom has failed to set
                   the call state to active.  ACallExceptionwill be passed
                   that details why the operation failed.
 This value cannot benull. | 
disconnect
public void disconnect (DisconnectCause disconnectCause, Executor executor, OutcomeReceiver<Void, CallException> callback)
Request Telecom disconnect the call and remove the call from telecom tracking.
| Parameters | |
|---|---|
| disconnectCause | DisconnectCause: represents the cause for disconnecting the call.  The only valid
                        codes for theDisconnectCausepassed in are:
                        
 This value cannot benull. | 
| executor | Executor: TheExecutoron which theOutcomeReceivercallback
                        will be called on.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread.
 This value cannot benull. | 
| callback | OutcomeReceiver: That will be completed on the Telecom side that details success or
                        failure of the requested operation.OutcomeReceiver.onResultwill be called if Telecom has
                        successfully disconnected the call.OutcomeReceiver.onErrorwill be called if Telecom has failed
                        to disconnect the call.  ACallExceptionwill be passed
                        that details why the operation failed.
 Note: After the call has been successfully disconnected, calling any CallControl API will
 result in the  | 
getCallId
public ParcelUuid getCallId ()
| Returns | |
|---|---|
| ParcelUuid | the callId Telecom assigned to this CallControl object which should be attached to
 an individual call.
 This value cannot be null. | 
requestCallEndpointChange
public void requestCallEndpointChange (CallEndpoint callEndpoint, Executor executor, OutcomeReceiver<Void, CallException> callback)
Request a CallEndpoint change. Clients should not define their own CallEndpoint when
 requesting a change. Instead, the new endpoint should be one of the valid endpoints provided
 by CallEventCallback.onAvailableCallEndpointsChanged(List).
| Parameters | |
|---|---|
| callEndpoint | CallEndpoint: TheCallEndpointto change to.
 This value cannot benull. | 
| executor | Executor: TheExecutoron which theOutcomeReceivercallback
                     will be called on.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread.
 This value cannot benull. | 
| callback | OutcomeReceiver: TheOutcomeReceiverthat will be completed on the Telecom side
                     that details success or failure of the requested operation.OutcomeReceiver.onResultwill be called if Telecom has
                     successfully changed the CallEndpoint that was requested.OutcomeReceiver.onErrorwill be called if Telecom has failed to
                     switch to the requested CallEndpoint.  ACallExceptionwill be
                     passed that details why the operation failed.
 This value cannot benull. | 
requestMuteState
public void requestMuteState (boolean isMuted, 
                Executor executor, 
                OutcomeReceiver<Void, CallException> callback)Request a new mute state.  Note: CallEventCallback.onMuteStateChanged(boolean)
 will be called every time the mute state is changed and can be used to track the current
 mute state.
| Parameters | |
|---|---|
| isMuted | boolean: The new mute state.  Passing in aBoolean.TRUEfor the isMuted
                 parameter will mute the call.Boolean.FALSEwill unmute the call. | 
| executor | Executor: TheExecutoron which theOutcomeReceivercallback
                 will be called on.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread.
 This value cannot benull. | 
| callback | OutcomeReceiver: TheOutcomeReceiverthat will be completed on the Telecom side
                 that details success or failure of the requested operation.OutcomeReceiver.onResultwill be called if Telecom has
                 successfully changed the mute state.OutcomeReceiver.onErrorwill be called if Telecom has failed to
                 switch to the mute state.  ACallExceptionwill be
                 passed that details why the operation failed.
 This value cannot benull. | 
requestVideoState
public void requestVideoState (int videoState, 
                Executor executor, 
                OutcomeReceiver<Void, CallException> callback)Request a new video state for the ongoing call. This can only be changed if the application
 has registered a PhoneAccount with the
 PhoneAccount.CAPABILITY_SUPPORTS_VIDEO_CALLING and set the
 CallAttributes.SUPPORTS_VIDEO_CALLING when adding the call via
 TelecomManager.addCall(CallAttributes, Executor, OutcomeReceiver,
                                                      CallControlCallback, CallEventCallback)
| Parameters | |
|---|---|
| videoState | int: to report to Telecom. To see the valid argument to pass,
                   seeERROR(CallAttributes.CallType/android.telecom.CallAttributes.CallType CallAttributes.CallType).
 Value isCallAttributes.AUDIO_CALL, orCallAttributes.VIDEO_CALL | 
| executor | Executor: TheExecutoron which theOutcomeReceivercallback
                   will be called on.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread.
 This value cannot benull. | 
| callback | OutcomeReceiver: that will be completed on the Telecom side that details success or failure
                   of the requested operation.OutcomeReceiver.onResultwill be called if Telecom has successfully
                   switched the video state.OutcomeReceiver.onErrorwill be called if Telecom has failed to set
                   the new video state.  ACallExceptionwill be passed
                   that details why the operation failed.
 This value cannot benull. | 
| Throws | |
|---|---|
| IllegalArgumentException | if the argument passed for videoState is invalid.  To see a
 list of valid states, see ERROR(CallAttributes.CallType/android.telecom.CallAttributes.CallType CallAttributes.CallType). | 
sendEvent
public void sendEvent (String event, Bundle extras)
Raises an event to the InCallService implementations tracking this
 call via Call.Callback.onConnectionEvent(Call, String, Bundle).
 These events and the associated extra keys for the Bundle parameter are mutually
 defined by a VoIP application and InCallService. This API is used to
 relay additional information about a call other than what is specified in the
 CallAttributes to InCallServices. This might
 include, for example, a change to the list of participants in a meeting, or the name of the
 speakers who have their hand raised. Where appropriate, the InCallServices tracking
 this call may choose to render this additional information about the call. An automotive
 calling UX, for example may have enough screen real estate to indicate the number of
 participants in a meeting, but to prevent distractions could suppress the list of
 participants.
| Parameters | |
|---|---|
| event | String: a string event identifier agreed upon between a VoIP application and anInCallServiceThis value cannot benull. | 
| extras | Bundle: aBundlecontaining information about the event, as agreed
              upon between a VoIP application andInCallService.
 This value cannot benull. | 
setActive
public void setActive (Executor executor, OutcomeReceiver<Void, CallException> callback)
Request Telecom set the call state to active. This method should be called when either an
 outgoing call is ready to go active or a held call is ready to go active again. For incoming
 calls that are ready to be answered, use
 CallControl.answer(int, Executor, OutcomeReceiver).
| Parameters | |
|---|---|
| executor | Executor: TheExecutoron which theOutcomeReceivercallback
                 will be called on.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread.
 This value cannot benull. | 
| callback | OutcomeReceiver: that will be completed on the Telecom side that details success or failure
                 of the requested operation.OutcomeReceiver.onResultwill be called if Telecom has successfully
                 switched the call state to activeOutcomeReceiver.onErrorwill be called if Telecom has failed to set
                 the call state to active.  ACallExceptionwill be passed
                 that details why the operation failed.
 This value cannot benull. | 
setInactive
public void setInactive (Executor executor, OutcomeReceiver<Void, CallException> callback)
Request Telecom set the call state to inactive. This the same as hold for two call endpoints but can be extended to setting a meeting to inactive.
| Parameters | |
|---|---|
| executor | Executor: TheExecutoron which theOutcomeReceivercallback
                 will be called on.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread.
 This value cannot benull. | 
| callback | OutcomeReceiver: that will be completed on the Telecom side that details success or failure
                 of the requested operation.OutcomeReceiver.onResultwill be called if Telecom has successfully
                 switched the call state to inactiveOutcomeReceiver.onErrorwill be called if Telecom has failed to set
                 the call state to inactive.  ACallExceptionwill be passed
                 that details why the operation failed.
 This value cannot benull. | 
startCallStreaming
public void startCallStreaming (Executor executor, OutcomeReceiver<Void, CallException> callback)
Request start a call streaming session. On receiving valid request, telecom will bind to
 the CallStreamingService implemented by a general call streaming sender. So that the
 call streaming sender can perform streaming local device audio to another remote device and
 control the call during streaming.
| Parameters | |
|---|---|
| executor | Executor: TheExecutoron which theOutcomeReceivercallback
                 will be called on.
 Callback and listener events are dispatched through thisExecutor, providing an easy way to control which thread is
 used. To dispatch events through the main thread of your
 application, you can useContext.getMainExecutor().
 Otherwise, provide anExecutorthat dispatches to an appropriate thread.
 This value cannot benull. | 
| callback | OutcomeReceiver: that will be completed on the Telecom side that details success or failure
                 of the requested operation.OutcomeReceiver.onResultwill be called if Telecom has successfully
                 started the call streaming.OutcomeReceiver.onErrorwill be called if Telecom has failed to
                 start the call streaming. ACallExceptionwill be passed that
                 details why the operation failed.
 This value cannot benull. | 
