* commit 'af78a8b636c2f1afacea704dad851533435d989d': Bluetooth native dumpsys logging support (3/5)
This commit is contained in:
@@ -101,8 +101,8 @@ interface IBluetooth
|
|||||||
void getActivityEnergyInfoFromController();
|
void getActivityEnergyInfoFromController();
|
||||||
BluetoothActivityEnergyInfo reportActivityInfo();
|
BluetoothActivityEnergyInfo reportActivityInfo();
|
||||||
|
|
||||||
// for dumpsys support
|
// For dumpsys support
|
||||||
String dump();
|
void dump(in ParcelFileDescriptor fd);
|
||||||
void onLeServiceUp();
|
void onLeServiceUp();
|
||||||
void onBrEdrDown();
|
void onBrEdrDown();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import android.os.Handler;
|
|||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.os.RemoteCallbackList;
|
import android.os.RemoteCallbackList;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
@@ -52,6 +53,7 @@ import android.provider.Settings.SettingNotFoundException;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -1737,17 +1739,32 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
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);
|
||||||
|
|
||||||
writer.println("enabled: " + mEnable);
|
writer.println("Bluetooth Status");
|
||||||
writer.println("state: " + mState);
|
writer.println(" enabled: " + mEnable);
|
||||||
writer.println("address: " + mAddress);
|
writer.println(" state: " + mState);
|
||||||
writer.println("name: " + mName);
|
writer.println(" address: " + mAddress);
|
||||||
|
writer.println(" name: " + mName + "\n");
|
||||||
|
writer.flush();
|
||||||
|
|
||||||
if (mBluetooth == null) {
|
if (mBluetooth == null) {
|
||||||
writer.println("Bluetooth Service not connected");
|
writer.println("Bluetooth Service not connected");
|
||||||
} else {
|
} else {
|
||||||
|
ParcelFileDescriptor pfd = null;
|
||||||
try {
|
try {
|
||||||
writer.println(mBluetooth.dump());
|
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