DisconnectCausepublic final class DisconnectCause extends Object implements android.os.ParcelableDescribes 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. |
Fields Summary |
---|
public static final int | UNKNOWNDisconnected because of an unknown or unspecified reason. | public static final int | ERRORDisconnected because there was an error, such as a problem with the network. | public static final int | LOCALDisconnected because of a local user-initiated action, such as hanging up. | public static final int | REMOTEDisconnected because of a remote user-initiated action, such as the other party hanging up
up. | public static final int | CANCELEDDisconnected because it has been canceled. | public static final int | MISSEDDisconnected because there was no response to an incoming call. | public static final int | REJECTEDDisconnected because the user rejected an incoming call. | public static final int | BUSYDisconnected because the other party was busy. | public static final int | RESTRICTEDDisconnected because of a restriction on placing the call, such as dialing in airplane
mode. | public static final int | OTHERDisconnected for reason not described by other disconnect codes. | public static final int | CONNECTION_MANAGER_NOT_SUPPORTEDDisconnected 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.
this(code, null, null, null, ToneGenerator.TONE_UNKNOWN);
| public DisconnectCause(int code, String reason)Creates a new DisconnectCause.
this(code, null, null, reason, ToneGenerator.TONE_UNKNOWN);
| public DisconnectCause(int code, CharSequence label, CharSequence description, String reason)Creates a new DisconnectCause.
this(code, label, description, reason, ToneGenerator.TONE_UNKNOWN);
| public DisconnectCause(int code, CharSequence label, CharSequence description, String reason, int toneToPlay)Creates a new DisconnectCause.
mDisconnectCode = code;
mDisconnectLabel = label;
mDisconnectDescription = description;
mDisconnectReason = reason;
mToneToPlay = toneToPlay;
|
Methods Summary |
---|
public int | describeContents()
return 0;
| public boolean | equals(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 int | getCode()Returns the code for the reason for this disconnect.
return mDisconnectCode;
| public java.lang.CharSequence | getDescription()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 mDisconnectDescription;
| public java.lang.CharSequence | getLabel()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 mDisconnectLabel;
| public java.lang.String | getReason()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 mDisconnectReason;
| public int | getTone()Returns the tone to play when disconnected.
return mToneToPlay;
| public int | hashCode()
return Objects.hashCode(mDisconnectCode)
+ Objects.hashCode(mDisconnectLabel)
+ Objects.hashCode(mDisconnectDescription)
+ Objects.hashCode(mDisconnectReason)
+ Objects.hashCode(mToneToPlay);
| public java.lang.String | toString()
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 void | writeToParcel(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);
|
|