diff options
author | Shaleen Jain <shaleen.jain95@gmail.com> | 2015-01-30 07:39:24 +0530 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-10-26 16:11:14 -0700 |
commit | 4bb7a97b0477d98d74d4ea7e769ccc201b4d4e5a (patch) | |
tree | 87a31870743ac2208d92f9debd4ff1b6fbcf2942 /src/com/android/settings/profiles | |
parent | 0a34d3d16555f77bdaada3a6a64af22751d09013 (diff) | |
download | packages_apps_Settings-4bb7a97b0477d98d74d4ea7e769ccc201b4d4e5a.zip packages_apps_Settings-4bb7a97b0477d98d74d4ea7e769ccc201b4d4e5a.tar.gz packages_apps_Settings-4bb7a97b0477d98d74d4ea7e769ccc201b4d4e5a.tar.bz2 |
Profiles: check if device supports connection before reading values.
Change-Id: I9346fd5df42a41d8e1fc2f7228f47bae3a8a7688
Diffstat (limited to 'src/com/android/settings/profiles')
-rw-r--r-- | src/com/android/settings/profiles/SetupActionsFragment.java | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/com/android/settings/profiles/SetupActionsFragment.java b/src/com/android/settings/profiles/SetupActionsFragment.java index 4f7e5fa..2f5e14d 100644 --- a/src/com/android/settings/profiles/SetupActionsFragment.java +++ b/src/com/android/settings/profiles/SetupActionsFragment.java @@ -36,7 +36,6 @@ import android.media.RingtoneManager; import android.net.ConnectivityManager; import android.net.wifi.WifiManager; import android.net.wimax.WimaxHelper; -import android.nfc.NfcAdapter; import android.nfc.NfcManager; import android.os.AsyncTask; import android.os.Bundle; @@ -307,11 +306,11 @@ public class SetupActionsFragment extends SettingsPreferenceFragment @Override protected Void doInBackground(Profile... params) { // bt - BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter(); - if (btAdapter != null) { + if (DeviceUtils.deviceSupportsBluetooth()) { mProfile.setConnectionSettings( new ConnectionSettings(ConnectionSettings.PROFILE_CONNECTION_BLUETOOTH, - btAdapter.isEnabled() ? 1 : 0, true)); + BluetoothAdapter.getDefaultAdapter().isEnabled() ? 1 : 0, + true)); } // gps @@ -335,11 +334,13 @@ public class SetupActionsFragment extends SettingsPreferenceFragment ContentResolver.getMasterSyncAutomatically() ? 1 : 0, true)); // mobile data - ConnectivityManager cm = (ConnectivityManager) - getSystemService(Context.CONNECTIVITY_SERVICE); - mProfile.setConnectionSettings( - new ConnectionSettings(ConnectionSettings.PROFILE_CONNECTION_MOBILEDATA, - cm.getMobileDataEnabled() ? 1 : 0, true)); + if (DeviceUtils.deviceSupportsMobileData(getActivity())) { + ConnectivityManager cm = (ConnectivityManager) + getSystemService(Context.CONNECTIVITY_SERVICE); + mProfile.setConnectionSettings( + new ConnectionSettings(ConnectionSettings.PROFILE_CONNECTION_MOBILEDATA, + cm.getMobileDataEnabled() ? 1 : 0, true)); + } // wifi hotspot mProfile.setConnectionSettings( @@ -350,12 +351,11 @@ public class SetupActionsFragment extends SettingsPreferenceFragment // skipping this one // nfc - NfcManager nfcManager = (NfcManager) getSystemService(Context.NFC_SERVICE); - NfcAdapter nfcAdapter = nfcManager.getDefaultAdapter(); - if (nfcAdapter != null) { + if (DeviceUtils.deviceSupportsNfc(getActivity())) { + NfcManager nfcManager = (NfcManager) getSystemService(Context.NFC_SERVICE); mProfile.setConnectionSettings( new ConnectionSettings(ConnectionSettings.PROFILE_CONNECTION_NFC, - nfcAdapter.isEnabled() ? 1 : 0, true)); + nfcManager.getDefaultAdapter().isEnabled() ? 1 : 0, true)); } // alarm volume |