summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJake Hamby <jhamby@google.com>2011-03-29 13:31:54 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-03-29 13:31:54 -0700
commite9fdee0ed0ca2f2e0e83cda161906ca3a0a673a6 (patch)
tree56126d5babee6dcd518b47c80f630ee255c65a88 /src
parent388fc081bcca23525fa5a7cea58b8d4ae794d69c (diff)
parent81cb6be834f4604f6b58d8516f2b8e12620a3d16 (diff)
downloadpackages_apps_settings-e9fdee0ed0ca2f2e0e83cda161906ca3a0a673a6.zip
packages_apps_settings-e9fdee0ed0ca2f2e0e83cda161906ca3a0a673a6.tar.gz
packages_apps_settings-e9fdee0ed0ca2f2e0e83cda161906ca3a0a673a6.tar.bz2
am 81cb6be8: Merge "Fix NPE in WirelessSettings.onCreate() for SDK and non-BT devices." into honeycomb-mr1
* commit '81cb6be834f4604f6b58d8516f2b8e12620a3d16': Fix NPE in WirelessSettings.onCreate() for SDK and non-BT devices.
Diffstat (limited to 'src')
-rw-r--r--src/com/android/settings/WirelessSettings.java6
-rw-r--r--src/com/android/settings/bluetooth/BluetoothEnabler.java10
-rw-r--r--src/com/android/settings/bluetooth/BluetoothSettings.java2
3 files changed, 9 insertions, 9 deletions
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index 4b92749..2844f3b 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -19,8 +19,6 @@ package com.android.settings;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.TelephonyProperties;
import com.android.settings.bluetooth.BluetoothEnabler;
-import com.android.settings.bluetooth.LocalBluetoothAdapter;
-import com.android.settings.bluetooth.LocalBluetoothManager;
import com.android.settings.wifi.WifiEnabler;
import com.android.settings.nfc.NfcEnabler;
@@ -105,8 +103,7 @@ public class WirelessSettings extends SettingsPreferenceFragment {
mAirplaneModeEnabler = new AirplaneModeEnabler(activity, airplane);
mAirplaneModePreference = (CheckBoxPreference) findPreference(KEY_TOGGLE_AIRPLANE);
mWifiEnabler = new WifiEnabler(activity, wifi);
- mBtEnabler = new BluetoothEnabler(activity,
- LocalBluetoothManager.getInstance(activity).getBluetoothAdapter(), bt);
+ mBtEnabler = new BluetoothEnabler(activity, bt);
mNfcEnabler = new NfcEnabler(activity, nfc);
String toggleable = Settings.System.getString(activity.getContentResolver(),
@@ -128,6 +125,7 @@ public class WirelessSettings extends SettingsPreferenceFragment {
// Remove Bluetooth Settings if Bluetooth service is not available.
if (ServiceManager.getService(BluetoothAdapter.BLUETOOTH_SERVICE) == null) {
getPreferenceScreen().removePreference(bt);
+ getPreferenceScreen().removePreference(findPreference(KEY_BT_SETTINGS));
}
// Remove NFC if its not available
diff --git a/src/com/android/settings/bluetooth/BluetoothEnabler.java b/src/com/android/settings/bluetooth/BluetoothEnabler.java
index 9aeb1b9..79f23bb 100644
--- a/src/com/android/settings/bluetooth/BluetoothEnabler.java
+++ b/src/com/android/settings/bluetooth/BluetoothEnabler.java
@@ -50,17 +50,19 @@ public final class BluetoothEnabler implements Preference.OnPreferenceChangeList
}
};
- public BluetoothEnabler(Context context, LocalBluetoothAdapter adapter,
- CheckBoxPreference checkBox) {
+ public BluetoothEnabler(Context context, CheckBoxPreference checkBox) {
mContext = context;
mCheckBox = checkBox;
mOriginalSummary = checkBox.getSummary();
checkBox.setPersistent(false);
- mLocalAdapter = adapter;
- if (adapter == null) {
+ LocalBluetoothManager manager = LocalBluetoothManager.getInstance(context);
+ if (manager == null) {
// Bluetooth is not supported
+ mLocalAdapter = null;
checkBox.setEnabled(false);
+ } else {
+ mLocalAdapter = manager.getBluetoothAdapter();
}
mIntentFilter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
}
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index c6ba9af..5e4e130 100644
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -58,7 +58,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment {
void addPreferencesForActivity() {
addPreferencesFromResource(R.xml.bluetooth_settings);
- mEnabler = new BluetoothEnabler(getActivity(), mLocalAdapter,
+ mEnabler = new BluetoothEnabler(getActivity(),
(CheckBoxPreference) findPreference(KEY_BT_CHECKBOX));
mDiscoverableEnabler = new BluetoothDiscoverableEnabler(getActivity(),