summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2015-03-25 14:12:12 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-03-25 14:12:13 +0000
commit039013c28ef634ab1b630292cc38fb57f206dffd (patch)
treef49a79ec102d1e27a7ea7e9db91ca20c21eed6f9 /packages
parent4b7b21ec834cd307e3d122f2d517778b13242dfb (diff)
parenta8f45e63c7e6012cb2567b68814c022810087eff (diff)
downloadframeworks_base-039013c28ef634ab1b630292cc38fb57f206dffd.zip
frameworks_base-039013c28ef634ab1b630292cc38fb57f206dffd.tar.gz
frameworks_base-039013c28ef634ab1b630292cc38fb57f206dffd.tar.bz2
Merge "Sort Bluetooth devices in quick settings by name"
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java6
2 files changed, 8 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java
index cbdd138..49693f5fe 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothController.java
@@ -37,7 +37,7 @@ public interface BluetoothController {
void onBluetoothPairedDevicesChanged();
}
- public static final class PairedDevice {
+ public static final class PairedDevice implements Comparable<PairedDevice> {
public static int STATE_DISCONNECTED = 0;
public static int STATE_CONNECTING = 1;
public static int STATE_CONNECTED = 2;
@@ -55,5 +55,9 @@ public interface BluetoothController {
if (state == STATE_DISCONNECTING) return "STATE_DISCONNECTING";
return "UNKNOWN";
}
+
+ public int compareTo(PairedDevice another) {
+ return name.compareTo(another.name);
+ }
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java
index 81e1e45..894f82a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java
@@ -45,7 +45,6 @@ import android.os.Looper;
import android.os.Message;
import android.os.ParcelUuid;
import android.util.ArrayMap;
-import android.util.ArraySet;
import android.util.Log;
import android.util.SparseArray;
@@ -55,6 +54,7 @@ import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Set;
+import java.util.TreeSet;
public class BluetoothControllerImpl implements BluetoothController {
private static final String TAG = "BluetoothController";
@@ -194,8 +194,8 @@ public class BluetoothControllerImpl implements BluetoothController {
}
@Override
- public ArraySet<PairedDevice> getPairedDevices() {
- final ArraySet<PairedDevice> rt = new ArraySet<>();
+ public Set<PairedDevice> getPairedDevices() {
+ final Set<PairedDevice> rt = new TreeSet<>();
for (int i = 0; i < mDeviceInfo.size(); i++) {
final BluetoothDevice device = mDeviceInfo.keyAt(i);
final DeviceInfo info = mDeviceInfo.valueAt(i);