| Santos Cordon | 3d3735e | 2014-01-29 14:10:10 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package 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 Cordon | 713f1d7 | 2014-01-29 19:56:10 -0800 | [diff] [blame] | 25 | public enum CallState { |
| Santos Cordon | 3d3735e | 2014-01-29 14:10:10 -0800 | [diff] [blame] | 26 | /** |
| 27 | * Indicates that a call is new and not connected. This is used as the default state internally |
| Santos Cordon | 713f1d7 | 2014-01-29 19:56:10 -0800 | [diff] [blame] | 28 | * 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 Cordon | 3d3735e | 2014-01-29 14:10:10 -0800 | [diff] [blame] | 31 | * @hide |
| 32 | */ |
| Santos Cordon | 713f1d7 | 2014-01-29 19:56:10 -0800 | [diff] [blame] | 33 | NEW, |
| Santos Cordon | 3d3735e | 2014-01-29 14:10:10 -0800 | [diff] [blame] | 34 | |
| 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 Cordon | 713f1d7 | 2014-01-29 19:56:10 -0800 | [diff] [blame] | 41 | DIALING, |
| Santos Cordon | 3d3735e | 2014-01-29 14:10:10 -0800 | [diff] [blame] | 42 | |
| 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 Cordon | 713f1d7 | 2014-01-29 19:56:10 -0800 | [diff] [blame] | 49 | RINGING, |
| Santos Cordon | 3d3735e | 2014-01-29 14:10:10 -0800 | [diff] [blame] | 50 | |
| 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 Cordon | 713f1d7 | 2014-01-29 19:56:10 -0800 | [diff] [blame] | 56 | ACTIVE, |
| Santos Cordon | 3d3735e | 2014-01-29 14:10:10 -0800 | [diff] [blame] | 57 | |
| 58 | /** |
| Yorke Lee | 81ccaaa | 2014-03-12 18:33:19 -0700 | [diff] [blame^] | 59 | * 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 Cordon | 3d3735e | 2014-01-29 14:10:10 -0800 | [diff] [blame] | 67 | * 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 Gilad | 6c874e3 | 2014-03-04 16:01:22 -0800 | [diff] [blame] | 73 | 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 Gilad | 3fadaa9 | 2014-03-04 16:40:58 -0800 | [diff] [blame] | 78 | * @hide |
| Ben Gilad | 6c874e3 | 2014-03-04 16:01:22 -0800 | [diff] [blame] | 79 | */ |
| 80 | ABORTED; |
| Santos Cordon | 3d3735e | 2014-01-29 14:10:10 -0800 | [diff] [blame] | 81 | } |