WirelessSettings.java revision fc1b00cfe439b0c462b3acbba709c3cbc1132a1f
1/* 2 * Copyright (C) 2009 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 17package com.android.settings; 18 19 20import android.app.Activity; 21import android.app.AlertDialog; 22import android.app.Dialog; 23import android.app.admin.DevicePolicyManager; 24import android.content.ActivityNotFoundException; 25import android.content.ComponentName; 26import android.content.Context; 27import android.content.DialogInterface; 28import android.content.Intent; 29import android.content.pm.PackageManager; 30import android.content.res.Resources; 31import android.net.ConnectivityManager; 32import android.net.NetworkInfo; 33import android.net.Uri; 34import android.nfc.NfcAdapter; 35import android.nfc.NfcManager; 36import android.os.Bundle; 37import android.os.SystemProperties; 38import android.os.UserHandle; 39import android.os.UserManager; 40import android.preference.Preference; 41import android.preference.Preference.OnPreferenceChangeListener; 42import android.preference.PreferenceScreen; 43import android.preference.SwitchPreference; 44import android.provider.SearchIndexableResource; 45import android.provider.Settings; 46import android.telephony.TelephonyManager; 47import android.text.TextUtils; 48import android.util.Log; 49 50import com.android.internal.telephony.SmsApplication; 51import com.android.internal.telephony.SmsApplication.SmsApplicationData; 52import com.android.internal.telephony.TelephonyIntents; 53import com.android.internal.telephony.TelephonyProperties; 54import com.android.settings.nfc.NfcEnabler; 55import com.android.settings.search.BaseSearchIndexProvider; 56import com.android.settings.search.Indexable; 57 58import java.util.ArrayList; 59import java.util.Arrays; 60import java.util.Collection; 61import java.util.List; 62 63public class WirelessSettings extends SettingsPreferenceFragment 64 implements OnPreferenceChangeListener, Indexable { 65 private static final String TAG = "WirelessSettings"; 66 67 private static final String KEY_TOGGLE_AIRPLANE = "toggle_airplane"; 68 private static final String KEY_TOGGLE_NFC = "toggle_nfc"; 69 private static final String KEY_WIMAX_SETTINGS = "wimax_settings"; 70 private static final String KEY_ANDROID_BEAM_SETTINGS = "android_beam_settings"; 71 private static final String KEY_VPN_SETTINGS = "vpn_settings"; 72 private static final String KEY_TETHER_SETTINGS = "tether_settings"; 73 private static final String KEY_PROXY_SETTINGS = "proxy_settings"; 74 private static final String KEY_MOBILE_NETWORK_SETTINGS = "mobile_network_settings"; 75 private static final String KEY_MANAGE_MOBILE_PLAN = "manage_mobile_plan"; 76 private static final String KEY_SMS_APPLICATION = "sms_application"; 77 private static final String KEY_TOGGLE_NSD = "toggle_nsd"; //network service discovery 78 private static final String KEY_CELL_BROADCAST_SETTINGS = "cell_broadcast_settings"; 79 80 public static final String EXIT_ECM_RESULT = "exit_ecm_result"; 81 public static final int REQUEST_CODE_EXIT_ECM = 1; 82 83 private AirplaneModeEnabler mAirplaneModeEnabler; 84 private SwitchPreference mAirplaneModePreference; 85 private NfcEnabler mNfcEnabler; 86 private NfcAdapter mNfcAdapter; 87 private NsdEnabler mNsdEnabler; 88 89 private ConnectivityManager mCm; 90 private TelephonyManager mTm; 91 private PackageManager mPm; 92 private UserManager mUm; 93 94 private static final int MANAGE_MOBILE_PLAN_DIALOG_ID = 1; 95 private static final String SAVED_MANAGE_MOBILE_PLAN_MSG = "mManageMobilePlanMessage"; 96 97 private AppListPreference mSmsApplicationPreference; 98 99 /** 100 * Invoked on each preference click in this hierarchy, overrides 101 * PreferenceFragment's implementation. Used to make sure we track the 102 * preference click events. 103 */ 104 @Override 105 public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { 106 log("onPreferenceTreeClick: preference=" + preference); 107 if (preference == mAirplaneModePreference && Boolean.parseBoolean( 108 SystemProperties.get(TelephonyProperties.PROPERTY_INECM_MODE))) { 109 // In ECM mode launch ECM app dialog 110 startActivityForResult( 111 new Intent(TelephonyIntents.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS, null), 112 REQUEST_CODE_EXIT_ECM); 113 return true; 114 } else if (preference == findPreference(KEY_MANAGE_MOBILE_PLAN)) { 115 onManageMobilePlanClick(); 116 } 117 // Let the intents be launched by the Preference manager 118 return super.onPreferenceTreeClick(preferenceScreen, preference); 119 } 120 121 private String mManageMobilePlanMessage; 122 public void onManageMobilePlanClick() { 123 log("onManageMobilePlanClick:"); 124 mManageMobilePlanMessage = null; 125 Resources resources = getActivity().getResources(); 126 127 NetworkInfo ni = mCm.getProvisioningOrActiveNetworkInfo(); 128 if (mTm.hasIccCard() && (ni != null)) { 129 // Check for carrier apps that can handle provisioning first 130 Intent provisioningIntent = new Intent(TelephonyIntents.ACTION_CARRIER_SETUP); 131 List<String> carrierPackages = 132 mTm.getCarrierPackageNamesForIntent(provisioningIntent); 133 if (carrierPackages != null && !carrierPackages.isEmpty()) { 134 if (carrierPackages.size() != 1) { 135 Log.w(TAG, "Multiple matching carrier apps found, launching the first."); 136 } 137 provisioningIntent.setPackage(carrierPackages.get(0)); 138 startActivity(provisioningIntent); 139 return; 140 } 141 142 // Get provisioning URL 143 String url = mCm.getMobileProvisioningUrl(); 144 if (!TextUtils.isEmpty(url)) { 145 Intent intent = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN, 146 Intent.CATEGORY_APP_BROWSER); 147 intent.setData(Uri.parse(url)); 148 intent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT | 149 Intent.FLAG_ACTIVITY_NEW_TASK); 150 try { 151 startActivity(intent); 152 } catch (ActivityNotFoundException e) { 153 Log.w(TAG, "onManageMobilePlanClick: startActivity failed" + e); 154 } 155 } else { 156 // No provisioning URL 157 String operatorName = mTm.getSimOperatorName(); 158 if (TextUtils.isEmpty(operatorName)) { 159 // Use NetworkOperatorName as second choice in case there is no 160 // SPN (Service Provider Name on the SIM). Such as with T-mobile. 161 operatorName = mTm.getNetworkOperatorName(); 162 if (TextUtils.isEmpty(operatorName)) { 163 mManageMobilePlanMessage = resources.getString( 164 R.string.mobile_unknown_sim_operator); 165 } else { 166 mManageMobilePlanMessage = resources.getString( 167 R.string.mobile_no_provisioning_url, operatorName); 168 } 169 } else { 170 mManageMobilePlanMessage = resources.getString( 171 R.string.mobile_no_provisioning_url, operatorName); 172 } 173 } 174 } else if (mTm.hasIccCard() == false) { 175 // No sim card 176 mManageMobilePlanMessage = resources.getString(R.string.mobile_insert_sim_card); 177 } else { 178 // NetworkInfo is null, there is no connection 179 mManageMobilePlanMessage = resources.getString(R.string.mobile_connect_to_internet); 180 } 181 if (!TextUtils.isEmpty(mManageMobilePlanMessage)) { 182 log("onManageMobilePlanClick: message=" + mManageMobilePlanMessage); 183 showDialog(MANAGE_MOBILE_PLAN_DIALOG_ID); 184 } 185 } 186 187 private void initSmsApplicationSetting() { 188 log("initSmsApplicationSetting:"); 189 Collection<SmsApplicationData> smsApplications = 190 SmsApplication.getApplicationCollection(getActivity()); 191 192 // If the list is empty the dialog will be empty, but we will not crash. 193 int count = smsApplications.size(); 194 String[] packageNames = new String[count]; 195 int i = 0; 196 for (SmsApplicationData smsApplicationData : smsApplications) { 197 packageNames[i] = smsApplicationData.mPackageName; 198 i++; 199 } 200 String defaultPackageName = null; 201 ComponentName appName = SmsApplication.getDefaultSmsApplication(getActivity(), true); 202 if (appName != null) { 203 defaultPackageName = appName.getPackageName(); 204 } 205 mSmsApplicationPreference.setPackageNames(packageNames, defaultPackageName); 206 } 207 208 @Override 209 public Dialog onCreateDialog(int dialogId) { 210 log("onCreateDialog: dialogId=" + dialogId); 211 switch (dialogId) { 212 case MANAGE_MOBILE_PLAN_DIALOG_ID: 213 return new AlertDialog.Builder(getActivity()) 214 .setMessage(mManageMobilePlanMessage) 215 .setCancelable(false) 216 .setPositiveButton(com.android.internal.R.string.ok, 217 new DialogInterface.OnClickListener() { 218 @Override 219 public void onClick(DialogInterface dialog, int id) { 220 log("MANAGE_MOBILE_PLAN_DIALOG.onClickListener id=" + id); 221 mManageMobilePlanMessage = null; 222 } 223 }) 224 .create(); 225 } 226 return super.onCreateDialog(dialogId); 227 } 228 229 private void log(String s) { 230 Log.d(TAG, s); 231 } 232 233 private boolean isSmsSupported() { 234 // Some tablet has sim card but could not do telephony operations. Skip those. 235 return mTm.isSmsCapable(); 236 } 237 238 @Override 239 public void onCreate(Bundle savedInstanceState) { 240 super.onCreate(savedInstanceState); 241 if (savedInstanceState != null) { 242 mManageMobilePlanMessage = savedInstanceState.getString(SAVED_MANAGE_MOBILE_PLAN_MSG); 243 } 244 log("onCreate: mManageMobilePlanMessage=" + mManageMobilePlanMessage); 245 246 mCm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); 247 mTm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); 248 mPm = getPackageManager(); 249 mUm = (UserManager) getSystemService(Context.USER_SERVICE); 250 251 addPreferencesFromResource(R.xml.wireless_settings); 252 253 final int myUserId = UserHandle.myUserId(); 254 final boolean isSecondaryUser = myUserId != UserHandle.USER_OWNER; 255 final boolean isRestrictedUser = mUm.getUserInfo(myUserId).isRestricted(); 256 257 final Activity activity = getActivity(); 258 mAirplaneModePreference = (SwitchPreference) findPreference(KEY_TOGGLE_AIRPLANE); 259 SwitchPreference nfc = (SwitchPreference) findPreference(KEY_TOGGLE_NFC); 260 PreferenceScreen androidBeam = (PreferenceScreen) findPreference(KEY_ANDROID_BEAM_SETTINGS); 261 SwitchPreference nsd = (SwitchPreference) findPreference(KEY_TOGGLE_NSD); 262 263 mAirplaneModeEnabler = new AirplaneModeEnabler(activity, mAirplaneModePreference); 264 mNfcEnabler = new NfcEnabler(activity, nfc, androidBeam); 265 266 mSmsApplicationPreference = (AppListPreference) findPreference(KEY_SMS_APPLICATION); 267 // Restricted users cannot currently read/write SMS. 268 if (isRestrictedUser) { 269 removePreference(KEY_SMS_APPLICATION); 270 } else { 271 mSmsApplicationPreference.setOnPreferenceChangeListener(this); 272 initSmsApplicationSetting(); 273 } 274 275 // Remove NSD checkbox by default 276 getPreferenceScreen().removePreference(nsd); 277 //mNsdEnabler = new NsdEnabler(activity, nsd); 278 279 String toggleable = Settings.Global.getString(activity.getContentResolver(), 280 Settings.Global.AIRPLANE_MODE_TOGGLEABLE_RADIOS); 281 282 //enable/disable wimax depending on the value in config.xml 283 final boolean isWimaxEnabled = !isSecondaryUser && this.getResources().getBoolean( 284 com.android.internal.R.bool.config_wimaxEnabled); 285 if (!isWimaxEnabled 286 || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) { 287 PreferenceScreen root = getPreferenceScreen(); 288 Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS); 289 if (ps != null) root.removePreference(ps); 290 } else { 291 if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIMAX ) 292 && isWimaxEnabled) { 293 Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS); 294 ps.setDependency(KEY_TOGGLE_AIRPLANE); 295 } 296 } 297 298 // Manually set dependencies for Wifi when not toggleable. 299 if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_WIFI)) { 300 findPreference(KEY_VPN_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE); 301 } 302 // Disable VPN. 303 if (isSecondaryUser || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) { 304 removePreference(KEY_VPN_SETTINGS); 305 } 306 307 // Manually set dependencies for Bluetooth when not toggleable. 308 if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_BLUETOOTH)) { 309 // No bluetooth-dependent items in the list. Code kept in case one is added later. 310 } 311 312 // Manually set dependencies for NFC when not toggleable. 313 if (toggleable == null || !toggleable.contains(Settings.Global.RADIO_NFC)) { 314 findPreference(KEY_TOGGLE_NFC).setDependency(KEY_TOGGLE_AIRPLANE); 315 findPreference(KEY_ANDROID_BEAM_SETTINGS).setDependency(KEY_TOGGLE_AIRPLANE); 316 } 317 318 // Remove NFC if not available 319 mNfcAdapter = NfcAdapter.getDefaultAdapter(activity); 320 if (mNfcAdapter == null) { 321 getPreferenceScreen().removePreference(nfc); 322 getPreferenceScreen().removePreference(androidBeam); 323 mNfcEnabler = null; 324 } 325 326 // Remove Mobile Network Settings and Manage Mobile Plan for secondary users, 327 // if it's a wifi-only device, or if the settings are restricted. 328 if (isSecondaryUser || Utils.isWifiOnly(getActivity()) 329 || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) { 330 removePreference(KEY_MOBILE_NETWORK_SETTINGS); 331 removePreference(KEY_MANAGE_MOBILE_PLAN); 332 } 333 // Remove Mobile Network Settings and Manage Mobile Plan 334 // if config_show_mobile_plan sets false. 335 final boolean isMobilePlanEnabled = this.getResources().getBoolean( 336 R.bool.config_show_mobile_plan); 337 if (!isMobilePlanEnabled) { 338 Preference pref = findPreference(KEY_MANAGE_MOBILE_PLAN); 339 if (pref != null) { 340 removePreference(KEY_MANAGE_MOBILE_PLAN); 341 } 342 } 343 344 // Remove SMS Application if the device does not support SMS 345 if (!isSmsSupported()) { 346 removePreference(KEY_SMS_APPLICATION); 347 } 348 349 // Remove Airplane Mode settings if it's a stationary device such as a TV. 350 if (mPm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)) { 351 removePreference(KEY_TOGGLE_AIRPLANE); 352 } 353 354 // Enable Proxy selector settings if allowed. 355 Preference mGlobalProxy = findPreference(KEY_PROXY_SETTINGS); 356 final DevicePolicyManager mDPM = (DevicePolicyManager) 357 activity.getSystemService(Context.DEVICE_POLICY_SERVICE); 358 // proxy UI disabled until we have better app support 359 getPreferenceScreen().removePreference(mGlobalProxy); 360 mGlobalProxy.setEnabled(mDPM.getGlobalProxyAdmin() == null); 361 362 // Disable Tethering if it's not allowed or if it's a wifi-only device 363 final ConnectivityManager cm = 364 (ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE); 365 if (isSecondaryUser || !cm.isTetheringSupported() 366 || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) { 367 getPreferenceScreen().removePreference(findPreference(KEY_TETHER_SETTINGS)); 368 } else { 369 Preference p = findPreference(KEY_TETHER_SETTINGS); 370 p.setTitle(Utils.getTetheringLabel(cm)); 371 372 // Grey out if provisioning is not available. 373 p.setEnabled(!TetherSettings 374 .isProvisioningNeededButUnavailable(getActivity())); 375 } 376 377 // Enable link to CMAS app settings depending on the value in config.xml. 378 boolean isCellBroadcastAppLinkEnabled = this.getResources().getBoolean( 379 com.android.internal.R.bool.config_cellBroadcastAppLinks); 380 try { 381 if (isCellBroadcastAppLinkEnabled) { 382 if (mPm.getApplicationEnabledSetting("com.android.cellbroadcastreceiver") 383 == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) { 384 isCellBroadcastAppLinkEnabled = false; // CMAS app disabled 385 } 386 } 387 } catch (IllegalArgumentException ignored) { 388 isCellBroadcastAppLinkEnabled = false; // CMAS app not installed 389 } 390 if (isSecondaryUser || !isCellBroadcastAppLinkEnabled 391 || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_CELL_BROADCASTS)) { 392 PreferenceScreen root = getPreferenceScreen(); 393 Preference ps = findPreference(KEY_CELL_BROADCAST_SETTINGS); 394 if (ps != null) root.removePreference(ps); 395 } 396 } 397 398 @Override 399 public void onStart() { 400 super.onStart(); 401 402 initSmsApplicationSetting(); 403 } 404 405 @Override 406 public void onResume() { 407 super.onResume(); 408 409 mAirplaneModeEnabler.resume(); 410 if (mNfcEnabler != null) { 411 mNfcEnabler.resume(); 412 } 413 if (mNsdEnabler != null) { 414 mNsdEnabler.resume(); 415 } 416 } 417 418 @Override 419 public void onSaveInstanceState(Bundle outState) { 420 super.onSaveInstanceState(outState); 421 422 if (!TextUtils.isEmpty(mManageMobilePlanMessage)) { 423 outState.putString(SAVED_MANAGE_MOBILE_PLAN_MSG, mManageMobilePlanMessage); 424 } 425 } 426 427 @Override 428 public void onPause() { 429 super.onPause(); 430 431 mAirplaneModeEnabler.pause(); 432 if (mNfcEnabler != null) { 433 mNfcEnabler.pause(); 434 } 435 if (mNsdEnabler != null) { 436 mNsdEnabler.pause(); 437 } 438 } 439 440 @Override 441 public void onActivityResult(int requestCode, int resultCode, Intent data) { 442 if (requestCode == REQUEST_CODE_EXIT_ECM) { 443 Boolean isChoiceYes = data.getBooleanExtra(EXIT_ECM_RESULT, false); 444 // Set Airplane mode based on the return value and checkbox state 445 mAirplaneModeEnabler.setAirplaneModeInECM(isChoiceYes, 446 mAirplaneModePreference.isChecked()); 447 } 448 super.onActivityResult(requestCode, resultCode, data); 449 } 450 451 @Override 452 protected int getHelpResource() { 453 return R.string.help_url_more_networks; 454 } 455 456 @Override 457 public boolean onPreferenceChange(Preference preference, Object newValue) { 458 if (preference == mSmsApplicationPreference && newValue != null) { 459 SmsApplication.setDefaultApplication(newValue.toString(), getActivity()); 460 return true; 461 } 462 return false; 463 } 464 465 /** 466 * For Search. 467 */ 468 public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = 469 new BaseSearchIndexProvider() { 470 @Override 471 public List<SearchIndexableResource> getXmlResourcesToIndex( 472 Context context, boolean enabled) { 473 SearchIndexableResource sir = new SearchIndexableResource(context); 474 sir.xmlResId = R.xml.wireless_settings; 475 return Arrays.asList(sir); 476 } 477 478 @Override 479 public List<String> getNonIndexableKeys(Context context) { 480 final ArrayList<String> result = new ArrayList<String>(); 481 482 result.add(KEY_TOGGLE_NSD); 483 484 final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE); 485 final int myUserId = UserHandle.myUserId(); 486 final boolean isSecondaryUser = myUserId != UserHandle.USER_OWNER; 487 final boolean isRestrictedUser = um.getUserInfo(myUserId).isRestricted(); 488 final boolean isWimaxEnabled = !isSecondaryUser 489 && context.getResources().getBoolean( 490 com.android.internal.R.bool.config_wimaxEnabled); 491 if (!isWimaxEnabled 492 || um.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) { 493 result.add(KEY_WIMAX_SETTINGS); 494 } 495 496 if (isSecondaryUser) { // Disable VPN 497 result.add(KEY_VPN_SETTINGS); 498 } 499 500 // Remove NFC if not available 501 final NfcManager manager = (NfcManager) 502 context.getSystemService(Context.NFC_SERVICE); 503 if (manager != null) { 504 NfcAdapter adapter = manager.getDefaultAdapter(); 505 if (adapter == null) { 506 result.add(KEY_TOGGLE_NFC); 507 result.add(KEY_ANDROID_BEAM_SETTINGS); 508 } 509 } 510 511 // Remove Mobile Network Settings and Manage Mobile Plan if it's a wifi-only device. 512 if (isSecondaryUser || Utils.isWifiOnly(context)) { 513 result.add(KEY_MOBILE_NETWORK_SETTINGS); 514 result.add(KEY_MANAGE_MOBILE_PLAN); 515 } 516 517 // Remove Mobile Network Settings and Manage Mobile Plan 518 // if config_show_mobile_plan sets false. 519 final boolean isMobilePlanEnabled = context.getResources().getBoolean( 520 R.bool.config_show_mobile_plan); 521 if (!isMobilePlanEnabled) { 522 result.add(KEY_MANAGE_MOBILE_PLAN); 523 } 524 525 // Remove SMS Application if the device does not support SMS 526 TelephonyManager tm = 527 (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); 528 if (!tm.isSmsCapable() || isRestrictedUser) { 529 result.add(KEY_SMS_APPLICATION); 530 } 531 532 final PackageManager pm = context.getPackageManager(); 533 534 // Remove Airplane Mode settings if it's a stationary device such as a TV. 535 if (pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)) { 536 result.add(KEY_TOGGLE_AIRPLANE); 537 } 538 539 // proxy UI disabled until we have better app support 540 result.add(KEY_PROXY_SETTINGS); 541 542 // Disable Tethering if it's not allowed or if it's a wifi-only device 543 ConnectivityManager cm = (ConnectivityManager) 544 context.getSystemService(Context.CONNECTIVITY_SERVICE); 545 if (isSecondaryUser || !cm.isTetheringSupported()) { 546 result.add(KEY_TETHER_SETTINGS); 547 } 548 549 // Enable link to CMAS app settings depending on the value in config.xml. 550 boolean isCellBroadcastAppLinkEnabled = context.getResources().getBoolean( 551 com.android.internal.R.bool.config_cellBroadcastAppLinks); 552 try { 553 if (isCellBroadcastAppLinkEnabled) { 554 if (pm.getApplicationEnabledSetting("com.android.cellbroadcastreceiver") 555 == PackageManager.COMPONENT_ENABLED_STATE_DISABLED) { 556 isCellBroadcastAppLinkEnabled = false; // CMAS app disabled 557 } 558 } 559 } catch (IllegalArgumentException ignored) { 560 isCellBroadcastAppLinkEnabled = false; // CMAS app not installed 561 } 562 if (isSecondaryUser || !isCellBroadcastAppLinkEnabled) { 563 result.add(KEY_CELL_BROADCAST_SETTINGS); 564 } 565 566 return result; 567 } 568 }; 569} 570