DO NOT MERGE ANYWHERE Bluetooth native dumpsys logging support (3/4)

Bug: 18508263
Change-Id: I88f9c90dab8b0c825010c8617709449a3dd704b2
This commit is contained in:
Andre Eisenbach
2014-12-05 09:31:30 -08:00
committed by Tucker Sylvestro
parent c8e3784e25
commit a0eaaa2a22
2 changed files with 16 additions and 7 deletions

View File

@@ -99,6 +99,6 @@ interface IBluetooth
void getActivityEnergyInfoFromController();
BluetoothActivityEnergyInfo reportActivityInfo();
// for dumpsys support
String dump();
// For dumpsys support
void dump(in ParcelFileDescriptor fd);
}

View File

@@ -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,24 @@ 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 {
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");
}
}
}