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

Commit 308a4357 authored by Marie Janssen's avatar Marie Janssen Committed by Gerrit Code Review
Browse files

Merge "Move state dumpsys (to BluetoothManagerService)"

parents a6c7416c b5a03155
Loading
Loading
Loading
Loading
+0 −36
Original line number Diff line number Diff line
@@ -2552,28 +2552,6 @@ public class AdapterService extends Service {
        return getResources().getInteger(R.integer.config_bluetooth_operating_voltage_mv) / 1000.0;
    }

    private String getStateString() {
        int state = getState();
        switch (state) {
            case BluetoothAdapter.STATE_OFF:
                return "STATE_OFF";
            case BluetoothAdapter.STATE_TURNING_ON:
                return "STATE_TURNING_ON";
            case BluetoothAdapter.STATE_ON:
                return "STATE_ON";
            case BluetoothAdapter.STATE_TURNING_OFF:
                return "STATE_TURNING_OFF";
            case BluetoothAdapter.STATE_BLE_TURNING_ON:
                return "STATE_BLE_TURNING_ON";
            case BluetoothAdapter.STATE_BLE_ON:
                return "STATE_BLE_ON";
            case BluetoothAdapter.STATE_BLE_TURNING_OFF:
                return "STATE_BLE_TURNING_OFF";
            default:
                return "UNKNOWN STATE: " + state;
        }
    }

    @Override
    protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
        enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG);
@@ -2591,20 +2569,6 @@ public class AdapterService extends Service {
            }
        }

        long onDuration = System.currentTimeMillis() - mBluetoothStartTime;
        String onDurationString = String.format("%02d:%02d:%02d.%03d",
                                      (int)(onDuration / (1000 * 60 * 60)),
                                      (int)((onDuration / (1000 * 60)) % 60),
                                      (int)((onDuration / 1000) % 60),
                                      (int)(onDuration % 1000));

        writer.println("Bluetooth Status");
        writer.println("  enabled: " + isEnabled());
        writer.println("  state: " + getStateString());
        writer.println("  address: " + getAddress());
        writer.println("  name: " + getName());
        writer.println("  time since enabled: " + onDurationString + "\n");

        writer.println("Bonded devices:");
        for (BluetoothDevice device : getBondedDevices()) {
          writer.println("  " + device.getAddress()