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 import com.android.settingslib.flags.Flags; 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 = 34 flagged(R.drawable.ic_lte_mobiledata, R.drawable.ic_lte_mobiledata_updated); 35 public static final int ICON_LTE_PLUS = 36 flagged(R.drawable.ic_lte_plus_mobiledata, R.drawable.ic_lte_plus_mobiledata_updated); 37 public static final int ICON_G = 38 flagged(R.drawable.ic_g_mobiledata, R.drawable.ic_g_mobiledata_updated); 39 public static final int ICON_E = 40 flagged(R.drawable.ic_e_mobiledata, R.drawable.ic_e_mobiledata_updated); 41 public static final int ICON_H = 42 flagged(R.drawable.ic_h_mobiledata, R.drawable.ic_h_mobiledata_updated); 43 public static final int ICON_H_PLUS = 44 flagged(R.drawable.ic_h_plus_mobiledata, R.drawable.ic_h_plus_mobiledata_updated); 45 public static final int ICON_3G = 46 flagged(R.drawable.ic_3g_mobiledata, R.drawable.ic_3g_mobiledata_updated); 47 public static final int ICON_4G = 48 flagged(R.drawable.ic_4g_mobiledata, R.drawable.ic_4g_mobiledata_updated); 49 public static final int ICON_4G_PLUS = 50 flagged(R.drawable.ic_4g_plus_mobiledata, R.drawable.ic_4g_plus_mobiledata_updated); 51 public static final int ICON_4G_LTE = 52 flagged(R.drawable.ic_4g_lte_mobiledata, R.drawable.ic_4g_lte_mobiledata_updated); 53 public static final int ICON_4G_LTE_PLUS = 54 flagged(R.drawable.ic_4g_lte_plus_mobiledata, 55 R.drawable.ic_4g_lte_plus_mobiledata_updated); 56 public static final int ICON_5G_E = 57 flagged(R.drawable.ic_5g_e_mobiledata, R.drawable.ic_5g_e_mobiledata_updated); 58 public static final int ICON_1X = 59 flagged(R.drawable.ic_1x_mobiledata, R.drawable.ic_1x_mobiledata_updated); 60 public static final int ICON_5G = 61 flagged(R.drawable.ic_5g_mobiledata, R.drawable.ic_5g_mobiledata_updated); 62 public static final int ICON_5G_PLUS = 63 flagged(R.drawable.ic_5g_plus_mobiledata, R.drawable.ic_5g_plus_mobiledata_updated); 64 public static final int ICON_CWF = 65 flagged(R.drawable.ic_carrier_wifi, R.drawable.ic_carrier_wifi_updated); 66 67 /** Make it slightly more obvious which resource we are using */ flagged(int oldIcon, int newIcon)68 private static int flagged(int oldIcon, int newIcon) { 69 if (Flags.newStatusBarIcons()) { 70 return newIcon; 71 } 72 return oldIcon; 73 } 74 75 public static final MobileIconGroup CARRIER_NETWORK_CHANGE = new MobileIconGroup( 76 "CARRIER_NETWORK_CHANGE", 77 R.string.carrier_network_change_mode, 78 /* dataType= */ 0 79 ); 80 81 public static final MobileIconGroup THREE_G = new MobileIconGroup( 82 "3G", 83 R.string.data_connection_3g, 84 TelephonyIcons.ICON_3G 85 ); 86 87 public static final MobileIconGroup WFC = new MobileIconGroup( 88 "WFC", 89 /* dataContentDescription= */ 0, 90 /* dataType= */ 0); 91 92 public static final MobileIconGroup UNKNOWN = new MobileIconGroup( 93 "Unknown", 94 /* dataContentDescription= */ 0, 95 /* dataType= */ 0); 96 97 public static final MobileIconGroup E = new MobileIconGroup( 98 "E", 99 R.string.data_connection_edge, 100 TelephonyIcons.ICON_E 101 ); 102 103 public static final MobileIconGroup ONE_X = new MobileIconGroup( 104 "1X", 105 R.string.data_connection_cdma, 106 TelephonyIcons.ICON_1X 107 ); 108 109 public static final MobileIconGroup G = new MobileIconGroup( 110 "G", 111 R.string.data_connection_gprs, 112 TelephonyIcons.ICON_G 113 ); 114 115 public static final MobileIconGroup H = new MobileIconGroup( 116 "H", 117 R.string.data_connection_3_5g, 118 TelephonyIcons.ICON_H 119 ); 120 121 public static final MobileIconGroup H_PLUS = new MobileIconGroup( 122 "H+", 123 R.string.data_connection_3_5g_plus, 124 TelephonyIcons.ICON_H_PLUS 125 ); 126 127 public static final MobileIconGroup FOUR_G = new MobileIconGroup( 128 "4G", 129 R.string.data_connection_4g, 130 TelephonyIcons.ICON_4G 131 ); 132 133 public static final MobileIconGroup FOUR_G_PLUS = new MobileIconGroup( 134 "4G+", 135 R.string.data_connection_4g_plus, 136 TelephonyIcons.ICON_4G_PLUS 137 ); 138 139 public static final MobileIconGroup LTE = new MobileIconGroup( 140 "LTE", 141 R.string.data_connection_lte, 142 TelephonyIcons.ICON_LTE 143 ); 144 145 public static final MobileIconGroup LTE_PLUS = new MobileIconGroup( 146 "LTE+", 147 R.string.data_connection_lte_plus, 148 TelephonyIcons.ICON_LTE_PLUS 149 ); 150 151 public static final MobileIconGroup FOUR_G_LTE = new MobileIconGroup( 152 "4G LTE", 153 R.string.data_connection_4g_lte, 154 TelephonyIcons.ICON_4G_LTE 155 ); 156 157 public static final MobileIconGroup FOUR_G_LTE_PLUS = new MobileIconGroup( 158 "4G LTE+", 159 R.string.data_connection_4g_lte_plus, 160 TelephonyIcons.ICON_4G_LTE_PLUS 161 ); 162 163 public static final MobileIconGroup LTE_CA_5G_E = new MobileIconGroup( 164 "5Ge", 165 R.string.data_connection_5ge_html, 166 TelephonyIcons.ICON_5G_E 167 ); 168 169 public static final MobileIconGroup NR_5G = new MobileIconGroup( 170 "5G", 171 R.string.data_connection_5g, 172 TelephonyIcons.ICON_5G 173 ); 174 175 public static final MobileIconGroup NR_5G_PLUS = new MobileIconGroup( 176 "5G_PLUS", 177 R.string.data_connection_5g_plus, 178 TelephonyIcons.ICON_5G_PLUS 179 ); 180 181 public static final MobileIconGroup DATA_DISABLED = new MobileIconGroup( 182 "DataDisabled", 183 R.string.cell_data_off_content_description, 184 0 185 ); 186 187 public static final MobileIconGroup NOT_DEFAULT_DATA = new MobileIconGroup( 188 "NotDefaultData", 189 R.string.not_default_data_content_description, 190 /* dataType= */ 0 191 ); 192 193 public static final MobileIconGroup CARRIER_MERGED_WIFI = new MobileIconGroup( 194 "CWF", 195 R.string.data_connection_carrier_wifi, 196 TelephonyIcons.ICON_CWF 197 ); 198 199 // When adding a new MobileIconGroup, check if the dataContentDescription has to be filtered 200 // in QSCarrier#hasValidTypeContentDescription 201 202 /** Mapping icon name(lower case) to the icon object. */ 203 public static final Map<String, MobileIconGroup> ICON_NAME_TO_ICON; 204 static { 205 ICON_NAME_TO_ICON = new HashMap<>(); 206 ICON_NAME_TO_ICON.put("carrier_network_change", CARRIER_NETWORK_CHANGE); 207 ICON_NAME_TO_ICON.put("3g", THREE_G); 208 ICON_NAME_TO_ICON.put("wfc", WFC); 209 ICON_NAME_TO_ICON.put("unknown", UNKNOWN); 210 ICON_NAME_TO_ICON.put("e", E); 211 ICON_NAME_TO_ICON.put("1x", ONE_X); 212 ICON_NAME_TO_ICON.put("g", G); 213 ICON_NAME_TO_ICON.put("h", H); 214 ICON_NAME_TO_ICON.put("h+", H_PLUS); 215 ICON_NAME_TO_ICON.put("4g", FOUR_G); 216 ICON_NAME_TO_ICON.put("4g+", FOUR_G_PLUS); 217 ICON_NAME_TO_ICON.put("4glte", FOUR_G_LTE); 218 ICON_NAME_TO_ICON.put("4glte+", FOUR_G_LTE_PLUS); 219 ICON_NAME_TO_ICON.put("5ge", LTE_CA_5G_E); 220 ICON_NAME_TO_ICON.put("lte", LTE); 221 ICON_NAME_TO_ICON.put("lte+", LTE_PLUS); 222 ICON_NAME_TO_ICON.put("5g", NR_5G); 223 ICON_NAME_TO_ICON.put("5g_plus", NR_5G_PLUS); 224 ICON_NAME_TO_ICON.put("datadisable", DATA_DISABLED); 225 ICON_NAME_TO_ICON.put("notdefaultdata", NOT_DEFAULT_DATA); 226 } 227 228 public static final int[] MOBILE_CALL_STRENGTH_ICONS = { 229 R.drawable.ic_mobile_call_strength_0, 230 R.drawable.ic_mobile_call_strength_1, 231 R.drawable.ic_mobile_call_strength_2, 232 R.drawable.ic_mobile_call_strength_3, 233 R.drawable.ic_mobile_call_strength_4 234 }; 235 } 236