1 /* 2 * Copyright (C) 2022 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.server.telecom.stats; 18 19 /** 20 * Indicating the failure reason why a new call cannot be made. 21 * The codes are synced with CallFailureCauseEnum defined in enums.proto. 22 */ 23 public enum CallFailureCause { 24 /** The call is normally started. */ 25 NONE(0), 26 /** Necessary parameters are invalid or null. */ 27 INVALID_USE(1), 28 /** There is an emergency call ongoing. */ 29 IN_EMERGENCY_CALL(2), 30 /** There is an live call that cannot be held. */ 31 CANNOT_HOLD_CALL(3), 32 /** There are maximum number of outgoing calls already. */ 33 MAX_OUTGOING_CALLS(4), 34 /** There are maximum number of ringing calls already. */ 35 MAX_RINGING_CALLS(5), 36 /** There are maximum number of calls in hold already. */ 37 MAX_HOLD_CALLS(6), 38 /* There are maximum number of self-managed calls already. */ 39 MAX_SELF_MANAGED_CALLS(7); 40 41 private final int mCode; 42 43 /** 44 * Creates a new CallFailureCause. 45 * 46 * @param code The code for the failure cause. 47 */ CallFailureCause(int code)48 CallFailureCause(int code) { 49 mCode = code; 50 } 51 52 /** 53 * Returns the code for the failure. 54 * 55 * @return The code for the failure cause. 56 */ getCode()57 public int getCode() { 58 return mCode; 59 } 60 61 /** 62 * Check if this enum represents a non-failure case. 63 * 64 * @return True if success. 65 */ isSuccess()66 public boolean isSuccess() { 67 return this == NONE; 68 } 69 } 70