Merge "IBluetooth: remove dump(), support arguments"
am: d63847a866
* commit 'd63847a86680df271cc518a6baaac30a7e07c9f5':
IBluetooth: remove dump(), support arguments
diff --git a/core/java/android/bluetooth/IBluetooth.aidl b/core/java/android/bluetooth/IBluetooth.aidl
index 66f3418..2358116 100644
--- a/core/java/android/bluetooth/IBluetooth.aidl
+++ b/core/java/android/bluetooth/IBluetooth.aidl
@@ -102,8 +102,6 @@
void getActivityEnergyInfoFromController();
BluetoothActivityEnergyInfo reportActivityInfo();
- // For dumpsys support
- void dump(in ParcelFileDescriptor fd);
void onLeServiceUp();
void onBrEdrDown();
}
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index d5c4a41..a2b1aa8 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -116,13 +116,6 @@
private static final int SERVICE_IBLUETOOTH = 1;
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 static int mBleAppCount = 0;
@@ -133,6 +126,7 @@
private final ContentResolver mContentResolver;
private final RemoteCallbackList<IBluetoothManagerCallback> mCallbacks;
private final RemoteCallbackList<IBluetoothStateChangeCallback> mStateChangeCallbacks;
+ private IBinder mBluetoothBinder;
private IBluetooth mBluetooth;
private IBluetoothGatt mBluetoothGatt;
private boolean mBinding;
@@ -244,6 +238,7 @@
mContext = context;
mBluetooth = null;
+ mBluetoothBinder = null;
mBluetoothGatt = null;
mBinding = false;
mUnbinding = false;
@@ -690,6 +685,7 @@
}
}
if (DBG) Log.d(TAG, "Sending unbind request.");
+ mBluetoothBinder = null;
mBluetooth = null;
//Unbind
mContext.unbindService(mConnection);
@@ -1296,6 +1292,7 @@
mHandler.removeMessages(MESSAGE_TIMEOUT_BIND);
mBinding = false;
+ mBluetoothBinder = service;
mBluetooth = IBluetooth.Stub.asInterface(service);
try {
@@ -1834,41 +1831,13 @@
@Override
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
-
- 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) {
+ if (mBluetoothBinder == null) {
writer.println("Bluetooth Service not connected");
} else {
- ParcelFileDescriptor pfd = null;
try {
- writer.println("Bonded devices:");
- 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);
+ mBluetoothBinder.dump(fd, args);
} catch (RemoteException re) {
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");
- }
- }
}
}
}