Added in API level 23

DisconnectCause


class DisconnectCause : Parcelable
kotlin.Any
   ↳ android.telecom.DisconnectCause

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
static Int

Disconnected because the user did not locally answer the incoming call, but it was answered on another device where the call was ringing.

static Int

Disconnected because the other party was busy.

static Int

Disconnected because the call was pulled from the current device to another device.

static Int

Disconnected because it has been canceled.

static Int

Disconnected because the connection manager did not support the call.

static Int

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

static Int

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

static Int

Disconnected because there was no response to an incoming call.

static Int

Disconnected for reason not described by other disconnect codes.

static String

This reason is set when a call is ended in order to place an emergency call when a PhoneAccount doesn't support holding an ongoing call to place an emergency call.

static String

Reason code (returned via getReason()), which indicates that the connection service is setting the call's state to Call.STATE_DISCONNECTED because it is internally changing the representation of an IMS conference call to simulate a single-party call.

static String

Reason code (returned via getReason()), which indicates that the call was disconnected because IMS access is blocked.

static String

Reason code (returned via getReason()) which indicates that a call could not be completed because the cellular radio is off or out of service, the device is connected to a wifi network, but the user has not enabled wifi calling.

static Int

Disconnected because the user rejected an incoming call.

static Int

Disconnected because the remote party hung up an ongoing call, or because an outgoing call was not answered by the remote party.

static Int

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

static Int

Disconnected because of an unknown or unspecified reason.

Inherited constants
Public constructors

Creates a new DisconnectCause.

DisconnectCause(code: Int, label: CharSequence!, description: CharSequence!, reason: String!)

Creates a new DisconnectCause.

DisconnectCause(code: Int, label: CharSequence!, description: CharSequence!, reason: String!, toneToPlay: Int)

Creates a new DisconnectCause.

DisconnectCause(code: Int, reason: String!)

Creates a new DisconnectCause.

Public methods
Int

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

Boolean
equals(other: Any?)

Indicates whether some other object is "equal to" this one.

Int

Returns the code for the reason for this disconnect.

CharSequence!

Returns a description which explains the reason for the disconnect cause and is for display in the user interface.

CharSequence!

Returns a short label which explains the reason for the disconnect cause and is for display in the user interface.

String!

Returns an explanation of the reason for the disconnect.

Int

Returns the tone to play when disconnected.

Int

Returns a hash code value for the object.

String

Returns a string representation of the object.

Unit
writeToParcel(destination: Parcel, flags: Int)

Flatten this object in to a Parcel.

Properties
static Parcelable.Creator<DisconnectCause!>

Constants

ANSWERED_ELSEWHERE

Added in API level 25
static val ANSWERED_ELSEWHERE: Int

Disconnected because the user did not locally answer the incoming call, but it was answered on another device where the call was ringing.

Value: 11

BUSY

Added in API level 23
static val BUSY: Int

Disconnected because the other party was busy.

Value: 7

CALL_PULLED

Added in API level 25
static val CALL_PULLED: Int

Disconnected because the call was pulled from the current device to another device.

Value: 12

CANCELED

Added in API level 23
static val CANCELED: Int

Disconnected because it has been canceled.

Value: 4

CONNECTION_MANAGER_NOT_SUPPORTED

Added in API level 23
static val CONNECTION_MANAGER_NOT_SUPPORTED: Int

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

Value: 10

ERROR

Added in API level 23
static val ERROR: Int

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

Value: 1

LOCAL

Added in API level 23
static val LOCAL: Int

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

Value: 2

MISSED

Added in API level 23
static val MISSED: Int

Disconnected because there was no response to an incoming call.

Value: 5

OTHER

Added in API level 23
static val OTHER: Int

Disconnected for reason not described by other disconnect codes.

Value: 9

REASON_EMERGENCY_CALL_PLACED

Added in API level 30
static val REASON_EMERGENCY_CALL_PLACED: String

This reason is set when a call is ended in order to place an emergency call when a PhoneAccount doesn't support holding an ongoing call to place an emergency call. This reason string should only be associated with the LOCAL disconnect code returned from getCode().

Value: "REASON_EMERGENCY_CALL_PLACED"

REASON_EMULATING_SINGLE_CALL

Added in API level 31
static val REASON_EMULATING_SINGLE_CALL: String

