summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Marie Janssen <jamuraa@google.com> 2017-11-15 18:24:50 +0000
committer android-build-merger <android-build-merger@google.com> 2017-11-15 18:24:50 +0000
commit4a59e56a347a311f301afaf24bff5f6b771ee255 (patch)
treefd11bbb63ddc611dd8f004a6bc05446a46d3f3fe
parent46f7b91ed8424f7761d1405097cfde62d58281ca (diff)
parente57c02e860fa7f6cd1aba5a5f74b5ddb34b26443 (diff)
Merge "Bluetooth: Use elapsed real time for calculating onDuration" am: 22b12e6b06
am: e57c02e860 Change-Id: If51a8d59d621cc9578d95df7d86903cec5628935
-rw-r--r--services/core/java/com/android/server/BluetoothManagerService.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index 75206e48aa8b..c34c30cf6e43 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -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),