Dump bonded Bluetooth devices in dumpsys.
Change-Id: Ie509b0abc64cbc7813e9fe844ff4c05d8cb05f9d
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.server;
|
|||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
|
import android.bluetooth.BluetoothDevice;
|
||||||
import android.bluetooth.BluetoothProfile;
|
import android.bluetooth.BluetoothProfile;
|
||||||
import android.bluetooth.IBluetooth;
|
import android.bluetooth.IBluetooth;
|
||||||
import android.bluetooth.IBluetoothGatt;
|
import android.bluetooth.IBluetoothGatt;
|
||||||
@@ -115,6 +116,13 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
private static final int SERVICE_IBLUETOOTH = 1;
|
private static final int SERVICE_IBLUETOOTH = 1;
|
||||||
private static final int SERVICE_IBLUETOOTHGATT = 2;
|
private static final int SERVICE_IBLUETOOTHGATT = 2;
|
||||||
|
|
||||||
|
private static final String[] DEVICE_TYPE_NAMES = new String[] {
|
||||||
|
"???",
|
||||||
|
"BR/EDR",
|
||||||
|
"LE",
|
||||||
|
"DUAL"
|
||||||
|
};
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
|
|
||||||
// Locks are not provided for mName and mAddress.
|
// Locks are not provided for mName and mAddress.
|
||||||
@@ -1530,12 +1538,19 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
writer.println(" state: " + mState);
|
writer.println(" state: " + mState);
|
||||||
writer.println(" address: " + mAddress);
|
writer.println(" address: " + mAddress);
|
||||||
writer.println(" name: " + mName + "\n");
|
writer.println(" name: " + mName + "\n");
|
||||||
writer.flush();
|
|
||||||
|
|
||||||
if (mBluetooth == null) {
|
if (mBluetooth == null) {
|
||||||
writer.println("Bluetooth Service not connected");
|
writer.println("Bluetooth Service not connected");
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
writer.println("Bonded devices:");
|
||||||
|
for (BluetoothDevice device : mBluetooth.getBondedDevices()) {
|
||||||
|
writer.println(" " + device.getAddress() +
|
||||||
|
" [" + DEVICE_TYPE_NAMES[device.getType()] + "] " +
|
||||||
|
device.getName());
|
||||||
|
}
|
||||||
|
writer.flush();
|
||||||
|
|
||||||
ParcelFileDescriptor pfd = ParcelFileDescriptor.dup(fd);
|
ParcelFileDescriptor pfd = ParcelFileDescriptor.dup(fd);
|
||||||
mBluetooth.dump(pfd);
|
mBluetooth.dump(pfd);
|
||||||
pfd.close();
|
pfd.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user