FileDocCategorySizeDatePackage
DisconnectCause.javaAPI DocAndroid 5.1 API10147Thu Mar 12 22:22:42 GMT 2015android.telecom

DisconnectCause

public final class DisconnectCause extends Object implements android.os.Parcelable
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 {@link 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.
hide

Fields Summary
public static final int
UNKNOWN
Disconnected because of an unknown or unspecified reason.
public static final int
ERROR
Disconnected because there was an error, such as a problem with the network.
public static final int
LOCAL
Disconnected because of a local user-initiated action, such as hanging up.
public static final int
REMOTE
Disconnected because of a remote user-initiated action, such as the other party hanging up up.
public static final int
CANCELED
Disconnected because it has been canceled.
public static final int
MISSED
Disconnected because there was no response to an incoming call.
public static final int
REJECTED
Disconnected because the user rejected an incoming call.
public static final int
BUSY
Disconnected because the other party was busy.
public static final int
RESTRICTED
Disconnected because of a restriction on placing the call, such as dialing in airplane mode.
public static final int
OTHER
Disconnected for reason not described by other disconnect codes.
public static final int
CONNECTION_MANAGER_NOT_SUPPORTED
Disconnected because the connection manager did not support the call. The call will be tried again without a connection manager. See {@link PhoneAccount#CAPABILITY_CONNECTION_MANAGER}.
private int
mDisconnectCode
private CharSequence
mDisconnectLabel
private CharSequence
mDisconnectDescription
private String
mDisconnectReason
private int
mToneToPlay
public static final Creator
CREATOR
Constructors Summary
public DisconnectCause(int code)
Creates a new DisconnectCause.

param
code The code for the disconnect cause.


                     
       
        this(code, null, null, null, ToneGenerator.TONE_UNKNOWN);
    
public DisconnectCause(int code, String reason)
Creates a new DisconnectCause.

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

        this(code, null, null, reason, ToneGenerator.TONE_UNKNOWN);
    
public DisconnectCause(int code, CharSequence label, CharSequence description, String reason)
Creates a new DisconnectCause.

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

        this(code, label, description, reason, ToneGenerator.TONE_UNKNOWN);
    
public DisconnectCause(int code, CharSequence label, CharSequence description, String reason, int toneToPlay)
Creates a new DisconnectCause.

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

        mDisconnectCode = code;
        mDisconnectLabel = label;
        mDisconnectDescription = description;
        mDisconnectReason = reason;
        mToneToPlay = toneToPlay;
    
Methods Summary
public intdescribeContents()

        return 0;
    
public booleanequals(java.lang.Object o)

        if (o instanceof DisconnectCause) {
            DisconnectCause d = (DisconnectCause) o;
            return Objects.equals(mDisconnectCode, d.getCode())
                    && Objects.equals(mDisconnectLabel, d.getLabel())
                    && Objects.equals(mDisconnectDescription, d.getDescription())
                    && Objects.equals(mDisconnectReason, d.getReason())
                    && Objects.equals(mToneToPlay, d.getTone());
        }
        return false;
    
public intgetCode()
Returns the code for the reason for this disconnect.

return
The disconnect code.

        return mDisconnectCode;
    
public java.lang.CharSequencegetDescription()
Returns a description which explains the reason for the disconnect cause and is for display in the user interface. The {@link ConnectionService } is responsible for providing and localizing this message. If there is no string provided, returns null.

return
The disconnect description.

        return mDisconnectDescription;
    
public java.lang.CharSequencegetLabel()
Returns a short label which explains the reason for the disconnect cause and is for display in the user interface. The {@link ConnectionService } is responsible for providing and localizing this label. If there is no string provided, returns null.

return
The disconnect label.

        return mDisconnectLabel;
    
public java.lang.StringgetReason()
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
The disconnect reason.

        return mDisconnectReason;
    
public intgetTone()
Returns the tone to play when disconnected.

return
the tone as defined in {@link ToneGenerator} to play when disconnected.

        return mToneToPlay;
    
public inthashCode()

        return Objects.hashCode(mDisconnectCode)
                + Objects.hashCode(mDisconnectLabel)
                + Objects.hashCode(mDisconnectDescription)
                + Objects.hashCode(mDisconnectReason)
                + Objects.hashCode(mToneToPlay);
    
public java.lang.StringtoString()

        String code = "";
        switch (mDisconnectCode) {
            case UNKNOWN:
                code = "UNKNOWN";
                break;
            case ERROR:
                code = "ERROR";
                break;
            case LOCAL:
                code = "LOCAL";
                break;
            case REMOTE:
                code = "REMOTE";
                break;
            case CANCELED:
                code = "CANCELED";
                break;
            case MISSED:
                code = "MISSED";
                break;
            case REJECTED:
                code = "REJECTED";
                break;
            case BUSY:
                code = "BUSY";
                break;
            case RESTRICTED:
                code = "RESTRICTED";
                break;
            case OTHER:
                code = "OTHER";
                break;
            case CONNECTION_MANAGER_NOT_SUPPORTED:
                code = "CONNECTION_MANAGER_NOT_SUPPORTED";
                break;
            default:
                code = "invalid code: " + mDisconnectCode;
                break;
        }
        String label = mDisconnectLabel == null ? "" : mDisconnectLabel.toString();
        String description = mDisconnectDescription == null
                ? "" : mDisconnectDescription.toString();
        String reason = mDisconnectReason == null ? "" : mDisconnectReason;
        return "DisconnectCause [ Code: (" + code + ")"
                + " Label: (" + label + ")"
                + " Description: (" + description + ")"
                + " Reason: (" + reason + ")"
                + " Tone: (" + mToneToPlay + ") ]";
    
public voidwriteToParcel(android.os.Parcel destination, int flags)


    
          
        destination.writeInt(mDisconnectCode);
        TextUtils.writeToParcel(mDisconnectLabel, destination, flags);
        TextUtils.writeToParcel(mDisconnectDescription, destination, flags);
        destination.writeString(mDisconnectReason);
        destination.writeInt(mToneToPlay);