diff options
author | Santos Cordon <santoscordon@google.com> | 2014-01-29 19:56:10 -0800 |
---|---|---|
committer | Evan Charlton <evanc@google.com> | 2014-02-20 15:14:13 -0800 |
commit | 713f1d7f213aece78a260b5b0bdee4c99205e75f (patch) | |
tree | ee71523c5153c206c888ea6f9f81400e68311ccf /telecomm | |
parent | 04c9f556c060e591e6502d2b0c65bf2c89f92398 (diff) | |
download | frameworks_base-713f1d7f213aece78a260b5b0bdee4c99205e75f.zip frameworks_base-713f1d7f213aece78a260b5b0bdee4c99205e75f.tar.gz frameworks_base-713f1d7f213aece78a260b5b0bdee4c99205e75f.tar.bz2 |
Change call state to enum and add it to CallInfo.
Change-Id: Ic88096aa6680245913e4d50da1ff7797813f8abc
Diffstat (limited to 'telecomm')
-rw-r--r-- | telecomm/java/android/telecomm/CallInfo.java | 35 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/CallState.java | 16 |
2 files changed, 33 insertions, 18 deletions
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; } |