Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f42a0a27 authored by PauloftheWest's avatar PauloftheWest
Browse files

Refreshing Bluetooth devices will clear all available devices.

Bug: 16851309
Change-Id: I9ffb1ddaeb8e785be145ea79467fc361a022d8d7
parent 898671f1
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -249,6 +249,8 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
        if (!mAvailableDevicesCategoryIsPresent) {
            getPreferenceScreen().addPreference(mAvailableDevicesCategory);
        }
        mLocalManager.getCachedDeviceManager().clearCachedDevices();
        mAvailableDevicesCategory.removeAll();
        mLocalAdapter.startScanning(true);
    }

+7 −1
Original line number Diff line number Diff line
@@ -86,7 +86,9 @@ final class CachedBluetoothDeviceManager {
            BluetoothDevice device) {
        CachedBluetoothDevice newDevice = new CachedBluetoothDevice(mContext, adapter,
            profileManager, device);
        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;

+6 −0
Original line number Diff line number Diff line
@@ -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);