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.internal.telephony.emergency;
18 
19 import android.annotation.IntDef;
20 
21 import java.lang.annotation.Retention;
22 import java.lang.annotation.RetentionPolicy;
23 
24 /**
25  * Define the constants for emergency call domain selection.
26  */
27 public class EmergencyConstants {
28 
29     @Retention(RetentionPolicy.SOURCE)
30     @IntDef(prefix = {"MODE_EMERGENCY_"},
31             value = {
32                     MODE_EMERGENCY_NONE,
33                     MODE_EMERGENCY_WWAN,
34                     MODE_EMERGENCY_WLAN,
35                     MODE_EMERGENCY_CALLBACK,
36             })
37     public @interface EmergencyMode {}
38 
39     /**
40      * Default value.
41      */
42     public static final int MODE_EMERGENCY_NONE = 0;
43     /**
44      * Mode Type Emergency WWAN, indicates that the current domain selected for the Emergency call
45      * is cellular.
46      */
47     public static final int MODE_EMERGENCY_WWAN = 1;
48     /**
49      * Mode Type Emergency WLAN, indicates that the current domain selected for the Emergency call
50      * is WLAN/WIFI.
51      */
52     public static final int MODE_EMERGENCY_WLAN = 2;
53     /**
54      * Mode Type Emergency Callback, indicates that the current mode set request is for Emergency
55      * callback.
56      */
57     public static final int MODE_EMERGENCY_CALLBACK = 3;
58 
59     /** Converts the {@link EmergencyMode} to String */
emergencyModeToString(int emcMode)60     public static String emergencyModeToString(int emcMode) {
61         switch (emcMode) {
62             case MODE_EMERGENCY_NONE: return "NONE";
63             case MODE_EMERGENCY_WWAN: return "WWAN";
64             case MODE_EMERGENCY_WLAN: return "WLAN";
65             case MODE_EMERGENCY_CALLBACK: return "CALLBACK";
66             default: return "UNKNOWN(" + emcMode + ")";
67         }
68     }
69 }
70