Merge "DO NOT MERGE ANYWHERE Bluetooth native dumpsys logging support (3/4)" into lmp-mr1-modular-dev
diff --git a/core/java/android/bluetooth/IBluetooth.aidl b/core/java/android/bluetooth/IBluetooth.aidl
index dabb1ce..c6f238e 100644
--- a/core/java/android/bluetooth/IBluetooth.aidl
+++ b/core/java/android/bluetooth/IBluetooth.aidl
@@ -99,6 +99,6 @@
void getActivityEnergyInfoFromController();
BluetoothActivityEnergyInfo reportActivityInfo();
- // for dumpsys support
- String dump();
+ // For dumpsys support
+ void dump(in ParcelFileDescriptor fd);
}
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index 32a6a2f..0c726f3 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -41,6 +41,7 @@
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
+import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
@@ -51,6 +52,7 @@
import android.util.Log;
import java.io.FileDescriptor;
+import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
@@ -1523,17 +1525,24 @@
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
- writer.println("enabled: " + mEnable);
- writer.println("state: " + mState);
- writer.println("address: " + mAddress);
- writer.println("name: " + mName);
+ 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");
} else {
try {
- writer.println(mBluetooth.dump());
+ ParcelFileDescriptor pfd = ParcelFileDescriptor.dup(fd);
+ mBluetooth.dump(pfd);
+ pfd.close();
} catch (RemoteException re) {
writer.println("RemoteException while calling Bluetooth Service");
+ } catch (IOException re) {
+ writer.println("IOException attempting to dup() fd");
}
}
}