diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/java/android/server/BluetoothService.java | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java index ec8f031..01a6b94 100644 --- a/core/java/android/server/BluetoothService.java +++ b/core/java/android/server/BluetoothService.java @@ -2508,44 +2508,42 @@ public class BluetoothService extends IBluetooth.Stub { // dump pw.println("\n--Headset Service--"); if (mBluetoothHeadset != null) { - List<BluetoothDevice> deviceList = mBluetoothHeadset.getConnectedDevices(); - if (deviceList.size() == 0) { - pw.println("\n--No headsets connected--"); - } - BluetoothDevice device = deviceList.get(0); - - switch (mBluetoothHeadset.getConnectionState(device)) { - case BluetoothHeadset.STATE_DISCONNECTED: - pw.println("getConnectionState() = STATE_DISCONNECTED"); - break; - case BluetoothHeadset.STATE_CONNECTING: - pw.println("getConnectionState() = STATE_CONNECTING"); - break; - case BluetoothHeadset.STATE_CONNECTED: - pw.println("getConnectionState() = STATE_CONNECTED"); - break; - case BluetoothHeadset.STATE_DISCONNECTING: - pw.println("getConnectionState() = STATE_DISCONNECTING"); - break; - case BluetoothHeadset.STATE_AUDIO_CONNECTED: - pw.println("getConnectionState() = STATE_AUDIO_CONNECTED"); - break; + List<BluetoothDevice> deviceList = mBluetoothHeadset.getConnectedDevices(); + if (deviceList.size() == 0) { + pw.println("\n--No headsets connected--"); + } else { + BluetoothDevice device = deviceList.get(0); + pw.println("\ngetConnectedDevices[0] = " + device); + + switch (mBluetoothHeadset.getConnectionState(device)) { + case BluetoothHeadset.STATE_CONNECTING: + pw.println("getConnectionState() = STATE_CONNECTING"); + break; + case BluetoothHeadset.STATE_CONNECTED: + pw.println("getConnectionState() = STATE_CONNECTED"); + break; + case BluetoothHeadset.STATE_DISCONNECTING: + pw.println("getConnectionState() = STATE_DISCONNECTING"); + break; + case BluetoothHeadset.STATE_AUDIO_CONNECTED: + pw.println("getConnectionState() = STATE_AUDIO_CONNECTED"); + break; + } + pw.println("getBatteryUsageHint() = " + + mBluetoothHeadset.getBatteryUsageHint(device)); } deviceList.clear(); deviceList = mBluetoothHeadset.getDevicesMatchingConnectionStates(new int[] { BluetoothProfile.STATE_CONNECTED, BluetoothProfile.STATE_DISCONNECTED}); pw.println("\n--Connected and Disconnected Headsets"); - for (BluetoothDevice dev: deviceList) { + for (BluetoothDevice device: deviceList) { pw.println(device); if (mBluetoothHeadset.isAudioConnected(device)) { pw.println("SCO audio connected to device:" + device); } } - pw.println("\ngetCurrentHeadset() = " + device); - pw.println("getBatteryUsageHint() = " + - mBluetoothHeadset.getBatteryUsageHint(device)); mAdapter.closeProfileProxy(BluetoothProfile.HEADSET, mBluetoothHeadset); } |
