summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPauloftheWest <paulofthewest@google.com>2014-08-11 06:18:32 -0700
committerPauloftheWest <paulofthewest@google.com>2014-08-12 07:35:11 -0700
commitf42a0a27e3b67602f63ab138e78fdefde81a40b6 (patch)
treee29b4f20019c2af0c5fce5de9afff123ddfe445a /src
parent898671f14123695d74bd308450a462d11a341d1a (diff)
downloadpackages_apps_Settings-f42a0a27e3b67602f63ab138e78fdefde81a40b6.zip
packages_apps_Settings-f42a0a27e3b67602f63ab138e78fdefde81a40b6.tar.gz
packages_apps_Settings-f42a0a27e3b67602f63ab138e78fdefde81a40b6.tar.bz2
Refreshing Bluetooth devices will clear all available devices.
Bug: 16851309 Change-Id: I9ffb1ddaeb8e785be145ea79467fc361a022d8d7
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/android/settings/bluetooth/BluetoothSettings.java4
-rwxr-xr-xsrc/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java8
-rw-r--r--src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java6
3 files changed, 16 insertions, 2 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java
index 4b278ac..bbd86a1 100755
--- a/src/com/android/settings/bluetooth/BluetoothSettings.java
+++ b/src/com/android/settings/bluetooth/BluetoothSettings.java
@@ -249,6 +249,8 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
if (!mAvailableDevicesCategoryIsPresent) {
getPreferenceScreen().addPreference(mAvailableDevicesCategory);
}
+ mLocalManager.getCachedDeviceManager().clearCachedDevices();
+ mAvailableDevicesCategory.removeAll();
mLocalAdapter.startScanning(true);
}
@@ -405,7 +407,7 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
LayoutInflater inflater = getActivity().getLayoutInflater();
mSettingsDialogView = inflater.inflate(R.layout.bluetooth_device_picker, null);
profileFrag = (DeviceProfilesSettings)activity.getFragmentManager()
- .findFragmentById(R.id.bluetooth_fragment_settings);
+ .findFragmentById(R.id.bluetooth_fragment_settings);
}
final View dialogLayout = mSettingsDialogView;
diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java b/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java
index ff282cc..0b53b1a 100755
--- a/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java
+++ b/src/com/android/settings/bluetooth/CachedBluetoothDeviceManager.java
@@ -86,7 +86,9 @@ final class CachedBluetoothDeviceManager {
BluetoothDevice device) {
CachedBluetoothDevice newDevice = new CachedBluetoothDevice(mContext, adapter,
profileManager, device);
- mCachedDevices.add(newDevice);
+ synchronized (mCachedDevices) {
+ mCachedDevices.add(newDevice);
+ }
return newDevice;
}
@@ -110,6 +112,10 @@ final class CachedBluetoothDeviceManager {
return device.getAddress();
}
+ public synchronized void clearCachedDevices() {
+ mCachedDevices.clear();
+ }
+
public synchronized void onScanningStateChanged(boolean started) {
if (!started) return;
diff --git a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
index f482ecd..e7208b5 100644
--- a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
+++ b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
@@ -167,6 +167,12 @@ public abstract class DeviceListPreferenceFragment extends
}
void createDevicePreference(CachedBluetoothDevice cachedDevice) {
+ if (mDeviceListGroup == null) {
+ Log.w(TAG, "Trying to create a device preference before the list group/category "
+ + "exists!");
+ return;
+ }
+
BluetoothDevicePreference preference = new BluetoothDevicePreference(
getActivity(), cachedDevice);