• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 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.settingslib.mobile;
18 
19 import com.android.settingslib.AccessibilityContentDescriptions;
20 import com.android.settingslib.R;
21 import com.android.settingslib.SignalIcon.MobileIconGroup;
22 
23 import java.util.HashMap;
24 import java.util.Map;
25 
26 /**
27  * Telephony related icons and strings for SysUI and Settings.
28  */
29 public class TelephonyIcons {
30     //***** Data connection icons
31     public static final int FLIGHT_MODE_ICON = R.drawable.stat_sys_airplane_mode;
32 
33     public static final int ICON_LTE = R.drawable.ic_lte_mobiledata;
34     public static final int ICON_LTE_PLUS = R.drawable.ic_lte_plus_mobiledata;
35     public static final int ICON_G = R.drawable.ic_g_mobiledata;
36     public static final int ICON_E = R.drawable.ic_e_mobiledata;
37     public static final int ICON_H = R.drawable.ic_h_mobiledata;
38     public static final int ICON_H_PLUS = R.drawable.ic_h_plus_mobiledata;
39     public static final int ICON_3G = R.drawable.ic_3g_mobiledata;
40     public static final int ICON_4G = R.drawable.ic_4g_mobiledata;
41     public static final int ICON_4G_PLUS = R.drawable.ic_4g_plus_mobiledata;
42     public static final int ICON_5G_E = R.drawable.ic_5g_e_mobiledata;
43     public static final int ICON_1X = R.drawable.ic_1x_mobiledata;
44     public static final int ICON_5G = R.drawable.ic_5g_mobiledata;
45     public static final int ICON_5G_PLUS = R.drawable.ic_5g_plus_mobiledata;
46     public static final int ICON_CWF = R.drawable.ic_carrier_wifi;
47 
48     public static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup(
49             "CARRIER_NETWORK_CHANGE",
50             null,
51             null,
52             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
53             0, 0,
54             0,
55             0,
56             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
57             R.string.carrier_network_change_mode,
58             0,
59             false);
60 
61     public static final MobileIconGroup THREE_G = new MobileIconGroup(
62             "3G",
63             null,
64             null,
65             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
66             0, 0,
67             0,
68             0,
69             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
70             R.string.data_connection_3g,
71             TelephonyIcons.ICON_3G,
72             true);
73 
74     public static final MobileIconGroup WFC = new MobileIconGroup(
75             "WFC",
76             null,
77             null,
78             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
79             0, 0,
80             0,
81             0,
82             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
83             0, 0, false);
84 
85     public static final MobileIconGroup UNKNOWN = new MobileIconGroup(
86             "Unknown",
87             null,
88             null,
89             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
90             0, 0,
91             0,
92             0,
93             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
94             0, 0, false);
95 
96     public static final MobileIconGroup E = new MobileIconGroup(
97             "E",
98             null,
99             null,
100             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
101             0, 0,
102             0,
103             0,
104             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
105             R.string.data_connection_edge,
106             TelephonyIcons.ICON_E,
107             false);
108 
109     public static final MobileIconGroup ONE_X = new MobileIconGroup(
110             "1X",
111             null,
112             null,
113             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
114             0, 0,
115             0,
116             0,
117             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
118             R.string.data_connection_cdma,
119             TelephonyIcons.ICON_1X,
120             true);
121 
122     public static final MobileIconGroup G = new MobileIconGroup(
123             "G",
124             null,
125             null,
126             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
127             0, 0,
128             0,
129             0,
130             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
131             R.string.data_connection_gprs,
132             TelephonyIcons.ICON_G,
133             false);
134 
135     public static final MobileIconGroup H = new MobileIconGroup(
136             "H",
137             null,
138             null,
139             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
140             0, 0,
141             0,
142             0,
143             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
144             R.string.data_connection_3_5g,
145             TelephonyIcons.ICON_H,
146             false);
147 
148     public static final MobileIconGroup H_PLUS = new MobileIconGroup(
149             "H+",
150             null,
151             null,
152             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
153             0, 0,
154             0,
155             0,
156             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
157             R.string.data_connection_3_5g_plus,
158             TelephonyIcons.ICON_H_PLUS,
159             false);
160 
161     public static final MobileIconGroup FOUR_G = new MobileIconGroup(
162             "4G",
163             null,
164             null,
165             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
166             0, 0,
167             0,
168             0,
169             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
170             R.string.data_connection_4g,
171             TelephonyIcons.ICON_4G,
172             true);
173 
174     public static final MobileIconGroup FOUR_G_PLUS = new MobileIconGroup(
175             "4G+",
176             null,
177             null,
178             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
179             0, 0,
180             0,
181             0,
182             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
183             R.string.data_connection_4g_plus,
184             TelephonyIcons.ICON_4G_PLUS,
185             true);
186 
187     public static final MobileIconGroup LTE = new MobileIconGroup(
188             "LTE",
189             null,
190             null,
191             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
192             0, 0,
193             0,
194             0,
195             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
196             R.string.data_connection_lte,
197             TelephonyIcons.ICON_LTE,
198             true);
199 
200     public static final MobileIconGroup LTE_PLUS = new MobileIconGroup(
201             "LTE+",
202             null,
203             null,
204             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
205             0, 0,
206             0,
207             0,
208             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
209             R.string.data_connection_lte_plus,
210             TelephonyIcons.ICON_LTE_PLUS,
211             true);
212 
213     public static final MobileIconGroup LTE_CA_5G_E = new MobileIconGroup(
214             "5Ge",
215             null,
216             null,
217             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
218             0, 0,
219             0,
220             0,
221             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
222             R.string.data_connection_5ge_html,
223             TelephonyIcons.ICON_5G_E,
224             true);
225 
226     public static final MobileIconGroup NR_5G = new MobileIconGroup(
227             "5G",
228             null,
229             null,
230             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
231             0,
232             0,
233             0,
234             0,
235             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
236             R.string.data_connection_5g,
237             TelephonyIcons.ICON_5G,
238             true);
239 
240     public static final MobileIconGroup NR_5G_PLUS = new MobileIconGroup(
241             "5G_PLUS",
242             null,
243             null,
244             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
245             0,
246             0,
247             0,
248             0,
249             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
250             R.string.data_connection_5g_plus,
251             TelephonyIcons.ICON_5G_PLUS,
252             true);
253 
254     public static final MobileIconGroup DATA_DISABLED = new MobileIconGroup(
255             "DataDisabled",
256             null,
257             null,
258             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
259             0, 0,
260             0,
261             0,
262             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
263             R.string.cell_data_off_content_description,
264             0,
265             false);
266 
267     public static final MobileIconGroup NOT_DEFAULT_DATA = new MobileIconGroup(
268             "NotDefaultData",
269             null,
270             null,
271             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
272             0, 0,
273             0,
274             0,
275             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
276             R.string.not_default_data_content_description,
277             0,
278             false);
279 
280     public static final MobileIconGroup CARRIER_MERGED_WIFI = new MobileIconGroup(
281             "CWF",
282             /* sbIcons= */ null,
283             /* qsIcons= */ null,
284             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH,
285             /* sbNullState= */ 0,
286             /* qsNullState= */ 0,
287             /* sbDiscState= */ 0,
288             /* qsDiscState= */ 0,
289             AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[0],
290             R.string.data_connection_carrier_wifi,
291             TelephonyIcons.ICON_CWF,
292             /* isWide= */ true);
293 
294     // When adding a new MobileIconGround, check if the dataContentDescription has to be filtered
295     // in QSCarrier#hasValidTypeContentDescription
296 
297     /** Mapping icon name(lower case) to the icon object. */
298     public static final Map<String, MobileIconGroup> ICON_NAME_TO_ICON;
299     static {
300         ICON_NAME_TO_ICON = new HashMap<>();
301         ICON_NAME_TO_ICON.put("carrier_network_change", CARRIER_NETWORK_CHANGE);
302         ICON_NAME_TO_ICON.put("3g", THREE_G);
303         ICON_NAME_TO_ICON.put("wfc", WFC);
304         ICON_NAME_TO_ICON.put("unknown", UNKNOWN);
305         ICON_NAME_TO_ICON.put("e", E);
306         ICON_NAME_TO_ICON.put("1x", ONE_X);
307         ICON_NAME_TO_ICON.put("g", G);
308         ICON_NAME_TO_ICON.put("h", H);
309         ICON_NAME_TO_ICON.put("h+", H_PLUS);
310         ICON_NAME_TO_ICON.put("4g", FOUR_G);
311         ICON_NAME_TO_ICON.put("4g+", FOUR_G_PLUS);
312         ICON_NAME_TO_ICON.put("5ge", LTE_CA_5G_E);
313         ICON_NAME_TO_ICON.put("lte", LTE);
314         ICON_NAME_TO_ICON.put("lte+", LTE_PLUS);
315         ICON_NAME_TO_ICON.put("5g", NR_5G);
316         ICON_NAME_TO_ICON.put("5g_plus", NR_5G_PLUS);
317         ICON_NAME_TO_ICON.put("datadisable", DATA_DISABLED);
318         ICON_NAME_TO_ICON.put("notdefaultdata", NOT_DEFAULT_DATA);
319     }
320 
321     public static final int[] WIFI_CALL_STRENGTH_ICONS = {
322         R.drawable.ic_wifi_call_strength_0,
323         R.drawable.ic_wifi_call_strength_1,
324         R.drawable.ic_wifi_call_strength_2,
325         R.drawable.ic_wifi_call_strength_3,
326         R.drawable.ic_wifi_call_strength_4
327     };
328 
329     public static final int[] MOBILE_CALL_STRENGTH_ICONS = {
330         R.drawable.ic_mobile_call_strength_0,
331         R.drawable.ic_mobile_call_strength_1,
332         R.drawable.ic_mobile_call_strength_2,
333         R.drawable.ic_mobile_call_strength_3,
334         R.drawable.ic_mobile_call_strength_4
335     };
336 }
337 
338