summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andre Eisenbach <eisenbach@google.com> 2015-06-10 20:30:44 +0000
committer Android Git Automerger <android-git-automerger@android.com> 2015-06-10 20:30:44 +0000
commit71afcb690647d5e0ae6d623f8eaf0f351faa7ece (patch)
tree097dd3581f46f5d1f9faf85928a7a1a08d00cfe8
parent86468ae72d7d7266ec5c13d300add0dafd63432f (diff)
parent7f0b56527fa393cfc795d853edb809e224fc1376 (diff)
am 7f0b5652: Merge "Bluetooth native dumpsys logging support (3/5)"
* commit '7f0b56527fa393cfc795d853edb809e224fc1376': Bluetooth native dumpsys logging support (3/5)
-rw-r--r--core/java/android/bluetooth/IBluetooth.aidl4
-rw-r--r--services/core/java/com/android/server/BluetoothManagerService.java27
2 files changed, 24 insertions, 7 deletions
diff --git a/core/java/android/bluetooth/IBluetooth.aidl b/core/java/android/bluetooth/IBluetooth.aidl
index dabb1ceaea8f..c6f238ee6a64 100644
--- a/core/java/android/bluetooth/IBluetooth.aidl
+++ b/core/java/android/bluetooth/IBluetooth.aidl
@@ -99,6 +99,6 @@ interface IBluetooth
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 32a6a2faad75..7aa8e113e037 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.Handler;
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.provider.Settings;
import android.util.Log;
import java.io.FileDescriptor;
+import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
@@ -1523,17 +1525,32 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
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 {
+ ParcelFileDescriptor pfd = null;
try {
- writer.println(mBluetooth.dump());
+ pfd = ParcelFileDescriptor.dup(fd);
+ mBluetooth.dump(pfd);
} 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");
+ }
+ }
}
}
}