summaryrefslogtreecommitdiffstats
path: root/telecomm/java/android/telecom/Connection.java
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2014-09-11 17:33:16 -0700
committerAndrew Lee <anwlee@google.com>2014-09-16 12:07:41 -0700
commit7f3d41fd124dd7c4a8b72c1d48df08a8ee7209ec (patch)
tree5f90ef2d188ec564b16fd79936b5a19c7ea27395 /telecomm/java/android/telecom/Connection.java
parentb37b7ae137d09e21ed9b57415960ae1b975bdc0f (diff)
downloadframeworks_base-7f3d41fd124dd7c4a8b72c1d48df08a8ee7209ec.zip
frameworks_base-7f3d41fd124dd7c4a8b72c1d48df08a8ee7209ec.tar.gz
frameworks_base-7f3d41fd124dd7c4a8b72c1d48df08a8ee7209ec.tar.bz2
Add new DisconnectCause class to telecomm.
+ Add a hidden "UNKNOWN" default type to ToneGenerator. - Hide the Telephony DisconnectCause from the public API. + Add a Telecomm DisconnectCause. This is parcelable, and contains information (code, user facing message, non-user facing reason, and tone) to help describe the disconnect state and what behaviors an application can implement for the user experience. This reduces the causes for a disconnect to a more generic set. + Lots of work to pipe this through. DisconnectCause replaces the code and message which were formerly passed around. Bug: 17241433 Bug: 17329632 Change-Id: I9d337e478a8784bcc0ade02267c2df52cac9bf17
Diffstat (limited to 'telecomm/java/android/telecom/Connection.java')
-rw-r--r--telecomm/java/android/telecom/Connection.java45
1 files changed, 16 insertions, 29 deletions
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index 5f63af3..76348ec 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -24,7 +24,6 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
-import android.telephony.DisconnectCause;
import android.view.Surface;
import java.util.ArrayList;
@@ -71,7 +70,7 @@ public abstract class Connection {
public void onCallerDisplayNameChanged(
Connection c, String callerDisplayName, int presentation) {}
public void onVideoStateChanged(Connection c, int videoState) {}
- public void onDisconnected(Connection c, int cause, String message) {}
+ public void onDisconnected(Connection c, DisconnectCause disconnectCause) {}
public void onPostDialWait(Connection c, String remaining) {}
public void onRingbackRequested(Connection c, boolean ringback) {}
public void onDestroyed(Connection c) {}
@@ -473,8 +472,7 @@ public abstract class Connection {
private boolean mAudioModeIsVoip;
private StatusHints mStatusHints;
private int mVideoState;
- private int mDisconnectCause;
- private String mDisconnectMessage;
+ private DisconnectCause mDisconnectCause;
private Conference mConference;
private ConnectionService mConnectionService;
@@ -604,18 +602,11 @@ public abstract class Connection {
/**
* @return The {@link DisconnectCause} for this connection.
*/
- public final int getDisconnectCause() {
+ public final DisconnectCause getDisconnectCause() {
return mDisconnectCause;
}
/**
- * @return The disconnect message for this connection.
- */
- public final String getDisconnectMessage() {
- return mDisconnectMessage;
- }
-
- /**
* Inform this Connection that the state of its audio output has been changed externally.
*
* @param state The new audio state.
@@ -774,17 +765,15 @@ public abstract class Connection {
/**
* Sets state to disconnected.
*
- * @param cause The reason for the disconnection, any of
+ * @param disconnectCause The reason for the disconnection, as specified by
* {@link DisconnectCause}.
- * @param message Optional call-service-provided message about the disconnect.
*/
- public final void setDisconnected(int cause, String message) {
- mDisconnectCause = cause;
- mDisconnectMessage = message;
+ public final void setDisconnected(DisconnectCause disconnectCause) {
+ mDisconnectCause = disconnectCause;
setState(STATE_DISCONNECTED);
- Log.d(this, "Disconnected with cause %d message %s", cause, message);
+ Log.d(this, "Disconnected with cause %d message %s", disconnectCause);
for (Listener l : mListeners) {
- l.onDisconnected(this, cause, message);
+ l.onDisconnected(this, disconnectCause);
}
}
@@ -1071,26 +1060,24 @@ public abstract class Connection {
}
private static class FailureSignalingConnection extends Connection {
- public FailureSignalingConnection(int cause, String message) {
- setDisconnected(cause, message);
+ public FailureSignalingConnection(DisconnectCause disconnectCause) {
+ setDisconnected(disconnectCause);
}
}
/**
* Return a {@code Connection} which represents a failed connection attempt. The returned
- * {@code Connection} will have a {@link #getDisconnectCause()} and
- * {@link #getDisconnectMessage()} as specified, and a {@link #getState()} of
- * {@link #STATE_DISCONNECTED}.
+ * {@code Connection} will have a {@link android.telecom.DisconnectCause} and as specified,
+ * and a {@link #getState()} of {@link #STATE_DISCONNECTED}.
* <p>
* The returned {@code Connection} can be assumed to {@link #destroy()} itself when appropriate,
* so users of this method need not maintain a reference to its return value to destroy it.
*
- * @param cause The disconnect cause, ({@see DisconnectCause}).
- * @param message A reason for why the connection failed (not intended to be shown to the user).
+ * @param disconnectCause The disconnect cause, ({@see android.telecomm.DisconnectCause}).
* @return A {@code Connection} which indicates failure.
*/
- public static Connection createFailedConnection(int cause, String message) {
- return new FailureSignalingConnection(cause, message);
+ public static Connection createFailedConnection(DisconnectCause disconnectCause) {
+ return new FailureSignalingConnection(disconnectCause);
}
/**
@@ -1105,7 +1092,7 @@ public abstract class Connection {
* @return A {@code Connection} which indicates that the underlying call should be canceled.
*/
public static Connection createCanceledConnection() {
- return new FailureSignalingConnection(DisconnectCause.OUTGOING_CANCELED, null);
+ return new FailureSignalingConnection(new DisconnectCause(DisconnectCause.CANCELED));
}
private final void fireOnConferenceableConnectionsChanged() {