diff options
-rw-r--r-- | api/current.txt | 9 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/CallInfo.java | 35 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/CallState.java | 16 |
3 files changed, 40 insertions, 20 deletions
diff --git a/api/current.txt b/api/current.txt index 030d45c..355fb39 100644 --- a/api/current.txt +++ b/api/current.txt @@ -24173,8 +24173,13 @@ package android.speech.tts { package android.telecomm { - public final class CallState { - ctor public CallState(); + public final class CallState extends java.lang.Enum { + method public static android.telecomm.CallState valueOf(java.lang.String); + method public static final android.telecomm.CallState[] values(); + enum_constant public static final android.telecomm.CallState ACTIVE; + enum_constant public static final android.telecomm.CallState DIALING; + enum_constant public static final android.telecomm.CallState DISCONNECTED; + enum_constant public static final android.telecomm.CallState RINGING; } } diff --git a/telecomm/java/android/telecomm/CallInfo.java b/telecomm/java/android/telecomm/CallInfo.java index e96f3b4..2362061 100644 --- a/telecomm/java/android/telecomm/CallInfo.java +++ b/telecomm/java/android/telecomm/CallInfo.java @@ -31,15 +31,20 @@ import java.util.UUID; public final class CallInfo implements Parcelable { /** - * Endpoint to which the call is connected. - * This could be the dialed value for outgoing calls or the caller id of incoming calls. + * Unique identifier for the call as a UUID string. */ - private final String mHandle; + private final String mId; /** - * Unique identifier for the call as a UUID string. + * The state of the call. */ - private String mId; + private final CallState mState; + + /** + * Endpoint to which the call is connected. + * This could be the dialed value for outgoing calls or the caller id of incoming calls. + */ + private final String mHandle; // There are 4 timestamps that are important to a call: // 1) Created timestamp - The time at which the user explicitly chose to make the call. @@ -57,21 +62,27 @@ public final class CallInfo implements Parcelable { * Persists handle of the other party of this call. * * @param id The unique ID of the call. + * @param state The state of the call. * @param handle The handle to the other party in this call. */ - public CallInfo(String id, String handle) { + public CallInfo(String id, CallState state, String handle) { mId = id; + mState = state; mHandle = handle; } - public String getHandle() { - return mHandle; - } - public String getId() { return mId; } + public CallState getState() { + return mState; + } + + public String getHandle() { + return mHandle; + } + // // Parceling related code below here. // @@ -85,9 +96,10 @@ public final class CallInfo implements Parcelable { @Override public CallInfo createFromParcel(Parcel source) { String id = source.readString(); + CallState state = CallState.valueOf(source.readString()); String handle = source.readString(); - return new CallInfo(id, handle); + return new CallInfo(id, state, handle); } @Override @@ -110,6 +122,7 @@ public final class CallInfo implements Parcelable { @Override public void writeToParcel(Parcel destination, int flags) { destination.writeString(mId); + destination.writeString(mState.name()); destination.writeString(mHandle); } } diff --git a/telecomm/java/android/telecomm/CallState.java b/telecomm/java/android/telecomm/CallState.java index 5216c85..4f774cb 100644 --- a/telecomm/java/android/telecomm/CallState.java +++ b/telecomm/java/android/telecomm/CallState.java @@ -22,13 +22,15 @@ package android.telecomm; * that uses these states should be resilient to unexpected state changes outside of what is * considered traditional. */ -public final class CallState { +public enum CallState { /** * Indicates that a call is new and not connected. This is used as the default state internally - * within Telecomm and should not be used between Telecomm and call services. + * within Telecomm and should not be used between Telecomm and call services. Call services are + * not expected to ever interact with NEW calls so we keep this value hidden as a Telecomm + * internal-only value. * @hide */ - static final int NEW = 1; + NEW, /** * Indicates that a call is outgoing and in the dialing state. A call transitions to this state @@ -36,7 +38,7 @@ public final class CallState { * state usually transition to {@link #ACTIVE} if the call was answered or {@link #DISCONNECTED} * if the call was disconnected somehow (e.g., failure or cancellation of the call by the user). */ - static final int DIALING = 2; + DIALING, /** * Indicates that a call is incoming and the user still has the option of answering, rejecting, @@ -44,14 +46,14 @@ public final class CallState { * ringtone. Normal transitions are to {@link #ACTIVE} if answered or {@link #DISCONNECTED} * otherwise. */ - static final int RINGING = 3; + RINGING, /** * Indicates that a call is currently connected to another party and a communication channel is * open between them. The normal transition to this state is by the user answering a * {@link #DIALING} call or a {@link #RINGING} call being answered by the other party. */ - static final int ACTIVE = 4; + ACTIVE, /** * Indicates that a call is currently disconnected. All states can transition to this state @@ -60,5 +62,5 @@ public final class CallState { * the disconnection or communication was lost to the call service currently responsible for * this call (e.g., call service crashes). */ - static final int DISCONNECTED = 5; + DISCONNECTED; } |