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