1 /* 2 * Copyright (C) 2011 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.cellbroadcastreceiver; 18 19 import android.app.IntentService; 20 import android.content.Context; 21 import android.content.Intent; 22 import android.content.SharedPreferences; 23 import android.content.res.Resources; 24 import android.os.SystemProperties; 25 import android.preference.PreferenceManager; 26 import android.telephony.CellBroadcastMessage; 27 import android.telephony.SmsManager; 28 import android.telephony.SubscriptionManager; 29 import android.telephony.TelephonyManager; 30 import android.text.TextUtils; 31 import android.util.Log; 32 33 import com.android.internal.telephony.cdma.sms.SmsEnvelope; 34 import com.android.internal.telephony.gsm.SmsCbConstants; 35 36 import static com.android.cellbroadcastreceiver.CellBroadcastReceiver.DBG; 37 38 /** 39 * This service manages enabling and disabling ranges of message identifiers 40 * that the radio should listen for. It operates independently of the other 41 * services and runs at boot time and after exiting airplane mode. 42 * 43 * Note that the entire range of emergency channels is enabled. Test messages 44 * and lower priority broadcasts are filtered out in CellBroadcastAlertService 45 * if the user has not enabled them in settings. 46 * 47 * TODO: add notification to re-enable channels after a radio reset. 48 */ 49 public class CellBroadcastConfigService extends IntentService { 50 private static final String TAG = "CellBroadcastConfigService"; 51 52 static final String ACTION_ENABLE_CHANNELS = "ACTION_ENABLE_CHANNELS"; 53 54 static final String EMERGENCY_BROADCAST_RANGE_GSM = 55 "ro.cb.gsm.emergencyids"; 56 57 private static final String COUNTRY_TAIWAN = "tw"; 58 private static final String COUNTRY_ISRAEL = "ir"; 59 private static final String COUNTRY_BRAZIL = "br"; 60 CellBroadcastConfigService()61 public CellBroadcastConfigService() { 62 super(TAG); // use class name for worker thread name 63 } 64 setChannelRange(SmsManager manager, String ranges, boolean enable)65 private static void setChannelRange(SmsManager manager, String ranges, boolean enable) { 66 if (DBG)log("setChannelRange: " + ranges); 67 68 try { 69 for (String channelRange : ranges.split(",")) { 70 int dashIndex = channelRange.indexOf('-'); 71 if (dashIndex != -1) { 72 int startId = Integer.decode(channelRange.substring(0, dashIndex).trim()); 73 int endId = Integer.decode(channelRange.substring(dashIndex + 1).trim()); 74 if (enable) { 75 if (DBG) log("enabling emergency IDs " + startId + '-' + endId); 76 manager.enableCellBroadcastRange(startId, endId, 77 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM); 78 } else { 79 if (DBG) log("disabling emergency IDs " + startId + '-' + endId); 80 manager.disableCellBroadcastRange(startId, endId, 81 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM); 82 } 83 } else { 84 int messageId = Integer.decode(channelRange.trim()); 85 if (enable) { 86 if (DBG) log("enabling emergency message ID " + messageId); 87 manager.enableCellBroadcast(messageId, 88 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM); 89 } else { 90 if (DBG) log("disabling emergency message ID " + messageId); 91 manager.disableCellBroadcast(messageId, 92 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM); 93 } 94 } 95 } 96 } catch (NumberFormatException e) { 97 Log.e(TAG, "Number Format Exception parsing emergency channel range", e); 98 } 99 100 // Make sure CMAS Presidential is enabled (See 3GPP TS 22.268 Section 6.2). 101 if (DBG) log("setChannelRange: enabling CMAS Presidential"); 102 manager.enableCellBroadcast(SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL, 103 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM); 104 // register Taiwan PWS 4383 also, by default 105 manager.enableCellBroadcast( 106 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL_LANGUAGE, 107 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM); 108 manager.enableCellBroadcast(SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT, 109 SmsManager.CELL_BROADCAST_RAN_TYPE_CDMA); 110 } 111 112 /** 113 * Returns true if this is a standard or operator-defined emergency alert message. 114 * This includes all ETWS and CMAS alerts, except for AMBER alerts. 115 * @param message the message to test 116 * @return true if the message is an emergency alert; false otherwise 117 */ isEmergencyAlertMessage(CellBroadcastMessage message)118 static boolean isEmergencyAlertMessage(CellBroadcastMessage message) { 119 120 if (message == null) { 121 return false; 122 } 123 124 if (message.isEmergencyAlertMessage()) { 125 return true; 126 } 127 128 // Todo: Move the followings to CarrierConfig 129 // Check for system property defining the emergency channel ranges to enable 130 String emergencyIdRange = (CellBroadcastReceiver.phoneIsCdma()) ? 131 "" : SystemProperties.get(EMERGENCY_BROADCAST_RANGE_GSM); 132 133 if (TextUtils.isEmpty(emergencyIdRange)) { 134 return false; 135 } 136 try { 137 int messageId = message.getServiceCategory(); 138 for (String channelRange : emergencyIdRange.split(",")) { 139 int dashIndex = channelRange.indexOf('-'); 140 if (dashIndex != -1) { 141 int startId = Integer.decode(channelRange.substring(0, dashIndex).trim()); 142 int endId = Integer.decode(channelRange.substring(dashIndex + 1).trim()); 143 if (messageId >= startId && messageId <= endId) { 144 return true; 145 } 146 } else { 147 int emergencyMessageId = Integer.decode(channelRange.trim()); 148 if (emergencyMessageId == messageId) { 149 return true; 150 } 151 } 152 } 153 } catch (NumberFormatException e) { 154 Log.e(TAG, "Number Format Exception parsing emergency channel range", e); 155 } 156 return false; 157 } 158 159 @Override onHandleIntent(Intent intent)160 protected void onHandleIntent(Intent intent) { 161 if (ACTION_ENABLE_CHANNELS.equals(intent.getAction())) { 162 try { 163 164 SubscriptionManager subManager = SubscriptionManager.from(getApplicationContext()); 165 int subId = SubscriptionManager.getDefaultSmsSubscriptionId(); 166 if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) { 167 subId = SubscriptionManager.getDefaultSubscriptionId(); 168 if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID && 169 subManager != null) { 170 int [] subIds = subManager.getActiveSubscriptionIdList(); 171 if (subIds.length != 0) { 172 subId = subIds[0]; 173 } 174 } 175 } 176 177 if (subManager != null) { 178 // Retrieve all the active sub ids. We only want to enable 179 // cell broadcast on the sub we are interested in and we'll disable 180 // it on other subs so the users will not receive duplicate messages from 181 // multiple carriers (e.g. for multi-sim users). 182 int [] subIds = subManager.getActiveSubscriptionIdList(); 183 if (subIds.length != 0) 184 { 185 for (int id : subIds) { 186 SmsManager manager = SmsManager.getSmsManagerForSubscriptionId(id); 187 if (manager != null) { 188 if (id == subId) { 189 // Enable cell broadcast messages on this sub. 190 log("Enable CellBroadcast on sub " + id); 191 setCellBroadcastOnSub(manager, id, true); 192 } 193 else { 194 // Disable all cell broadcast message on this sub. 195 // This is only for multi-sim scenario. For single SIM device 196 // we should not reach here. 197 log("Disable CellBroadcast on sub " + id); 198 setCellBroadcastOnSub(manager, id, false); 199 } 200 } 201 } 202 } 203 else { 204 // For no sim scenario. 205 SmsManager manager = SmsManager.getDefault(); 206 if (manager != null) { 207 setCellBroadcastOnSub(manager, 208 SubscriptionManager.INVALID_SUBSCRIPTION_ID, true); 209 } 210 } 211 } 212 } catch (Exception ex) { 213 Log.e(TAG, "exception enabling cell broadcast channels", ex); 214 } 215 } 216 } 217 218 /** 219 * Enable/disable cell broadcast messages id on one subscription 220 * This includes all ETWS and CMAS alerts. 221 * @param manager SMS manager 222 * @param subId Subscription id 223 * @param enableForSub True if want to enable messages on this sub (e.g default SMS). False 224 * will disable all messages 225 */ setCellBroadcastOnSub(SmsManager manager, int subId, boolean enableForSub)226 private void setCellBroadcastOnSub(SmsManager manager, int subId, boolean enableForSub) { 227 228 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); 229 Resources res = getResources(); 230 231 // boolean for each user preference checkbox, true for checked, false for unchecked 232 // Note: If enableEmergencyAlerts is false, it disables ALL emergency broadcasts 233 // except for CMAS presidential. i.e. to receive CMAS severe alerts, both 234 // enableEmergencyAlerts AND enableCmasSevereAlerts must be true. 235 boolean enableEmergencyAlerts = enableForSub && prefs.getBoolean( 236 CellBroadcastSettings.KEY_ENABLE_EMERGENCY_ALERTS, true); 237 238 // Todo: Move this to CarrierConfig later. 239 String emergencyIdRange = (CellBroadcastReceiver.phoneIsCdma()) ? 240 "" : SystemProperties.get(EMERGENCY_BROADCAST_RANGE_GSM); 241 if (enableEmergencyAlerts) { 242 if (DBG) log("Enable CellBroadcast with carrier defined message id ranges."); 243 if (!TextUtils.isEmpty(emergencyIdRange)) { 244 setChannelRange(manager, emergencyIdRange, true); 245 } 246 } 247 else { 248 if (DBG) log("Disable CellBroadcast with carrier defined message id ranges."); 249 if (!TextUtils.isEmpty(emergencyIdRange)) { 250 setChannelRange(manager, emergencyIdRange, false); 251 } 252 } 253 254 boolean enableEtwsAlerts = enableEmergencyAlerts; 255 256 // CMAS Presidential must be always on (See 3GPP TS 22.268 Section 6.2) regardless 257 // user's preference 258 boolean enablePresidential = enableForSub; 259 260 boolean enableCmasExtremeAlerts = enableEmergencyAlerts && prefs.getBoolean( 261 CellBroadcastSettings.KEY_ENABLE_CMAS_EXTREME_THREAT_ALERTS, true); 262 263 boolean enableCmasSevereAlerts = enableEmergencyAlerts && prefs.getBoolean( 264 CellBroadcastSettings.KEY_ENABLE_CMAS_SEVERE_THREAT_ALERTS, true); 265 266 boolean enableCmasAmberAlerts = enableEmergencyAlerts && prefs.getBoolean( 267 CellBroadcastSettings.KEY_ENABLE_CMAS_AMBER_ALERTS, true); 268 269 // Check if ETWS/CMAS test message is forced disabled on the device. 270 boolean forceDisableEtwsCmasTest = 271 CellBroadcastSettings.isEtwsCmasTestMessageForcedDisabled(this); 272 273 boolean enableEtwsTestAlerts = !forceDisableEtwsCmasTest && 274 enableEmergencyAlerts && 275 prefs.getBoolean(CellBroadcastSettings.KEY_ENABLE_ETWS_TEST_ALERTS, false); 276 277 boolean enableCmasTestAlerts = !forceDisableEtwsCmasTest && 278 enableEmergencyAlerts && 279 prefs.getBoolean(CellBroadcastSettings.KEY_ENABLE_CMAS_TEST_ALERTS, false); 280 281 TelephonyManager tm = (TelephonyManager) getSystemService( 282 Context.TELEPHONY_SERVICE); 283 284 boolean enableChannel50Support = res.getBoolean(R.bool.show_brazil_settings) || 285 COUNTRY_BRAZIL.equals(tm.getSimCountryIso(subId)); 286 287 boolean enableChannel50Alerts = enableChannel50Support && 288 prefs.getBoolean(CellBroadcastSettings.KEY_ENABLE_CHANNEL_50_ALERTS, true); 289 290 // Current Israel requires enable certain CMAS messages ids. 291 // Todo: Move this to CarrierConfig later. 292 boolean supportIsraelPwsAlerts = (COUNTRY_ISRAEL.equals(tm.getSimCountryIso(subId)) 293 || COUNTRY_ISRAEL.equals(tm.getNetworkCountryIso(subId))); 294 295 boolean supportTaiwanPwsAlerts = (COUNTRY_TAIWAN.equals(tm.getSimCountryIso(subId)) 296 || COUNTRY_TAIWAN.equals(tm.getNetworkCountryIso(subId))); 297 298 if (DBG) { 299 log("enableEmergencyAlerts = " + enableEmergencyAlerts); 300 log("enableEtwsAlerts = " + enableEtwsAlerts); 301 log("enablePresidential = " + enablePresidential); 302 log("enableCmasExtremeAlerts = " + enableCmasExtremeAlerts); 303 log("enableCmasSevereAlerts = " + enableCmasExtremeAlerts); 304 log("enableCmasAmberAlerts = " + enableCmasAmberAlerts); 305 log("forceDisableEtwsCmasTest = " + forceDisableEtwsCmasTest); 306 log("enableEtwsTestAlerts = " + enableEtwsTestAlerts); 307 log("enableCmasTestAlerts = " + enableCmasTestAlerts); 308 log("enableChannel50Alerts = " + enableChannel50Alerts); 309 log("supportIsraelPwsAlerts = " + supportIsraelPwsAlerts); 310 log("supportTaiwanPwsAlerts = " + supportTaiwanPwsAlerts); 311 } 312 313 /** Enable CDMA CMAS series messages. */ 314 315 // Enable/Disable CDMA Presidential messages. 316 setCellBroadcastRange(manager, enablePresidential, 317 SmsManager.CELL_BROADCAST_RAN_TYPE_CDMA, 318 SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT, 319 SmsEnvelope.SERVICE_CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT); 320 321 // Enable/Disable CDMA CMAS extreme messages. 322 setCellBroadcastRange(manager, enableCmasExtremeAlerts, 323 SmsManager.CELL_BROADCAST_RAN_TYPE_CDMA, 324 SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT, 325 SmsEnvelope.SERVICE_CATEGORY_CMAS_EXTREME_THREAT); 326 327 // Enable/Disable CDMA CMAS severe messages. 328 setCellBroadcastRange(manager, enableCmasSevereAlerts, 329 SmsManager.CELL_BROADCAST_RAN_TYPE_CDMA, 330 SmsEnvelope.SERVICE_CATEGORY_CMAS_SEVERE_THREAT, 331 SmsEnvelope.SERVICE_CATEGORY_CMAS_SEVERE_THREAT); 332 333 // Enable/Disable CDMA CMAS amber alert messages. 334 setCellBroadcastRange(manager, enableCmasAmberAlerts, 335 SmsManager.CELL_BROADCAST_RAN_TYPE_CDMA, 336 SmsEnvelope.SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY, 337 SmsEnvelope.SERVICE_CATEGORY_CMAS_CHILD_ABDUCTION_EMERGENCY); 338 339 // Enable/Disable CDMA CMAS test messages. 340 setCellBroadcastRange(manager, enableCmasTestAlerts, 341 SmsManager.CELL_BROADCAST_RAN_TYPE_CDMA, 342 SmsEnvelope.SERVICE_CATEGORY_CMAS_TEST_MESSAGE, 343 SmsEnvelope.SERVICE_CATEGORY_CMAS_TEST_MESSAGE); 344 345 /** Enable GSM ETWS series messages. */ 346 347 // Enable/Disable GSM ETWS messages. 348 setCellBroadcastRange(manager, enableEtwsAlerts, 349 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 350 SmsCbConstants.MESSAGE_ID_ETWS_EARTHQUAKE_WARNING, 351 SmsCbConstants.MESSAGE_ID_ETWS_EARTHQUAKE_AND_TSUNAMI_WARNING); 352 353 // Enable/Disable GSM ETWS test messages (4355). 354 setCellBroadcastRange(manager, enableEtwsTestAlerts, 355 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 356 SmsCbConstants.MESSAGE_ID_ETWS_TEST_MESSAGE, 357 SmsCbConstants.MESSAGE_ID_ETWS_TEST_MESSAGE); 358 359 /** Enable GSM CMAS series messages. */ 360 361 // Enable/Disable GSM CMAS presidential message (4370). 362 setCellBroadcastRange(manager, enablePresidential, 363 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 364 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL, 365 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL); 366 367 // Enable/Disable GSM CMAS extreme messages (4371~4372). 368 setCellBroadcastRange(manager, enableCmasExtremeAlerts, 369 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 370 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_OBSERVED, 371 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_LIKELY); 372 373 // Enable/Disable GSM CMAS severe messages (4373~4378). 374 setCellBroadcastRange(manager, enableCmasSevereAlerts, 375 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 376 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_OBSERVED, 377 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_EXPECTED_LIKELY); 378 379 // Enable/Disable GSM CMAS amber alert messages (4379). 380 setCellBroadcastRange(manager, enableCmasAmberAlerts, 381 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 382 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_CHILD_ABDUCTION_EMERGENCY, 383 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_CHILD_ABDUCTION_EMERGENCY); 384 385 // Enable/Disable GSM CMAS test messages (4380~4382). 386 setCellBroadcastRange(manager, enableCmasTestAlerts, 387 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 388 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_REQUIRED_MONTHLY_TEST, 389 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_OPERATOR_DEFINED_USE); 390 391 392 /** Enable GSM CMAS series messages for additional languages. */ 393 394 // Enable/Disable GSM CMAS presidential messages for additional languages (4383). 395 setCellBroadcastRange(manager, enablePresidential, 396 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 397 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL_LANGUAGE, 398 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_PRESIDENTIAL_LEVEL_LANGUAGE); 399 400 // Enable/Disable GSM CMAS extreme messages for additional languages (4384~4385). 401 setCellBroadcastRange(manager, enableCmasExtremeAlerts, 402 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 403 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_OBSERVED_LANGUAGE, 404 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_LIKELY_LANGUAGE); 405 406 // Enable/Disable GSM CMAS severe messages for additional languages (4386~4391). 407 setCellBroadcastRange(manager, enableCmasSevereAlerts, 408 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 409 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_OBSERVED_LANGUAGE, 410 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_EXPECTED_LIKELY_LANGUAGE); 411 412 // Enable/Disable GSM CMAS amber alert messages for additional languages (4392). 413 setCellBroadcastRange(manager, enableCmasAmberAlerts, 414 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 415 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_CHILD_ABDUCTION_EMERGENCY_LANGUAGE, 416 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_CHILD_ABDUCTION_EMERGENCY_LANGUAGE); 417 418 // Enable/Disable GSM CMAS test messages for additional languages (4393~4395). 419 setCellBroadcastRange(manager, enableCmasTestAlerts, 420 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 421 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_REQUIRED_MONTHLY_TEST_LANGUAGE, 422 SmsCbConstants.MESSAGE_ID_CMAS_ALERT_OPERATOR_DEFINED_USE_LANGUAGE); 423 424 // Enable/Disable channel 50 messages for Brazil. 425 setCellBroadcastRange(manager, enableChannel50Alerts, 426 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 427 SmsCbConstants.MESSAGE_ID_GSMA_ALLOCATED_CHANNEL_50, 428 SmsCbConstants.MESSAGE_ID_GSMA_ALLOCATED_CHANNEL_50); 429 430 if (supportIsraelPwsAlerts) { 431 // Enable/Disable Israel PWS channels (919~928). 432 setCellBroadcastRange(manager, enableEmergencyAlerts, 433 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 434 SmsCbConstants.MESSAGE_ID_GSMA_ALLOCATED_CHANNEL_919, 435 SmsCbConstants.MESSAGE_ID_GSMA_ALLOCATED_CHANNEL_928); 436 } 437 else if (supportTaiwanPwsAlerts) { 438 // Enable/Disable Taiwan PWS Chinese channel (911). 439 setCellBroadcastRange(manager, enableEmergencyAlerts, 440 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 441 SmsCbConstants.MESSAGE_ID_GSMA_ALLOCATED_CHANNEL_911, 442 SmsCbConstants.MESSAGE_ID_GSMA_ALLOCATED_CHANNEL_911); 443 444 // Enable/Disable Taiwan PWS English channel (919). 445 setCellBroadcastRange(manager, enableEmergencyAlerts, 446 SmsManager.CELL_BROADCAST_RAN_TYPE_GSM, 447 SmsCbConstants.MESSAGE_ID_GSMA_ALLOCATED_CHANNEL_919, 448 SmsCbConstants.MESSAGE_ID_GSMA_ALLOCATED_CHANNEL_919); 449 } 450 } 451 /** 452 * Enable/disable cell broadcast with messages id range 453 * @param manager SMS manager 454 * @param enable True for enabling cell broadcast with id range, otherwise for disabling. 455 * @param type GSM or CDMA 456 * @param start Cell broadcast id range start 457 * @param end Cell broadcast id range end 458 */ setCellBroadcastRange( SmsManager manager, boolean enable, int type, int start, int end)459 private boolean setCellBroadcastRange( 460 SmsManager manager, boolean enable, int type, int start, int end) { 461 if (enable) { 462 return manager.enableCellBroadcastRange(start, end, type); 463 } else { 464 return manager.disableCellBroadcastRange(start, end, type); 465 } 466 } 467 log(String msg)468 private static void log(String msg) { 469 Log.d(TAG, msg); 470 } 471 } 472