Merge "Suppress output for Protobuf data if Bluetooth is disabled"
am: b82b7527f1
* commit 'b82b7527f1f65035fbe072a4efff472efec8e046':
Suppress output for Protobuf data if Bluetooth is disabled
This commit is contained in:
@@ -1831,14 +1831,21 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
@Override
|
@Override
|
||||||
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);
|
||||||
|
String errorMsg = null;
|
||||||
if (mBluetoothBinder == null) {
|
if (mBluetoothBinder == null) {
|
||||||
writer.println("Bluetooth Service not connected");
|
errorMsg = "Bluetooth Service not connected";
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
mBluetoothBinder.dump(fd, args);
|
mBluetoothBinder.dump(fd, args);
|
||||||
} catch (RemoteException re) {
|
} catch (RemoteException re) {
|
||||||
writer.println("RemoteException while calling Bluetooth Service");
|
errorMsg = "RemoteException while calling Bluetooth Service";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (errorMsg != null) {
|
||||||
|
// Silently return if we are extracting metrics in Protobuf format
|
||||||
|
if ((args.length > 0) && args[0].startsWith("--proto"))
|
||||||
|
return;
|
||||||
|
writer.println(errorMsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user