1 /* 2 * Copyright 2024 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 androidx.core.telecom.internal 18 19 /** 20 * CallState should be used internally to track the state the [CallSession] or [CallSessionLegacy] 21 * is in. 22 */ 23 internal enum class CallStateEvent { 24 NEW, 25 DIALING, 26 RINGING, 27 ACTIVE, 28 INACTIVE, 29 DISCONNECTED, 30 GLOBAL_MUTED, 31 GLOBAL_UNMUTE; 32 isCallControlStatenull33 fun isCallControlState(): Boolean { 34 return isFocusState() || isInactiveState() 35 } 36 isFocusStatenull37 fun isFocusState(): Boolean { 38 return this == NEW || this == DIALING || this == RINGING || this == ACTIVE 39 } 40 isInactiveStatenull41 fun isInactiveState(): Boolean { 42 return this == INACTIVE || this == DISCONNECTED 43 } 44 isGlobalMuteStatenull45 fun isGlobalMuteState(): Boolean { 46 return this == GLOBAL_UNMUTE || this == GLOBAL_MUTED 47 } 48 isMutednull49 fun isMuted(): Boolean { 50 return this == GLOBAL_MUTED 51 } 52 } 53