Merge "IBluetooth: remove dump(), support arguments"
This commit is contained in:
@@ -102,8 +102,6 @@ interface IBluetooth
|
|||||||
void getActivityEnergyInfoFromController();
|
void getActivityEnergyInfoFromController();
|
||||||
BluetoothActivityEnergyInfo reportActivityInfo();
|
BluetoothActivityEnergyInfo reportActivityInfo();
|
||||||
|
|
||||||
// For dumpsys support
|
|
||||||
void dump(in ParcelFileDescriptor fd);
|
|
||||||
void onLeServiceUp();
|
void onLeServiceUp();
|
||||||
void onBrEdrDown();
|
void onBrEdrDown();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,13 +116,6 @@ 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;
|
||||||
private static int mBleAppCount = 0;
|
private static int mBleAppCount = 0;
|
||||||
|
|
||||||
@@ -133,6 +126,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
private final ContentResolver mContentResolver;
|
private final ContentResolver mContentResolver;
|
||||||
private final RemoteCallbackList<IBluetoothManagerCallback> mCallbacks;
|
private final RemoteCallbackList<IBluetoothManagerCallback> mCallbacks;
|
||||||
private final RemoteCallbackList<IBluetoothStateChangeCallback> mStateChangeCallbacks;
|
private final RemoteCallbackList<IBluetoothStateChangeCallback> mStateChangeCallbacks;
|
||||||
|
private IBinder mBluetoothBinder;
|
||||||
private IBluetooth mBluetooth;
|
private IBluetooth mBluetooth;
|
||||||
private IBluetoothGatt mBluetoothGatt;
|
private IBluetoothGatt mBluetoothGatt;
|
||||||
private boolean mBinding;
|
private boolean mBinding;
|
||||||
@@ -244,6 +238,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
|
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mBluetooth = null;
|
mBluetooth = null;
|
||||||
|
mBluetoothBinder = null;
|
||||||
mBluetoothGatt = null;
|
mBluetoothGatt = null;
|
||||||
mBinding = false;
|
mBinding = false;
|
||||||
mUnbinding = false;
|
mUnbinding = false;
|
||||||
@@ -690,6 +685,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (DBG) Log.d(TAG, "Sending unbind request.");
|
if (DBG) Log.d(TAG, "Sending unbind request.");
|
||||||
|
mBluetoothBinder = null;
|
||||||
mBluetooth = null;
|
mBluetooth = null;
|
||||||
//Unbind
|
//Unbind
|
||||||
mContext.unbindService(mConnection);
|
mContext.unbindService(mConnection);
|
||||||
@@ -1296,6 +1292,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
|
mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
|
||||||
|
|
||||||
mBinding = false;
|
mBinding = false;
|
||||||
|
mBluetoothBinder = service;
|
||||||
mBluetooth = IBluetooth.Stub.asInterface(service);
|
mBluetooth = IBluetooth.Stub.asInterface(service);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -1834,41 +1831,13 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
@Override
|
@Override
|
||||||
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
|
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
|
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
|
||||||
|
if (mBluetoothBinder == null) {
|
||||||
writer.println("Bluetooth Status");
|
|
||||||
writer.println(" enabled: " + mEnable);
|
|
||||||
writer.println(" state: " + mState);
|
|
||||||
writer.println(" address: " + mAddress);
|
|
||||||
writer.println(" name: " + mName + "\n");
|
|
||||||
writer.flush();
|
|
||||||
|
|
||||||
if (mBluetooth == null) {
|
|
||||||
writer.println("Bluetooth Service not connected");
|
writer.println("Bluetooth Service not connected");
|
||||||
} else {
|
} else {
|
||||||
ParcelFileDescriptor pfd = null;
|
|
||||||
try {
|
try {
|
||||||
writer.println("Bonded devices:");
|
mBluetoothBinder.dump(fd, args);
|
||||||
for (BluetoothDevice device : mBluetooth.getBondedDevices()) {
|
|
||||||
writer.println(" " + device.getAddress() +
|
|
||||||
" [" + DEVICE_TYPE_NAMES[device.getType()] + "] " +
|
|
||||||
device.getName());
|
|
||||||
}
|
|
||||||
writer.flush();
|
|
||||||
|
|
||||||
pfd = ParcelFileDescriptor.dup(fd);
|
|
||||||
mBluetooth.dump(pfd);
|
|
||||||
} catch (RemoteException re) {
|
} catch (RemoteException re) {
|
||||||
writer.println("RemoteException while calling Bluetooth Service");
|
writer.println("RemoteException while calling Bluetooth Service");
|
||||||
} catch (IOException ioe) {
|
|
||||||
writer.println("IOException attempting to dup() fd");
|
|
||||||
} finally {
|
|
||||||
if (pfd != null) {
|
|
||||||
try {
|
|
||||||
pfd.close();
|
|
||||||
} catch (IOException ioe) {
|
|
||||||
writer.println("IOException attempting to close() fd");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user