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.R;
20 import com.android.settingslib.SignalIcon.MobileIconGroup;
21 
22 import java.util.HashMap;
23 import java.util.Map;
24 
25 /**
26  * Telephony related icons and strings for SysUI and Settings.
27  */
28 public class TelephonyIcons {
29     //***** Data connection icons
30     public static final int FLIGHT_MODE_ICON = R.drawable.stat_sys_airplane_mode;
31 
32     public static final int ICON_LTE = R.drawable.ic_lte_mobiledata;
33     public static final int ICON_LTE_PLUS = R.drawable.ic_lte_plus_mobiledata;
34     public static final int ICON_G = R.drawable.ic_g_mobiledata;
35     public static final int ICON_E = R.drawable.ic_e_mobiledata;
36     public static final int ICON_H = R.drawable.ic_h_mobiledata;
37     public static final int ICON_H_PLUS = R.drawable.ic_h_plus_mobiledata;
38     public static final int ICON_3G = R.drawable.ic_3g_mobiledata;
39     public static final int ICON_4G = R.drawable.ic_4g_mobiledata;
40     public static final int ICON_4G_PLUS = R.drawable.ic_4g_plus_mobiledata;
41     public static final int ICON_4G_LTE = R.drawable.ic_4g_lte_mobiledata;
42     public static final int ICON_4G_LTE_PLUS = R.drawable.ic_4g_lte_plus_mobiledata;
43     public static final int ICON_5G_E = R.drawable.ic_5g_e_mobiledata;
44     public static final int ICON_1X = R.drawable.ic_1x_mobiledata;
45     public static final int ICON_5G = R.drawable.ic_5g_mobiledata;
46     public static final int ICON_5G_PLUS = R.drawable.ic_5g_plus_mobiledata;
47     public static final int ICON_CWF = R.drawable.ic_carrier_wifi;
48 
49     public static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup(
50             "CARRIER_NETWORK_CHANGE",
51             R.string.carrier_network_change_mode,
52             /* dataType= */ 0
53     );
54 
55     public static final MobileIconGroup THREE_G = new MobileIconGroup(
56             "3G",
57             R.string.data_connection_3g,
58             TelephonyIcons.ICON_3G
59     );
60 
61     public static final MobileIconGroup WFC = new MobileIconGroup(
62             "WFC",
63             /* dataContentDescription= */ 0,
64             /* dataType= */ 0);
65 
66     public static final MobileIconGroup UNKNOWN = new MobileIconGroup(
67             "Unknown",
68             /* dataContentDescription= */ 0,
69             /* dataType= */ 0);
70 
71     public static final MobileIconGroup E = new MobileIconGroup(
72             "E",
73             R.string.data_connection_edge,
74             TelephonyIcons.ICON_E
75     );
76 
77     public static final MobileIconGroup ONE_X = new MobileIconGroup(
78             "1X",
79             R.string.data_connection_cdma,
80             TelephonyIcons.ICON_1X
81     );
82 
83     public static final MobileIconGroup G = new MobileIconGroup(
84             "G",
85             R.string.data_connection_gprs,
86             TelephonyIcons.ICON_G
87     );
88 
89     public static final MobileIconGroup H = new MobileIconGroup(
90             "H",
91             R.string.data_connection_3_5g,
92             TelephonyIcons.ICON_H
93     );
94 
95     public static final MobileIconGroup H_PLUS = new MobileIconGroup(
96             "H+",
97             R.string.data_connection_3_5g_plus,
98             TelephonyIcons.ICON_H_PLUS
99     );
100 
101     public static final MobileIconGroup FOUR_G = new MobileIconGroup(
102             "4G",
103             R.string.data_connection_4g,
104             TelephonyIcons.ICON_4G
105     );
106 
107     public static final MobileIconGroup FOUR_G_PLUS = new MobileIconGroup(
108             "4G+",
109             R.string.data_connection_4g_plus,
110             TelephonyIcons.ICON_4G_PLUS
111     );
112 
113     public static final MobileIconGroup LTE = new MobileIconGroup(
114             "LTE",
115             R.string.data_connection_lte,
116             TelephonyIcons.ICON_LTE
117     );
118 
119     public static final MobileIconGroup LTE_PLUS = new MobileIconGroup(
120             "LTE+",
121             R.string.data_connection_lte_plus,
122             TelephonyIcons.ICON_LTE_PLUS
123     );
124 
125     public static final MobileIconGroup FOUR_G_LTE = new MobileIconGroup(
126             "4G LTE",
127             R.string.data_connection_4g_lte,
128             TelephonyIcons.ICON_4G_LTE
129     );
130 
131     public static final MobileIconGroup FOUR_G_LTE_PLUS = new MobileIconGroup(
132             "4G LTE+",
133             R.string.data_connection_4g_lte_plus,
134             TelephonyIcons.ICON_4G_LTE_PLUS
135     );
136 
137     public static final MobileIconGroup LTE_CA_5G_E = new MobileIconGroup(
138             "5Ge",
139             R.string.data_connection_5ge_html,
140             TelephonyIcons.ICON_5G_E
141     );
142 
143     public static final MobileIconGroup NR_5G = new MobileIconGroup(
144             "5G",
145             R.string.data_connection_5g,
146             TelephonyIcons.ICON_5G
147     );
148 
149     public static final MobileIconGroup NR_5G_PLUS = new MobileIconGroup(
150             "5G_PLUS",
151             R.string.data_connection_5g_plus,
152             TelephonyIcons.ICON_5G_PLUS
153     );
154 
155     public static final MobileIconGroup DATA_DISABLED = new MobileIconGroup(
156             "DataDisabled",
157             R.string.cell_data_off_content_description,
158             0
159     );
160 
161     public static final MobileIconGroup NOT_DEFAULT_DATA = new MobileIconGroup(
162             "NotDefaultData",
163             R.string.not_default_data_content_description,
164             /* dataType= */ 0
165     );
166 
167     public static final MobileIconGroup CARRIER_MERGED_WIFI = new MobileIconGroup(
168             "CWF",
169             R.string.data_connection_carrier_wifi,
170             TelephonyIcons.ICON_CWF
171     );
172 
173     // When adding a new MobileIconGroup, check if the dataContentDescription has to be filtered
174     // in QSCarrier#hasValidTypeContentDescription
175 
176     /** Mapping icon name(lower case) to the icon object. */
177     public static final Map<String, MobileIconGroup> ICON_NAME_TO_ICON;
178     static {
179         ICON_NAME_TO_ICON = new HashMap<>();
180         ICON_NAME_TO_ICON.put("carrier_network_change", CARRIER_NETWORK_CHANGE);
181         ICON_NAME_TO_ICON.put("3g", THREE_G);
182         ICON_NAME_TO_ICON.put("wfc", WFC);
183         ICON_NAME_TO_ICON.put("unknown", UNKNOWN);
184         ICON_NAME_TO_ICON.put("e", E);
185         ICON_NAME_TO_ICON.put("1x", ONE_X);
186         ICON_NAME_TO_ICON.put("g", G);
187         ICON_NAME_TO_ICON.put("h", H);
188         ICON_NAME_TO_ICON.put("h+", H_PLUS);
189         ICON_NAME_TO_ICON.put("4g", FOUR_G);
190         ICON_NAME_TO_ICON.put("4g+", FOUR_G_PLUS);
191         ICON_NAME_TO_ICON.put("4glte", FOUR_G_LTE);
192         ICON_NAME_TO_ICON.put("4glte+", FOUR_G_LTE_PLUS);
193         ICON_NAME_TO_ICON.put("5ge", LTE_CA_5G_E);
194         ICON_NAME_TO_ICON.put("lte", LTE);
195         ICON_NAME_TO_ICON.put("lte+", LTE_PLUS);
196         ICON_NAME_TO_ICON.put("5g", NR_5G);
197         ICON_NAME_TO_ICON.put("5g_plus", NR_5G_PLUS);
198         ICON_NAME_TO_ICON.put("datadisable", DATA_DISABLED);
199         ICON_NAME_TO_ICON.put("notdefaultdata", NOT_DEFAULT_DATA);
200     }
201 
202     public static final int[] MOBILE_CALL_STRENGTH_ICONS = {
203         R.drawable.ic_mobile_call_strength_0,
204         R.drawable.ic_mobile_call_strength_1,
205         R.drawable.ic_mobile_call_strength_2,
206         R.drawable.ic_mobile_call_strength_3,
207         R.drawable.ic_mobile_call_strength_4
208     };
209 }
210