Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0b8ac0a authored by Mike Lockwood's avatar Mike Lockwood
Browse files

Add dumpsys support for bluetooth

Bug: 18159457
Change-Id: I8d3f7084a7b089c111fd622ff526630bfdfa7300
parent d38150d3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -98,4 +98,7 @@ interface IBluetooth
    boolean isActivityAndEnergyReportingSupported();
    void getActivityEnergyInfoFromController();
    BluetoothActivityEnergyInfo reportActivityInfo();

    // for dumpsys support
    String dump();
}
+21 −0
Original line number Diff line number Diff line
@@ -44,6 +44,10 @@ import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.Log;

import java.io.FileDescriptor;
import java.io.PrintWriter;

class BluetoothManagerService extends IBluetoothManager.Stub {
    private static final String TAG = "BluetoothManagerService";
    private static final boolean DBG = true;
@@ -1282,4 +1286,21 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
            // todo: notify user to power down and power up phone to make bluetooth work.
        }
    }

    @Override
    public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
        writer.println("enabled: " + mEnable);
        writer.println("state: " + mState);
        writer.println("address: " + mAddress);
        writer.println("name: " + mName);
        if (mBluetooth == null) {
            writer.println("Bluetooth Service not connected");
        } else {
            try {
                writer.println(mBluetooth.dump());
            } catch (RemoteException re) {
                writer.println("RemoteException while calling Bluetooth Service");
            }
        }
    }
}