1 /* 2 * Copyright (C) 2012 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 package com.android.internal.telephony; 17 18 import android.compat.annotation.UnsupportedAppUsage; 19 import android.telephony.data.ApnSetting; 20 21 /** 22 * @hide 23 */ 24 public class PhoneConstants { 25 26 /** 27 * The phone state. One of the following:<p> 28 * <ul> 29 * <li>IDLE = no phone activity</li> 30 * <li>RINGING = a phone call is ringing or call waiting. 31 * In the latter case, another call is active as well</li> 32 * <li>OFFHOOK = The phone is off hook. At least one call 33 * exists that is dialing, active or holding and no calls are 34 * ringing or waiting.</li> 35 * </ul> 36 */ 37 @UnsupportedAppUsage(implicitMember = 38 "values()[Lcom/android/internal/telephony/PhoneConstants$State;") 39 public enum State { 40 @UnsupportedAppUsage 41 IDLE, 42 @UnsupportedAppUsage 43 RINGING, 44 @UnsupportedAppUsage 45 OFFHOOK; 46 }; 47 48 /** 49 * The state of a data connection. 50 * <ul> 51 * <li>CONNECTED = IP traffic should be available</li> 52 * <li>CONNECTING = Currently setting up data connection</li> 53 * <li>DISCONNECTING = IP temporarily available</li> 54 * <li>DISCONNECTED = IP not available</li> 55 * <li>SUSPENDED = connection is created but IP traffic is 56 * temperately not available. i.e. voice call is in place 57 * in 2G network</li> 58 * </ul> 59 */ 60 @UnsupportedAppUsage(implicitMember = 61 "values()[Lcom/android/internal/telephony/PhoneConstants$DataState;") 62 public enum DataState { 63 @UnsupportedAppUsage 64 CONNECTED, 65 @UnsupportedAppUsage 66 CONNECTING, 67 @UnsupportedAppUsage 68 DISCONNECTED, 69 @UnsupportedAppUsage 70 SUSPENDED, 71 DISCONNECTING; 72 }; 73 74 public static final String STATE_KEY = "state"; 75 76 // Radio Type 77 public static final int PHONE_TYPE_NONE = RILConstants.NO_PHONE; 78 public static final int PHONE_TYPE_GSM = RILConstants.GSM_PHONE; 79 public static final int PHONE_TYPE_CDMA = RILConstants.CDMA_PHONE; 80 public static final int PHONE_TYPE_SIP = RILConstants.SIP_PHONE; 81 public static final int PHONE_TYPE_THIRD_PARTY = RILConstants.THIRD_PARTY_PHONE; 82 public static final int PHONE_TYPE_IMS = RILConstants.IMS_PHONE; 83 // Currently this is used only to differentiate CDMA and CDMALTE Phone in GsmCdma* files. For 84 // anything outside of that, a cdma + lte phone is still CDMA_PHONE 85 public static final int PHONE_TYPE_CDMA_LTE = RILConstants.CDMA_LTE_PHONE; 86 87 // Modes for LTE_ON_CDMA 88 public static final int LTE_ON_CDMA_UNKNOWN = RILConstants.LTE_ON_CDMA_UNKNOWN; 89 public static final int LTE_ON_CDMA_FALSE = RILConstants.LTE_ON_CDMA_FALSE; 90 public static final int LTE_ON_CDMA_TRUE = RILConstants.LTE_ON_CDMA_TRUE; 91 92 // Number presentation type for caller id display (From internal/Connection.java) 93 @UnsupportedAppUsage 94 public static final int PRESENTATION_ALLOWED = 1; // normal 95 @UnsupportedAppUsage 96 public static final int PRESENTATION_RESTRICTED = 2; // block by user 97 @UnsupportedAppUsage 98 public static final int PRESENTATION_UNKNOWN = 3; // no specified or unknown by network 99 @UnsupportedAppUsage 100 public static final int PRESENTATION_PAYPHONE = 4; // show pay phone info 101 102 public static final String PHONE_NAME_KEY = "phoneName"; 103 public static final String DATA_NETWORK_TYPE_KEY = "networkType"; 104 public static final String DATA_APN_TYPE_KEY = "apnType"; 105 public static final String DATA_APN_KEY = "apn"; 106 107 /** 108 * Return codes for supplyPinReturnResult and 109 * supplyPukReturnResult APIs 110 */ 111 public static final int PIN_RESULT_SUCCESS = 0; 112 public static final int PIN_PASSWORD_INCORRECT = 1; 113 public static final int PIN_GENERAL_FAILURE = 2; 114 public static final int PIN_OPERATION_ABORTED = 3; 115 116 /** 117 * Return codes for <code>enableApnType()</code> 118 */ 119 public static final int APN_ALREADY_ACTIVE = 0; 120 public static final int APN_REQUEST_STARTED = 1; 121 public static final int APN_TYPE_NOT_AVAILABLE = 2; 122 public static final int APN_REQUEST_FAILED = 3; 123 public static final int APN_ALREADY_INACTIVE = 4; 124 125 /** 126 * APN types for data connections. These are usage categories for an APN 127 * entry. One APN entry may support multiple APN types, eg, a single APN 128 * may service regular internet traffic ("default") as well as MMS-specific 129 * connections.<br/> 130 * APN_TYPE_ALL is a special type to indicate that this APN entry can 131 * service all data connections. 132 */ 133 public static final String APN_TYPE_ALL = ApnSetting.TYPE_ALL_STRING; 134 /** APN type for default data traffic */ 135 public static final String APN_TYPE_DEFAULT = ApnSetting.TYPE_DEFAULT_STRING; 136 /** APN type for MMS traffic */ 137 public static final String APN_TYPE_MMS = ApnSetting.TYPE_MMS_STRING; 138 /** APN type for SUPL assisted GPS */ 139 public static final String APN_TYPE_SUPL = ApnSetting.TYPE_SUPL_STRING; 140 /** APN type for DUN traffic */ 141 public static final String APN_TYPE_DUN = ApnSetting.TYPE_DUN_STRING; 142 /** APN type for HiPri traffic */ 143 public static final String APN_TYPE_HIPRI = ApnSetting.TYPE_HIPRI_STRING; 144 /** APN type for FOTA */ 145 public static final String APN_TYPE_FOTA = ApnSetting.TYPE_FOTA_STRING; 146 /** APN type for IMS */ 147 public static final String APN_TYPE_IMS = ApnSetting.TYPE_IMS_STRING; 148 /** APN type for CBS */ 149 public static final String APN_TYPE_CBS = ApnSetting.TYPE_CBS_STRING; 150 /** APN type for IA Initial Attach APN */ 151 public static final String APN_TYPE_IA = ApnSetting.TYPE_IA_STRING; 152 /** APN type for Emergency PDN. This is not an IA apn, but is used 153 * for access to carrier services in an emergency call situation. */ 154 public static final String APN_TYPE_EMERGENCY = ApnSetting.TYPE_EMERGENCY_STRING; 155 /** APN type for Mission Critical Services */ 156 public static final String APN_TYPE_MCX = ApnSetting.TYPE_MCX_STRING; 157 /** APN type for XCAP */ 158 public static final String APN_TYPE_XCAP = ApnSetting.TYPE_XCAP_STRING; 159 /** Array of all APN types */ 160 public static final String[] APN_TYPES = {APN_TYPE_DEFAULT, 161 APN_TYPE_MMS, 162 APN_TYPE_SUPL, 163 APN_TYPE_DUN, 164 APN_TYPE_HIPRI, 165 APN_TYPE_FOTA, 166 APN_TYPE_IMS, 167 APN_TYPE_CBS, 168 APN_TYPE_IA, 169 APN_TYPE_EMERGENCY, 170 APN_TYPE_MCX, 171 APN_TYPE_XCAP, 172 }; 173 174 public static final int RIL_CARD_MAX_APPS = 8; 175 176 public static final int DEFAULT_SLOT_INDEX = 0; 177 178 public static final int MAX_PHONE_COUNT_SINGLE_SIM = 1; 179 180 public static final int MAX_PHONE_COUNT_DUAL_SIM = 2; 181 182 public static final int MAX_PHONE_COUNT_TRI_SIM = 3; 183 184 public static final String PHONE_KEY = "phone"; 185 186 public static final String SLOT_KEY = "slot"; 187 188 // FIXME: This is used to pass a subId via intents, we need to look at its usage, which is 189 // FIXME: extensive, and see if this should be an array of all active subId's or ...? 190 /** 191 * @Deprecated use {@link android.telephony.SubscriptionManager#EXTRA_SUBSCRIPTION_INDEX} 192 * instead. 193 */ 194 public static final String SUBSCRIPTION_KEY = "subscription"; 195 196 public static final String SUB_SETTING = "subSettings"; 197 198 public static final int SUB1 = 0; 199 public static final int SUB2 = 1; 200 public static final int SUB3 = 2; 201 202 // TODO: Remove these constants and use an int instead. 203 public static final int SIM_ID_1 = 0; 204 public static final int SIM_ID_2 = 1; 205 public static final int SIM_ID_3 = 2; 206 public static final int SIM_ID_4 = 3; 207 208 // ICC SIM Application Types 209 // TODO: Replace the IccCardApplicationStatus.AppType enums with these constants 210 public static final int APPTYPE_UNKNOWN = 0; 211 public static final int APPTYPE_SIM = 1; 212 public static final int APPTYPE_USIM = 2; 213 public static final int APPTYPE_RUIM = 3; 214 public static final int APPTYPE_CSIM = 4; 215 public static final int APPTYPE_ISIM = 5; 216 217 public enum CardUnavailableReason { 218 REASON_CARD_REMOVED, 219 REASON_RADIO_UNAVAILABLE, 220 REASON_SIM_REFRESH_RESET 221 }; 222 223 // Initial MTU value. 224 public static final int UNSET_MTU = 0; 225 226 //FIXME maybe this shouldn't be here - sprout only 227 public static final int CAPABILITY_3G = 1; 228 229 /** 230 * Values for the adb property "persist.radio.videocall.audio.output" 231 */ 232 public static final int AUDIO_OUTPUT_ENABLE_SPEAKER = 0; 233 public static final int AUDIO_OUTPUT_DISABLE_SPEAKER = 1; 234 public static final int AUDIO_OUTPUT_DEFAULT = AUDIO_OUTPUT_ENABLE_SPEAKER; 235 236 // authContext (parameter P2) when doing SIM challenge, 237 // per 3GPP TS 31.102 (Section 7.1.2) 238 public static final int AUTH_CONTEXT_EAP_SIM = 128; 239 public static final int AUTH_CONTEXT_EAP_AKA = 129; 240 public static final int AUTH_CONTEXT_UNDEFINED = -1; 241 242 /** 243 * Value for the global property CELL_ON 244 * 0: Cell radio is off 245 * 1: Cell radio is on 246 * 2: Cell radio is off because airplane mode is enabled 247 */ 248 public static final int CELL_OFF_FLAG = 0; 249 public static final int CELL_ON_FLAG = 1; 250 public static final int CELL_OFF_DUE_TO_AIRPLANE_MODE_FLAG = 2; 251 } 252