blob: 3937b08844ce30ef555ee9e80119166502649f5e [file] [log] [blame]
Santos Cordon3d3735e2014-01-29 14:10:10 -08001/*
2 * Copyright 2014, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.telecomm;
18
19/**
20 * Defines call-state constants of the different states in which a call can exist. Although states
21 * have the notion of normal transitions, due to the volatile nature of telephony systems, code
22 * that uses these states should be resilient to unexpected state changes outside of what is
23 * considered traditional.
24 */
Santos Cordon713f1d72014-01-29 19:56:10 -080025public enum CallState {
Santos Cordon3d3735e2014-01-29 14:10:10 -080026 /**
27 * Indicates that a call is new and not connected. This is used as the default state internally
Santos Cordon713f1d72014-01-29 19:56:10 -080028 * within Telecomm and should not be used between Telecomm and call services. Call services are
29 * not expected to ever interact with NEW calls so we keep this value hidden as a Telecomm
30 * internal-only value.
Santos Cordon3d3735e2014-01-29 14:10:10 -080031 * @hide
32 */
Santos Cordon713f1d72014-01-29 19:56:10 -080033 NEW,
Santos Cordon3d3735e2014-01-29 14:10:10 -080034
35 /**
36 * Indicates that a call is outgoing and in the dialing state. A call transitions to this state
37 * once an outgoing call has begun (e.g., user presses the dial button in Dialer). Calls in this
38 * state usually transition to {@link #ACTIVE} if the call was answered or {@link #DISCONNECTED}
39 * if the call was disconnected somehow (e.g., failure or cancellation of the call by the user).
40 */
Santos Cordon713f1d72014-01-29 19:56:10 -080041 DIALING,
Santos Cordon3d3735e2014-01-29 14:10:10 -080042
43 /**
44 * Indicates that a call is incoming and the user still has the option of answering, rejecting,
45 * or doing nothing with the call. This state is usually associated with some type of audible
46 * ringtone. Normal transitions are to {@link #ACTIVE} if answered or {@link #DISCONNECTED}
47 * otherwise.
48 */
Santos Cordon713f1d72014-01-29 19:56:10 -080049 RINGING,
Santos Cordon3d3735e2014-01-29 14:10:10 -080050
51 /**
52 * Indicates that a call is currently connected to another party and a communication channel is
53 * open between them. The normal transition to this state is by the user answering a
54 * {@link #DIALING} call or a {@link #RINGING} call being answered by the other party.
55 */
Santos Cordon713f1d72014-01-29 19:56:10 -080056 ACTIVE,
Santos Cordon3d3735e2014-01-29 14:10:10 -080057
58 /**
Yorke Lee81ccaaa2014-03-12 18:33:19 -070059 * Indicates that the call is currently on hold. In this state, the call is not terminated
60 * but no communication is allowed until the call is no longer on hold. The typical transition
61 * to this state is by the user putting an {@link #ACTIVE} call on hold by explicitly performing
62 * an action, such as clicking the hold button.
63 */
64 ON_HOLD,
65
66 /**
Santos Cordon3d3735e2014-01-29 14:10:10 -080067 * Indicates that a call is currently disconnected. All states can transition to this state
68 * by the call service giving notice that the connection has been severed. When the user
69 * explicitly ends a call, it will not transition to this state until the call service confirms
70 * the disconnection or communication was lost to the call service currently responsible for
71 * this call (e.g., call service crashes).
72 */
Ben Gilad6c874e32014-03-04 16:01:22 -080073 DISCONNECTED,
74
75 /**
76 * Indicates that the call was attempted (mostly in the context of outgoing, at least at the
77 * time of writing) but cancelled before it was successfully connected.
Ben Gilad3fadaa92014-03-04 16:40:58 -080078 * @hide
Ben Gilad6c874e32014-03-04 16:01:22 -080079 */
80 ABORTED;
Santos Cordon3d3735e2014-01-29 14:10:10 -080081}