public abstract class Connection extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Connection.Capability
Capabilities that will be mapped to telecom connection
capabilities.
|
static interface |
Connection.Listener
Listener interface for events related to the connection which should be reported to the
Connection . |
static class |
Connection.ListenerBase
Base listener implementation.
|
static interface |
Connection.PostDialListener |
static class |
Connection.PostDialState |
Modifier and Type | Field and Description |
---|---|
static int |
AUDIO_QUALITY_HIGH_DEFINITION |
static int |
AUDIO_QUALITY_STANDARD |
protected String |
mAddress |
protected int |
mCause |
protected String |
mCnapName |
protected int |
mCnapNamePresentation |
protected long |
mConnectTime |
protected long |
mConnectTimeReal |
protected String |
mConvertedNumber |
protected long |
mCreateTime |
protected String |
mDialString |
protected long |
mDuration |
protected long |
mHoldingStartTime |
protected boolean |
mIsIncoming |
Set<Connection.Listener> |
mListeners |
protected int |
mNextPostDialChar |
protected boolean |
mNumberConverted |
protected int |
mNumberPresentation |
protected Connection |
mOrigConnection |
protected Connection.PostDialState |
mPostDialState |
protected String |
mPostDialString |
Call.State |
mPreHandoverState |
Modifier | Constructor and Description |
---|---|
protected |
Connection(int phoneType) |
Modifier and Type | Method and Description |
---|---|
static int |
addCapability(int capabilities,
int capability)
Applies a capability to a capabilities bit-mask.
|
void |
addListener(Connection.Listener listener)
Assign a listener to be notified of state changes.
|
void |
addPostDialListener(Connection.PostDialListener listener) |
abstract void |
cancelPostDial()
Cancel any post
|
protected void |
clearPostDialListeners() |
void |
clearUserData() |
String |
getAddress()
Gets address (e.g. phone number) associated with connection.
|
int |
getAudioQuality()
Returns the audio-quality for the connection.
|
abstract Call |
getCall() |
int |
getCallSubstate()
Returns the current call substate of the connection.
|
String |
getCnapName()
Gets CNAP name associated with connection.
|
int |
getCnapNamePresentation()
Gets CNAP presentation associated with connection.
|
List<ConferenceParticipant> |
getConferenceParticipants()
Get the details of conference participants.
|
int |
getConnectionCapabilities()
Called to get Connection capabilities.Returns Capabilities bitmask.
|
Bundle |
getConnectionExtras()
Retrieves the current connection extras.
|
long |
getConnectTime()
Connection connect time in currentTimeMillis() format.
|
long |
getConnectTimeReal()
Connection connect time in elapsedRealtime() format.
|
long |
getCreateTime()
Connection create time in currentTimeMillis() format
Basically, set when object is created.
|
int |
getDisconnectCause()
Returns call disconnect cause.
|
abstract long |
getDisconnectTime()
Disconnect time in currentTimeMillis() format.
|
long |
getDurationMillis()
Returns the number of milliseconds the call has been connected,
or 0 if the call has never connected.
|
abstract long |
getHoldDurationMillis()
If this connection is HOLDING, return the number of milliseconds
that it has been on hold for (approximately).
|
long |
getHoldingStartTime()
The time when this Connection last transitioned into HOLDING
in elapsedRealtime() format.
|
abstract int |
getNumberPresentation()
Returns the caller id presentation type for incoming and waiting calls
|
Connection |
getOrigConnection()
Returns the original Connection instance associated with
this Connection
|
String |
getOrigDialString()
Get original dial string.
|
int |
getPhoneType() |
Connection.PostDialState |
getPostDialState() |
abstract int |
getPreciseDisconnectCause()
Returns the CallFail reason provided by the RIL with the result of
RIL_REQUEST_LAST_CALL_FAIL_CAUSE
|
int |
getPulledDialogId() |
String |
getRemainingPostDialString()
Returns the portion of the post dial string that has not
yet been dialed, or "" if none
|
Call.State |
getState()
If this Connection is connected, then it is associated with
a Call.
|
Call.State |
getStateBeforeHandover()
If this connection went through handover return the state of the
call that contained this connection before handover.
|
String |
getTelecomCallId() |
Object |
getUserData() |
abstract UUSInfo |
getUUSInfo()
Returns the User to User Signaling (UUS) information associated with
incoming and waiting calls
|
abstract String |
getVendorDisconnectCause()
Returns a string disconnect cause which is from vendor.
|
Connection.VideoProvider |
getVideoProvider()
Returns the
Connection.VideoProvider for the connection. |
int |
getVideoState()
Returns the current video state of the connection.
|
abstract void |
hangup()
Hangup individual Connection
|
boolean |
hasCapabilities(int connectionCapabilities) |
boolean |
isActiveCallDisconnectedOnAnswer() |
boolean |
isAlive()
isAlive()
|
boolean |
isConferenceHost()
Applicable only for IMS Call.
|
boolean |
isIncoming()
Returns true of this connection originated elsewhere
("MT" or mobile terminated; another party called this terminal)
or false if this call originated here (MO or mobile originated).
|
boolean |
isMemberOfPeerConference()
Applicable only for IMS Call.
|
abstract boolean |
isMultiparty()
Returns whether the original ImsPhoneConnection was a member
of a conference call
|
boolean |
isPulledCall() |
boolean |
isRinging()
Returns true if Connection is connected and is INCOMING or WAITING
|
boolean |
isWifi()
Returns whether the connection is using a wifi network.
|
void |
migrateFrom(Connection c) |
protected void |
notifyPostDialListeners() |
protected void |
notifyPostDialListenersNextChar(char c) |
void |
onCallPullFailed(Connection externalConnection)
Notifies the connection that a call to
pullExternalCall() has failed to pull the
call to the local device. |
void |
onConferenceMergeFailed()
Notifies listeners of a failure in merging this connection with the background connection.
|
void |
onConnectionEvent(String event,
Bundle extras)
Notifies the connection of a connection event.
|
boolean |
onDisconnect(int cause)
Called when the connection has been disconnected
|
void |
onDisconnectConferenceParticipant(Uri endpoint)
Notifies this Connection of a request to disconnect a participant of the conference managed
by the connection.
|
void |
onExitedEcmMode()
Notifies that the underlying phone has exited ECM mode.
|
void |
onHandoverToWifiFailed()
Notifies the connection that there was a failure while handing over to WIFI.
|
abstract void |
proceedAfterWaitChar()
See Phone.setOnPostDialWaitCharacter()
|
abstract void |
proceedAfterWildChar(String str)
See Phone.setOnPostDialWildCharacter()
|
void |
pullExternalCall()
Called by a
Connection to indicate that this call should be pulled
to the local device. |
static int |
removeCapability(int capabilities,
int capability)
Removes a capability to a capabilities bit-mask.
|
void |
removeListener(Connection.Listener listener)
Removes a listener.
|
void |
removePostDialListener(Connection.PostDialListener listener) |
abstract void |
separate()
Separate this call from its owner Call and assigns it to a new Call
(eg if it is currently part of a Conference call
TODO: Throw exception?
|
void |
setActiveCallDisconnectedOnAnswer(boolean answeringDisconnectsActiveCall)
Sets whether answering this call will cause the active call to be disconnected.
|
void |
setAllowAddCallDuringVideoCall(boolean allowAddCallDuringVideoCall) |
void |
setAudioQuality(int audioQuality)
Set the audio quality for the connection.
|
void |
setCallSubstate(int callSubstate)
Sets the call substate for the current connection and reports the changes to all listeners.
|
void |
setConnectionCapabilities(int capabilities)
Called to set Connection capabilities.
|
void |
setConnectionExtras(Bundle extras)
Notifies listeners that connection extras has changed.
|
void |
setConnectTime(long connectTime)
Sets the Connection connect time in currentTimeMillis() format.
|
void |
setConverted(String oriNumber) |
void |
setIsPulledCall(boolean isPulledCall)
Sets whether the connection is the result of an external call which was pulled to the local
device.
|
void |
setPulledDialogId(int pulledDialogId)
For an external call which is being pulled (e.g.
|
void |
setTelecomCallId(String telecomCallId)
Sets the telecom call ID associated with this connection.
|
void |
setUserData(Object userdata) |
void |
setVideoProvider(Connection.VideoProvider videoProvider)
Sets the
Connection.VideoProvider for the connection. |
void |
setVideoState(int videoState)
Sets the videoState for the current connection and reports the changes to all listeners.
|
void |
setWifi(boolean isWifi)
Sets whether a wifi network is used for the connection.
|
boolean |
shouldAllowAddCallDuringVideoCall() |
String |
toString()
Build a human representation of a connection instance, suitable for debugging.
|
void |
updateConferenceParticipants(List<ConferenceParticipant> conferenceParticipants)
Notifies listeners of a change to conference participant(s).
|
void |
updateMultipartyState(boolean isMultiparty)
Notifies listeners of a change to the multiparty state of the connection.
|
public static final int AUDIO_QUALITY_STANDARD
public static final int AUDIO_QUALITY_HIGH_DEFINITION
protected String mCnapName
protected int mCnapNamePresentation
protected String mAddress
protected String mDialString
protected int mNumberPresentation
protected boolean mIsIncoming
protected long mCreateTime
protected long mConnectTime
protected long mConnectTimeReal
protected long mDuration
protected long mHoldingStartTime
protected Connection mOrigConnection
public Set<Connection.Listener> mListeners
protected boolean mNumberConverted
protected String mConvertedNumber
protected String mPostDialString
protected int mNextPostDialChar
protected int mCause
protected Connection.PostDialState mPostDialState
public Call.State mPreHandoverState
public String getTelecomCallId()
public void setTelecomCallId(String telecomCallId)
telecomCallId
- The telecom call ID.public String getAddress()
public String getCnapName()
public String getOrigDialString()
public int getCnapNamePresentation()
public abstract Call getCall()
public long getCreateTime()
public long getConnectTime()
public void setConnectTime(long connectTime)
connectTime
- the new connect time.public long getConnectTimeReal()
public abstract long getDisconnectTime()
public long getDurationMillis()
public long getHoldingStartTime()
public abstract long getHoldDurationMillis()
public int getDisconnectCause()
DisconnectCause
. If the call is not yet
disconnected, NOT_DISCONNECTED is returned.public abstract String getVendorDisconnectCause()
public boolean isIncoming()
public Call.State getState()
public Call.State getStateBeforeHandover()
public List<ConferenceParticipant> getConferenceParticipants()
public boolean isAlive()
public boolean isRinging()
public Object getUserData()
public void setUserData(Object userdata)
userdata
- user can store an any userdata in the Connection object.public abstract void hangup() throws CallStateException
CallStateException
public abstract void separate() throws CallStateException
CallStateException
public void clearUserData()
public final void addPostDialListener(Connection.PostDialListener listener)
public final void removePostDialListener(Connection.PostDialListener listener)
protected final void clearPostDialListeners()
protected final void notifyPostDialListeners()
protected final void notifyPostDialListenersNextChar(char c)
public Connection.PostDialState getPostDialState()
public String getRemainingPostDialString()
public abstract void proceedAfterWaitChar()
public abstract void proceedAfterWildChar(String str)
public abstract void cancelPostDial()
public boolean onDisconnect(int cause)
public abstract int getNumberPresentation()
public abstract UUSInfo getUUSInfo()
public abstract int getPreciseDisconnectCause()
public Connection getOrigConnection()
public abstract boolean isMultiparty()
public boolean isConferenceHost()
#isConferenceHost()
is true
), or if it is a member of a conference
hosted on another device.true
if this call is the origin of the conference call it is a member of,
false
otherwise.public boolean isMemberOfPeerConference()
true
if the connection is a member of a conference hosted on another device.public void migrateFrom(Connection c)
public final void addListener(Connection.Listener listener)
listener
- A listener.public final void removeListener(Connection.Listener listener)
listener
- A listener.public int getVideoState()
public int getConnectionCapabilities()
public boolean hasCapabilities(int connectionCapabilities)
public static int addCapability(int capabilities, int capability)
capabilities
- The capabilities bit-mask.capability
- The capability to apply.public static int removeCapability(int capabilities, int capability)
capabilities
- The capabilities bit-mask.capability
- The capability to remove.public boolean isWifi()
True
if the connection is using a wifi network.public Connection.VideoProvider getVideoProvider()
Connection.VideoProvider
for the connection.Connection.VideoProvider
.public int getAudioQuality()
public int getCallSubstate()
public void setVideoState(int videoState)
VideoProfile
.public void setConnectionCapabilities(int capabilities)
capabilities
- The Capabilities bitmask.public void setWifi(boolean isWifi)
isWifi
- True
if wifi is being used.public void setAudioQuality(int audioQuality)
audioQuality
- The audio quality.public void setConnectionExtras(Bundle extras)
extras
- New connection extras. This Bundle will be cloned to ensure that any concurrent
modifications to the extras Bundle do not affect Bundle operations in the onExtrasChanged
listeners.public Bundle getConnectionExtras()
public boolean isActiveCallDisconnectedOnAnswer()
true
if answering the call will cause the current active call to be
disconnected, false
otherwise.public void setActiveCallDisconnectedOnAnswer(boolean answeringDisconnectsActiveCall)
Should only be set true
if there is an active call and this call is ringing.
answeringDisconnectsActiveCall
- true
if answering the call will call the active
call to be disconnected.public boolean shouldAllowAddCallDuringVideoCall()
public void setAllowAddCallDuringVideoCall(boolean allowAddCallDuringVideoCall)
public void setIsPulledCall(boolean isPulledCall)
isPulledCall
- true
if this connection is the result of pulling an external call
to the local device.public boolean isPulledCall()
public void setPulledDialogId(int pulledDialogId)
isPulledCall()
is true
),
sets the dialog Id for the external call. Used to handle failures to pull a call so that the
pulled call can be reconciled with its original external connection.pulledDialogId
- The dialog id associated with a pulled call.public int getPulledDialogId()
public void setCallSubstate(int callSubstate)
Connection
.public void setVideoProvider(Connection.VideoProvider videoProvider)
Connection.VideoProvider
for the connection.videoProvider
- The video call provider.public void setConverted(String oriNumber)
public void updateConferenceParticipants(List<ConferenceParticipant> conferenceParticipants)
conferenceParticipants
- The participant(s).public void updateMultipartyState(boolean isMultiparty)
isMultiparty
- The participant(s).public void onConferenceMergeFailed()
public void onExitedEcmMode()
public void onCallPullFailed(Connection externalConnection)
pullExternalCall()
has failed to pull the
call to the local device.externalConnection
- The original
ImsExternalConnection
from which the
pull was initiated.public void onHandoverToWifiFailed()
public void onConnectionEvent(String event, Bundle extras)
public void onDisconnectConferenceParticipant(Uri endpoint)
endpoint
- the Uri
of the participant to disconnect.public void pullExternalCall()
Connection
to indicate that this call should be pulled
to the local device.public int getPhoneType()