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

Commit b03b1ce3 authored by Ajay Panicker's avatar Ajay Panicker
Browse files

Add enabled time to dump output

Ex:
Bluetooth Status
  enabled: true
  state: 12
  address: F8:CF:C5:CE:F5:69
  name: AOSP on Shamu
  time since enabled: 00:00:32.999

Bug: 27294154
Change-Id: Ie65964411e2095434a082f3d988133190c1f2f59
parent 7a068c2a
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ public class AdapterService extends Service {
    private static final int MIN_OFFLOADED_SCAN_STORAGE_BYTES = 1024;
    //For Debugging only
    private static int sRefCount = 0;
    private long mBluetoothStartTime = 0;

    private final Object mEnergyInfoLock = new Object();
    private int mStackReportedState;
@@ -1471,6 +1472,7 @@ public class AdapterService extends Service {
         mQuietmode = quietMode;
         Message m = mAdapterStateMachine.obtainMessage(AdapterState.BLE_TURN_ON);
         mAdapterStateMachine.sendMessage(m);
         mBluetoothStartTime = System.currentTimeMillis();
         return true;
     }

@@ -2285,11 +2287,19 @@ 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: " + getState());
        writer.println("  address: " + getAddress());
        writer.println("  name: " + getName() + "\n");
        writer.println("  name: " + getName());
        writer.println("  time since enabled: " + onDurationString + "\n");

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