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

Commit 359a4a84 authored by Marie Janssen's avatar Marie Janssen Committed by android-build-merger
Browse files

Merge "Bluetooth: Use elapsed real time for calculating onDuration" am: 8775add0

am: be6fdbe6

Change-Id: If51a8d59d621cc9578d95df7d86903cec5628935
parents 16a57ef3 be6fdbe6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
    private LinkedList<ActiveLog> mActiveLogs;
    private LinkedList<Long> mCrashTimestamps;
    private int mCrashes;
    private long mLastEnabledTime;

    // configuration from external IBinder call which is used to
    // synchronize with broadcast receiver.
@@ -2021,6 +2022,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
        mHandler.sendMessage(mHandler.obtainMessage(MESSAGE_ENABLE,
                             quietMode ? 1 : 0, 0));
        addActiveLog(packageName, true);
        mLastEnabledTime = SystemClock.elapsedRealtime();
    }

    private void addActiveLog(String packageName, boolean enable) {
@@ -2142,7 +2144,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
            writer.println("  address: " + mAddress);
            writer.println("  name: " + mName);
            if (mEnable) {
                long onDuration = System.currentTimeMillis() - mActiveLogs.getLast().getTime();
                long onDuration = SystemClock.elapsedRealtime() - mLastEnabledTime;
                String onDurationString = String.format("%02d:%02d:%02d.%03d",
                                          (int)(onDuration / (1000 * 60 * 60)),
                                          (int)((onDuration / (1000 * 60)) % 60),