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
diff --git a/telecomm/java/android/telecom/ParcelableConnection.java b/telecomm/java/android/telecom/ParcelableConnection.java
index 63393b2..9004448 100644
--- a/telecomm/java/android/telecom/ParcelableConnection.java
+++ b/telecomm/java/android/telecom/ParcelableConnection.java
@@ -44,8 +44,7 @@
private final boolean mRingbackRequested;
private final boolean mIsVoipAudioMode;
private final StatusHints mStatusHints;
- private final int mDisconnectCause;
- private final String mDisconnectMessage;
+ private final DisconnectCause mDisconnectCause;
private final List<String> mConferenceableConnectionIds;
/** @hide */
@@ -62,8 +61,7 @@
boolean ringbackRequested,
boolean isVoipAudioMode,
StatusHints statusHints,
- int disconnectCause,
- String disconnectMessage,
+ DisconnectCause disconnectCause,
List<String> conferenceableConnectionIds) {
mPhoneAccount = phoneAccount;
mState = state;
@@ -78,7 +76,6 @@
mIsVoipAudioMode = isVoipAudioMode;
mStatusHints = statusHints;
mDisconnectCause = disconnectCause;
- mDisconnectMessage = disconnectMessage;
this.mConferenceableConnectionIds = conferenceableConnectionIds;
}
@@ -131,14 +128,10 @@
return mStatusHints;
}
- public final int getDisconnectCause() {
+ public final DisconnectCause getDisconnectCause() {
return mDisconnectCause;
}
- public final String getDisconnectMessage() {
- return mDisconnectMessage;
- }
-
public final List<String> getConferenceableConnectionIds() {
return mConferenceableConnectionIds;
}
@@ -174,8 +167,7 @@
boolean ringbackRequested = source.readByte() == 1;
boolean audioModeIsVoip = source.readByte() == 1;
StatusHints statusHints = source.readParcelable(classLoader);
- int disconnectCauseCode = source.readInt();
- String disconnectCauseMessage = source.readString();
+ DisconnectCause disconnectCause = source.readParcelable(classLoader);
List<String> conferenceableConnectionIds = new ArrayList<>();
source.readStringList(conferenceableConnectionIds);
@@ -192,8 +184,7 @@
ringbackRequested,
audioModeIsVoip,
statusHints,
- disconnectCauseCode,
- disconnectCauseMessage,
+ disconnectCause,
conferenceableConnectionIds);
}
@@ -225,8 +216,7 @@
destination.writeByte((byte) (mRingbackRequested ? 1 : 0));
destination.writeByte((byte) (mIsVoipAudioMode ? 1 : 0));
destination.writeParcelable(mStatusHints, 0);
- destination.writeInt(mDisconnectCause);
- destination.writeString(mDisconnectMessage);
+ destination.writeParcelable(mDisconnectCause, 0);
destination.writeStringList(mConferenceableConnectionIds);
}
}