• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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      public static final int PRESENTATION_UNAVAILABLE = 5;   // show unavailable
99  
100      public static final String PHONE_NAME_KEY = "phoneName";
101      public static final String DATA_NETWORK_TYPE_KEY = "networkType";
102      public static final String DATA_APN_TYPE_KEY = "apnType";
103      public static final String DATA_APN_KEY = "apn";
104  
105      /**
106       * Return codes for supplyPinReturnResult and
107       * supplyPukReturnResult APIs
108       */
109      public static final int PIN_RESULT_SUCCESS = 0;
110      public static final int PIN_PASSWORD_INCORRECT = 1;
111      public static final int PIN_GENERAL_FAILURE = 2;
112      public static final int PIN_OPERATION_ABORTED = 3;
113  
114      /**
115       * Return codes for <code>enableApnType()</code>
116       */
117      public static final int APN_ALREADY_ACTIVE     = 0;
118      public static final int APN_REQUEST_STARTED    = 1;
119      public static final int APN_TYPE_NOT_AVAILABLE = 2;
120      public static final int APN_REQUEST_FAILED     = 3;
121      public static final int APN_ALREADY_INACTIVE   = 4;
122  
123      /**
124       * APN types for data connections.  These are usage categories for an APN
125       * entry.  One APN entry may support multiple APN types, eg, a single APN
126       * may service regular internet traffic ("default") as well as MMS-specific
127       * connections.<br/>
128       * APN_TYPE_ALL is a special type to indicate that this APN entry can
129       * service all data connections.
130       * TODO: remove these and use the reference to ApnSetting.TYPE_XXX_STRING instead
131       */
132      public static final String APN_TYPE_ALL = ApnSetting.TYPE_ALL_STRING;
133      /** APN type for default data traffic */
134      public static final String APN_TYPE_DEFAULT = ApnSetting.TYPE_DEFAULT_STRING;
135      /** APN type for MMS traffic */
136      public static final String APN_TYPE_MMS = ApnSetting.TYPE_MMS_STRING;
137      /** APN type for SUPL assisted GPS */
138      public static final String APN_TYPE_SUPL = ApnSetting.TYPE_SUPL_STRING;
139      /** APN type for DUN traffic */
140      public static final String APN_TYPE_DUN = ApnSetting.TYPE_DUN_STRING;
141      /** APN type for HiPri traffic */
142      public static final String APN_TYPE_HIPRI = ApnSetting.TYPE_HIPRI_STRING;
143      /** APN type for FOTA */
144      public static final String APN_TYPE_FOTA = ApnSetting.TYPE_FOTA_STRING;
145      /** APN type for IMS */
146      public static final String APN_TYPE_IMS = ApnSetting.TYPE_IMS_STRING;
147      /** APN type for CBS */
148      public static final String APN_TYPE_CBS = ApnSetting.TYPE_CBS_STRING;
149      /** APN type for IA Initial Attach APN */
150      public static final String APN_TYPE_IA = ApnSetting.TYPE_IA_STRING;
151      /** APN type for Emergency PDN. This is not an IA apn, but is used
152       * for access to carrier services in an emergency call situation. */
153      public static final String APN_TYPE_EMERGENCY = ApnSetting.TYPE_EMERGENCY_STRING;
154      /** APN type for Mission Critical Services */
155      public static final String APN_TYPE_MCX = ApnSetting.TYPE_MCX_STRING;
156      /** APN type for XCAP */
157      public static final String APN_TYPE_XCAP = ApnSetting.TYPE_XCAP_STRING;
158      // /** APN type for enterprise */
159      // public static final String APN_TYPE_ENTERPRISE = ApnSetting.TYPE_ENTERPRISE_STRING;
160  
161      public static final int RIL_CARD_MAX_APPS    = 8;
162  
163      public static final int DEFAULT_SLOT_INDEX   = 0;
164  
165      public static final int MAX_PHONE_COUNT_SINGLE_SIM = 1;
166  
167      public static final int MAX_PHONE_COUNT_DUAL_SIM = 2;
168  
169      public static final int MAX_PHONE_COUNT_TRI_SIM = 3;
170  
171      public static final String PHONE_KEY = "phone";
172  
173      public static final String SLOT_KEY  = "slot";
174  
175      public static final String PORT_KEY = "port";
176  
177      // FIXME: This is used to pass a subId via intents, we need to look at its usage, which is
178      // FIXME: extensive, and see if this should be an array of all active subId's or ...?
179      /**
180       * @Deprecated use {@link android.telephony.SubscriptionManager#EXTRA_SUBSCRIPTION_INDEX}
181       * instead.
182       */
183      public static final String SUBSCRIPTION_KEY  = "subscription";
184  
185      public static final String SUB_SETTING  = "subSettings";
186  
187      public static final int SUB1 = 0;
188      public static final int SUB2 = 1;
189      public static final int SUB3 = 2;
190  
191      // TODO: Remove these constants and use an int instead.
192      public static final int SIM_ID_1 = 0;
193      public static final int SIM_ID_2 = 1;
194      public static final int SIM_ID_3 = 2;
195      public static final int SIM_ID_4 = 3;
196  
197      // ICC SIM Application Types
198      // TODO: Replace the IccCardApplicationStatus.AppType enums with these constants
199      public static final int APPTYPE_UNKNOWN = 0;
200      public static final int APPTYPE_SIM = 1;
201      public static final int APPTYPE_USIM = 2;
202      public static final int APPTYPE_RUIM = 3;
203      public static final int APPTYPE_CSIM = 4;
204      public static final int APPTYPE_ISIM = 5;
205  
206      public enum CardUnavailableReason {
207          REASON_CARD_REMOVED,
208          REASON_RADIO_UNAVAILABLE,
209          REASON_SIM_REFRESH_RESET
210      };
211  
212      // Initial MTU value.
213      public static final int UNSET_MTU = 0;
214  
215      //FIXME maybe this shouldn't be here - sprout only
216      public static final int CAPABILITY_3G   = 1;
217  
218      /**
219       * Values for the adb property "persist.radio.videocall.audio.output"
220       */
221      public static final int AUDIO_OUTPUT_ENABLE_SPEAKER = 0;
222      public static final int AUDIO_OUTPUT_DISABLE_SPEAKER = 1;
223      public static final int AUDIO_OUTPUT_DEFAULT = AUDIO_OUTPUT_ENABLE_SPEAKER;
224  
225      // authContext (parameter P2) when doing SIM challenge,
226      // per 3GPP TS 31.102 (Section 7.1.2)
227      public static final int AUTH_CONTEXT_EAP_SIM = 128;
228      public static final int AUTH_CONTEXT_EAP_AKA = 129;
229      public static final int AUTH_CONTEXT_GBA_BOOTSTRAP = 132;
230      public static final int AUTHTYPE_GBA_NAF_KEY_EXTERNAL = 133;
231      public static final int AUTH_CONTEXT_UNDEFINED = -1;
232  
233      /**
234       * Value for the global property CELL_ON
235       *  0: Cell radio is off
236       *  1: Cell radio is on
237       *  2: Cell radio is off because airplane mode is enabled
238       */
239      public static final int CELL_OFF_FLAG = 0;
240      public static final int CELL_ON_FLAG = 1;
241      public static final int CELL_OFF_DUE_TO_AIRPLANE_MODE_FLAG = 2;
242  
243      /** The key to specify the selected domain for dialing calls. */
244      public static final String EXTRA_DIAL_DOMAIN = "dial_domain";
245  
246      /**
247       * Indicates that this call should be routed over Wi-Fi.
248       * An internal extension of NetworkRegistrationInfo's DOMAIN_* constants
249       * to also include NON_3GPP_PS routing for the domain selection service.
250       */
251      public static final int DOMAIN_NON_3GPP_PS = 4;
252  
253      /** The key to specify the emergency service category */
254      public static final String EXTRA_EMERGENCY_SERVICE_CATEGORY = "emergency_service_category";
255  
256      /** The key to specify the alternate emergency URNs */
257      public static final String EXTRA_EMERGENCY_URNS = "emergency_urns";
258  
259      /** The key to specify whether or not to use emergency routing */
260      public static final String EXTRA_USE_EMERGENCY_ROUTING = "use_emergency_routing";
261  }
262