Android APIs
public final class

DisconnectCause

extends Object
implements Parcelable
java.lang.Object
   ↳ android.telecom.DisconnectCause

Class Overview

Describes the cause of a disconnected call. This always includes a code describing the generic cause of the disconnect. Optionally, it may include a label and/or description to display to the user. It is the responsibility of the ConnectionService to provide localized versions of the label and description. It also may contain a reason for the disconnect, which is intended for logging and not for display to the user.

Summary

Constants
int BUSY Disconnected because the other party was busy.
int CANCELED Disconnected because it has been canceled.
int CONNECTION_MANAGER_NOT_SUPPORTED Disconnected because the connection manager did not support the call.
int ERROR Disconnected because there was an error, such as a problem with the network.
int LOCAL Disconnected because of a local user-initiated action, such as hanging up.
int MISSED Disconnected because there was no response to an incoming call.
int OTHER Disconnected for reason not described by other disconnect codes.
int REJECTED Disconnected because the user rejected an incoming call.
int REMOTE Disconnected because of a remote user-initiated action, such as the other party hanging up up.
int RESTRICTED Disconnected because of a restriction on placing the call, such as dialing in airplane mode.
int UNKNOWN Disconnected because of an unknown or unspecified reason.
[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<DisconnectCause> CREATOR
Public Constructors
DisconnectCause(int code)
Creates a new DisconnectCause.
DisconnectCause(int code, String reason)
Creates a new DisconnectCause.
DisconnectCause(int code, CharSequence label, CharSequence description, String reason)
Creates a new DisconnectCause.
DisconnectCause(int code, CharSequence label, CharSequence description, String reason, int toneToPlay)
Creates a new DisconnectCause.
Public Methods
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
boolean equals(Object o)
Compares this instance with the specified object and indicates if they are equal.
int getCode()
Returns the code for the reason for this disconnect.
CharSequence getDescription()
Returns a description which explains the reason for the disconnect cause and is for display in the user interface.
CharSequence getLabel()
Returns a short label which explains the reason for the disconnect cause and is for display in the user interface.
String getReason()
Returns an explanation of the reason for the disconnect.
int getTone()
Returns the tone to play when disconnected.
int hashCode()
Returns an integer hash code for this object.
String toString()
Returns a string containing a concise, human-readable description of this object.
void writeToParcel(Parcel destination, int flags)
Flatten this object in to a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final int BUSY

Added in API level 23

Disconnected because the other party was busy.

Constant Value: 7 (0x00000007)

public static final int CANCELED

Added in API level 23

Disconnected because it has been canceled.

Constant Value: 4 (0x00000004)

public static final int CONNECTION_MANAGER_NOT_SUPPORTED

Added in API level 23

Disconnected because the connection manager did not support the call. The call will be tried again without a connection manager. See CAPABILITY_CONNECTION_MANAGER.

Constant Value: 10 (0x0000000a)

public static final int ERROR

Added in API level 23

Disconnected because there was an error, such as a problem with the network.

Constant Value: 1 (0x00000001)

public static final int LOCAL

Added in API level 23

Disconnected because of a local user-initiated action, such as hanging up.

Constant Value: 2 (0x00000002)

public static final int MISSED

Added in API level 23

Disconnected because there was no response to an incoming call.

Constant Value: 5 (0x00000005)

public static final int OTHER

Added in API level 23

Disconnected for reason not described by other disconnect codes.

Constant Value: 9 (0x00000009)

public static final int REJECTED

Added in API level 23

Disconnected because the user rejected an incoming call.

Constant Value: 6 (0x00000006)

public static final int REMOTE

Added in API level 23

Disconnected because of a remote user-initiated action, such as the other party hanging up up.

Constant Value: 3 (0x00000003)

public static final int RESTRICTED

Added in API level 23

Disconnected because of a restriction on placing the call, such as dialing in airplane mode.

Constant Value: 8 (0x00000008)

public static final int UNKNOWN

Added in API level 23

Disconnected because of an unknown or unspecified reason.

Constant Value: 0 (0x00000000)

Fields

public static final Creator<DisconnectCause> CREATOR

Added in API level 23

Public Constructors

public DisconnectCause (int code)

Added in API level 23

Creates a new DisconnectCause.

Parameters
code The code for the disconnect cause.

public DisconnectCause (int code, String reason)

Added in API level 23

Creates a new DisconnectCause.

Parameters
code The code for the disconnect cause.
reason The reason for the disconnect.

public DisconnectCause (int code, CharSequence label, CharSequence description, String reason)

Added in API level 23

Creates a new DisconnectCause.

Parameters
code The code for the disconnect cause.
label The localized label to show to the user to explain the disconnect.
description The localized description to show to the user to explain the disconnect.
reason The reason for the disconnect.

public DisconnectCause (int code, CharSequence label, CharSequence description, String reason, int toneToPlay)

Added in API level 23

Creates a new DisconnectCause.

Parameters
code The code for the disconnect cause.
label The localized label to show to the user to explain the disconnect.
description The localized description to show to the user to explain the disconnect.
reason The reason for the disconnect.
toneToPlay The tone to play on disconnect, as defined in ToneGenerator.

Public Methods

public int describeContents ()

Added in API level 23

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public boolean equals (Object o)

Added in API level 23

Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.

The default implementation returns true only if this == o. See Writing a correct equals method if you intend implementing your own equals method.

The general contract for the equals and hashCode() methods is that if equals returns true for any two objects, then hashCode() must return the same value for these objects. This means that subclasses of Object usually override either both methods or neither of them.

Parameters
o the object to compare this instance with.
Returns
  • true if the specified object is equal to this Object; false otherwise.

public int getCode ()

Added in API level 23

Returns the code for the reason for this disconnect.

Returns
  • The disconnect code.

public CharSequence getDescription ()

Added in API level 23

Returns a description which explains the reason for the disconnect cause and is for display in the user interface. This optional text is generally a longer and more descriptive version of getLabel(), however it can exist even if getLabel() is empty. The In-Call UI should display this relatively prominently; the traditional implementation displays this as an alert dialog. The ConnectionService is responsible for providing and localizing this message. If there is no string provided, returns null.

Returns
  • The disconnect description.

public CharSequence getLabel ()

Added in API level 23

Returns a short label which explains the reason for the disconnect cause and is for display in the user interface. If not null, it is expected that the In-Call UI should display this text where it would normally display the call state ("Dialing", "Disconnected") and is therefore expected to be relatively small. The ConnectionService is responsible for providing and localizing this label. If there is no string provided, returns null.

Returns
  • The disconnect label.

public String getReason ()

Added in API level 23

Returns an explanation of the reason for the disconnect. This is not intended for display to the user and is used mainly for logging.

Returns
  • The disconnect reason.

public int getTone ()

Added in API level 23

Returns the tone to play when disconnected.

Returns

public int hashCode ()

Added in API level 23

Returns an integer hash code for this object. By contract, any two objects for which equals(Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

Note that hash values must not change over time unless information used in equals comparisons also changes.

See Writing a correct hashCode method if you intend implementing your own hashCode method.

Returns
  • this object's hash code.

public String toString ()

Added in API level 23

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.

public void writeToParcel (Parcel destination, int flags)

Added in API level 23

Flatten this object in to a Parcel.

Parameters
destination The Parcel in which the object should be written.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.