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 
20 import com.android.internal.util.Protocol;
21 
22 /**
23  * @hide
24  */
25 public class DctConstants {
26     /**
27      * IDLE: ready to start data connection setup, default state
28      * CONNECTING: state of issued startPppd() but not finish yet
29      * RETRYING: data connection fails with one apn but other apns are available
30      *           ready to start data connection on other apns (before INITING)
31      * CONNECTED: IP connection is setup
32      * DISCONNECTING: Connection.disconnect() has been called, but PDP
33      *                context is not yet deactivated
34      * FAILED: data connection fail for all apns settings
35      * RETRYING: data connection failed but we're going to retry.
36      *
37      * getDataConnectionState() maps State to DataState
38      *      FAILED or IDLE : DISCONNECTED
39      *      RETRYING or CONNECTING: CONNECTING
40      *      CONNECTED : CONNECTED or DISCONNECTING
41      */
42     @UnsupportedAppUsage(implicitMember =
43             "values()[Lcom/android/internal/telephony/DctConstants$State;")
44     public enum State {
45         @UnsupportedAppUsage
46         IDLE,
47         @UnsupportedAppUsage
48         CONNECTING,
49         @UnsupportedAppUsage
50         RETRYING,
51         @UnsupportedAppUsage
52         CONNECTED,
53         @UnsupportedAppUsage
54         DISCONNECTING,
55         @UnsupportedAppUsage
56         FAILED,
57     }
58 
59     @UnsupportedAppUsage(implicitMember =
60             "values()[Lcom/android/internal/telephony/DctConstants$Activity;")
61     public enum Activity {
62         NONE,
63         @UnsupportedAppUsage
64         DATAIN,
65         @UnsupportedAppUsage
66         DATAOUT,
67         @UnsupportedAppUsage
68         DATAINANDOUT,
69         @UnsupportedAppUsage
70         DORMANT
71     }
72 
73     /***** Event Codes *****/
74     public static final int BASE = Protocol.BASE_DATA_CONNECTION_TRACKER;
75     public static final int EVENT_DATA_SETUP_COMPLETE = BASE + 0;
76     public static final int EVENT_RADIO_AVAILABLE = BASE + 1;
77     public static final int EVENT_TRY_SETUP_DATA = BASE + 3;
78     public static final int EVENT_RADIO_OFF_OR_NOT_AVAILABLE = BASE + 6;
79     public static final int EVENT_VOICE_CALL_STARTED = BASE + 7;
80     public static final int EVENT_VOICE_CALL_ENDED = BASE + 8;
81     public static final int EVENT_DATA_CONNECTION_DETACHED = BASE + 9;
82     public static final int EVENT_ROAMING_ON = BASE + 11;
83     public static final int EVENT_ROAMING_OFF = BASE + 12;
84     public static final int EVENT_ENABLE_APN = BASE + 13;
85     public static final int EVENT_DISABLE_APN = BASE + 14;
86     public static final int EVENT_DISCONNECT_DONE = BASE + 15;
87     public static final int EVENT_DATA_CONNECTION_ATTACHED = BASE + 16;
88     public static final int EVENT_DATA_STALL_ALARM = BASE + 17;
89     public static final int EVENT_DO_RECOVERY = BASE + 18;
90     public static final int EVENT_APN_CHANGED = BASE + 19;
91     public static final int EVENT_PS_RESTRICT_ENABLED = BASE + 22;
92     public static final int EVENT_PS_RESTRICT_DISABLED = BASE + 23;
93     public static final int EVENT_CLEAN_UP_CONNECTION = BASE + 24;
94     public static final int EVENT_RESTART_RADIO = BASE + 26;
95     public static final int EVENT_CLEAN_UP_ALL_CONNECTIONS = BASE + 29;
96     public static final int EVENT_DATA_SETUP_COMPLETE_ERROR = BASE + 35;
97     public static final int CMD_SET_ENABLE_FAIL_FAST_MOBILE_DATA = BASE + 36;
98     public static final int CMD_ENABLE_MOBILE_PROVISIONING = BASE + 37;
99     public static final int CMD_IS_PROVISIONING_APN = BASE + 38;
100     public static final int EVENT_PROVISIONING_APN_ALARM = BASE + 39;
101     public static final int CMD_NET_STAT_POLL = BASE + 40;
102     public static final int EVENT_DATA_RAT_CHANGED = BASE + 41;
103     public static final int CMD_CLEAR_PROVISIONING_SPINNER = BASE + 42;
104     public static final int EVENT_NETWORK_STATUS_CHANGED = BASE + 44;
105     public static final int EVENT_PCO_DATA_RECEIVED = BASE + 45;
106     public static final int EVENT_DATA_ENABLED_CHANGED = BASE + 46;
107     public static final int EVENT_DATA_RECONNECT = BASE + 47;
108     public static final int EVENT_ROAMING_SETTING_CHANGE = BASE + 48;
109     public static final int EVENT_DATA_SERVICE_BINDING_CHANGED = BASE + 49;
110     public static final int EVENT_DEVICE_PROVISIONED_CHANGE = BASE + 50;
111     public static final int EVENT_DATA_ENABLED_OVERRIDE_RULES_CHANGED = BASE + 51;
112     public static final int EVENT_TELEPHONY_DISPLAY_INFO_CHANGED = BASE + 52;
113     public static final int EVENT_NR_TIMER_WATCHDOG = BASE + 53;
114     public static final int EVENT_CARRIER_CONFIG_CHANGED = BASE + 54;
115     public static final int EVENT_SIM_STATE_UPDATED = BASE + 55;
116 
117     /***** Constants *****/
118 
119     public static final int INVALID = -1;
120     public static final int DISABLED = 0;
121     public static final int ENABLED = 1;
122 
123     public static final String APN_TYPE_KEY = "apnType";
124     public static final String PROVISIONING_URL_KEY = "provisioningUrl";
125     public static final String BANDWIDTH_SOURCE_MODEM_KEY = "modem";
126     public static final String BANDWIDTH_SOURCE_CARRIER_CONFIG_KEY = "carrier_config";
127     public static final String RAT_NAME_LTE = "LTE";
128     public static final String RAT_NAME_NR_NSA = "NR_NSA";
129     public static final String RAT_NAME_NR_NSA_MMWAVE = "NR_NSA_MMWAVE";
130 }
131