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

Commit f9e1bc19 authored by Myles Watson's avatar Myles Watson
Browse files

AdapterService: Skip dumpNative when turning off

When Bluetooth is turning off, there's no guarantee that dump
will finish.  Let it finish instead of causing a crash.

Bug: 235762947
Test: toggle Bluetooth quickly and run adb shell dumpsys
Change-Id: I3fd4131684869120673986902ec966eb6b6ce597
parent 73cb99ed
Loading
Loading
Loading
Loading
+10 −1
Original line number Original line Diff line number Diff line
@@ -6466,8 +6466,17 @@ public class AdapterService extends Service {
        writer.write(sb.toString());
        writer.write(sb.toString());
        writer.flush();
        writer.flush();


        final int currentState = mAdapterProperties.getState();
        if (currentState == BluetoothAdapter.STATE_OFF
                || currentState == BluetoothAdapter.STATE_TURNING_OFF
                || currentState == BluetoothAdapter.STATE_BLE_TURNING_OFF) {
            writer.println();
            writer.println("Not dumping, since Bluetooth is turning off");
            writer.println();
        } else {
            dumpNative(fd, args);
            dumpNative(fd, args);
        }
        }
    }


    private void dumpMetrics(FileDescriptor fd) {
    private void dumpMetrics(FileDescriptor fd) {
        BluetoothMetricsProto.BluetoothLog.Builder metricsBuilder =
        BluetoothMetricsProto.BluetoothLog.Builder metricsBuilder =