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