Prevent reset of EmergencyCallDiagnosticLogger active call timestamp
A bug was reported regarding how emergency call diagnostics were
recorded (created DropBox entries) for an emergency call that had been
active for a few minutes. Only the telecom dumpsys was recorded,
suggesting that the call had been reported with reason
REPORT_REASON_SHORT_DURATION_AFTER_GOING_ACTIVE. Given that the call was
set to active, as per the telecom dumpsys, it suggests that another
state change recorded in onCallStateChanged caused the original
timestamp to be overwritten. It's likely that this occurred during the
local disconnect where the call state was still in the active state.
Since there are no detailed Telecom logs around this to better identify
the root cause so this is the best diagnosis we can provide for this
issue as of now.
Bug: 324346311
Test: atest EmergencyCallTests
Change-Id: I4a02e15e18af8dc481af80f3459966c10d70f152
diff --git a/src/com/android/server/telecom/EmergencyCallDiagnosticLogger.java b/src/com/android/server/telecom/EmergencyCallDiagnosticLogger.java
index b8f5239..f0f8bb4 100644
--- a/src/com/android/server/telecom/EmergencyCallDiagnosticLogger.java
+++ b/src/com/android/server/telecom/EmergencyCallDiagnosticLogger.java
@@ -339,12 +339,11 @@
@Override
public void onCallStateChanged(Call call, int oldState, int newState) {
- if (call != null && mEmergencyCallsMap.get(call) != null && newState == CallState.ACTIVE) {
- CallEventTimestamps ts = mEmergencyCallsMap.get(call);
- if (ts != null) {
- long currentTime = mClockProxy.currentTimeMillis();
- ts.setCallActiveTime(currentTime);
- }
+ CallEventTimestamps ts = mEmergencyCallsMap.get(call);
+ if (call != null && ts != null && newState == CallState.ACTIVE
+ && ts.getCallActiveTime() == 0) {
+ long currentTime = mClockProxy.currentTimeMillis();
+ ts.setCallActiveTime(currentTime);
}
}