Reason code (returned via getReason()), which indicates that the connection service is setting the call's state to Call.STATE_DISCONNECTED because it is internally changing the representation of an IMS conference call to simulate a single-party call. This reason code is only used for communication between a ConnectionService and Telecom and should not be surfaced to the user.

Value: "EMULATING_SINGLE_CALL"

REASON_IMS_ACCESS_BLOCKED

Added in API level 31
static val REASON_IMS_ACCESS_BLOCKED: String

Reason code (returned via getReason()), which indicates that the call was disconnected because IMS access is blocked.

Value: "REASON_IMS_ACCESS_BLOCKED"

REASON_WIFI_ON_BUT_WFC_OFF

Added in API level 31
static val REASON_WIFI_ON_BUT_WFC_OFF: String

Reason code (returned via getReason()) which indicates that a call could not be completed because the cellular radio is off or out of service, the device is connected to a wifi network, but the user has not enabled wifi calling.

Value: "REASON_WIFI_ON_BUT_WFC_OFF"

REJECTED

Added in API level 23
static val REJECTED: Int

Disconnected because the user rejected an incoming call.

Value: 6

REMOTE

Added in API level 23
static val REMOTE: Int

Disconnected because the remote party hung up an ongoing call, or because an outgoing call was not answered by the remote party.

Value: 3

RESTRICTED

Added in API level 23
static val RESTRICTED: Int

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

Value: 8

UNKNOWN

Added in API level 23
static val UNKNOWN: Int

Disconnected because of an unknown or unspecified reason.

Value: 0

Public constructors

DisconnectCause

Added in API level 23
DisconnectCause(code: Int)

Creates a new DisconnectCause.

Parameters
code Int: The code for the disconnect cause.
Value is one of the following:

DisconnectCause

Added in API level 23
DisconnectCause(
    code: Int,
    label: CharSequence!,
    description: CharSequence!,
    reason: String!)

Creates a new DisconnectCause.

Parameters
code Int: The code for the disconnect cause.
Value is one of the following:
label CharSequence!: The localized label to show to the user to explain the disconnect.
description CharSequence!: The localized description to show to the user to explain the disconnect.
reason String!: The reason for the disconnect.

DisconnectCause

Added in API level 23
DisconnectCause(
    code: Int,
    label: CharSequence!,
    description: CharSequence!,
    reason: String!,
    toneToPlay: Int)

Creates a new DisconnectCause.

Parameters
code Int: The code for the disconnect cause.
Value is one of the following:
label CharSequence!: The localized label to show to the user to explain the disconnect.
description CharSequence!: The localized description to show to the user to explain the disconnect.
reason String!: The reason for the disconnect.
toneToPlay Int: The tone to play on disconnect, as defined in ToneGenerator.

DisconnectCause

Added in API level 23
DisconnectCause(
    code: Int,
    reason: String!)

Creates a new DisconnectCause.

Parameters
code Int: The code for the disconnect cause.
Value is one of the following:
reason String!: The reason for the disconnect.

Public methods

describeContents

Added in API level 23
fun describeContents(): Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel,int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

equals

Added in API level 23
fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj the reference object with which to compare.
Return
Boolean true if this object is the same as the obj argument; false otherwise.

getCode

Added in API level 23
fun getCode(): Int

Returns the code for the reason for this disconnect.

Return
Int The disconnect code.
Value is one of the following:

getDescription

Added in API level 23
fun getDescription(): CharSequence!

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.

Return
CharSequence! The disconnect description.

getLabel

Added in API level 23
fun getLabel(): CharSequence!

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.

Return
CharSequence! The disconnect label.

getReason

Added in API level 23
fun getReason(): String!

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

Return
String! The disconnect reason.

getTone

Added in API level 23
fun getTone(): Int

Returns the tone to play when disconnected.

Return
Int the tone as defined in ToneGenerator to play when disconnected.

hashCode

Added in API level 23
fun hashCode(): Int

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Return
Int a hash code value for this object.

toString

Added in API level 23
fun toString(): String

Returns a string representation of the object.

Return
String a string representation of the object.

writeToParcel

Added in API level 23
fun writeToParcel(
    destination: Parcel,
    flags: Int
): Unit

Flatten this object in to a Parcel.

Parameters
dest The Parcel in which the object should be written.
This value cannot be null.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.
Value is either 0 or a combination of the following:

Properties

CREATOR

Added in API level 23
static val CREATOR: Parcelable.Creator<DisconnectCause!>