1 /* 2 * Copyright (C) 2018 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 com.android.incallui.call.state; 18 19 /** Defines different states of {@link com.android.incallui.call.DialerCall} */ 20 public class DialerCallState { 21 22 public static final int INVALID = 0; 23 public static final int NEW = 1; /* The call is new. */ 24 public static final int IDLE = 2; /* The call is idle. Nothing active */ 25 public static final int ACTIVE = 3; /* There is an active call */ 26 public static final int INCOMING = 4; /* A normal incoming phone call */ 27 public static final int CALL_WAITING = 5; /* Incoming call while another is active */ 28 public static final int DIALING = 6; /* An outgoing call during dial phase */ 29 public static final int REDIALING = 7; /* Subsequent dialing attempt after a failure */ 30 public static final int ONHOLD = 8; /* An active phone call placed on hold */ 31 public static final int DISCONNECTING = 9; /* A call is being ended. */ 32 public static final int DISCONNECTED = 10; /* State after a call disconnects */ 33 public static final int CONFERENCED = 11; /* DialerCall part of a conference call */ 34 public static final int SELECT_PHONE_ACCOUNT = 12; /* Waiting for account selection */ 35 public static final int CONNECTING = 13; /* Waiting for Telecom broadcast to finish */ 36 public static final int BLOCKED = 14; /* The number was found on the block list */ 37 public static final int PULLING = 15; /* An external call being pulled to the device */ 38 public static final int CALL_PENDING = 16; /* A call is pending on a long process to finish */ 39 isConnectingOrConnected(int state)40 public static boolean isConnectingOrConnected(int state) { 41 switch (state) { 42 case ACTIVE: 43 case INCOMING: 44 case CALL_WAITING: 45 case CONNECTING: 46 case DIALING: 47 case PULLING: 48 case REDIALING: 49 case ONHOLD: 50 case CONFERENCED: 51 return true; 52 default: 53 return false; 54 } 55 } 56 isDialing(int state)57 public static boolean isDialing(int state) { 58 return state == DIALING || state == PULLING || state == REDIALING; 59 } 60 toString(int state)61 public static String toString(int state) { 62 switch (state) { 63 case INVALID: 64 return "INVALID"; 65 case NEW: 66 return "NEW"; 67 case IDLE: 68 return "IDLE"; 69 case ACTIVE: 70 return "ACTIVE"; 71 case INCOMING: 72 return "INCOMING"; 73 case CALL_WAITING: 74 return "CALL_WAITING"; 75 case DIALING: 76 return "DIALING"; 77 case PULLING: 78 return "PULLING"; 79 case REDIALING: 80 return "REDIALING"; 81 case ONHOLD: 82 return "ONHOLD"; 83 case DISCONNECTING: 84 return "DISCONNECTING"; 85 case DISCONNECTED: 86 return "DISCONNECTED"; 87 case CONFERENCED: 88 return "CONFERENCED"; 89 case SELECT_PHONE_ACCOUNT: 90 return "SELECT_PHONE_ACCOUNT"; 91 case CONNECTING: 92 return "CONNECTING"; 93 case BLOCKED: 94 return "BLOCKED"; 95 default: 96 return "UNKNOWN"; 97 } 98 } 99 } 100