add a flag for ConnectionServiceFocusManager#getCurrentFocusCall
A flag should have been added with the changes in b/280128990. Gating the changed code with a flag to ensure the code has enough soak time before release.
Fixes: 309541253
Bug: 280128990 (original bug)
Test: build + existing tests
Change-Id: Ibb19b05f5005e885fe5dde690f74ad37f7d062d7
diff --git a/flags/Android.bp b/flags/Android.bp
index 450cb1b..7e2b31d 100644
--- a/flags/Android.bp
+++ b/flags/Android.bp
@@ -29,6 +29,7 @@
"telecom_incallservice_flags.aconfig",
"telecom_default_phone_account_flags.aconfig",
"telecom_callaudioroutestatemachine_flags.aconfig",
+ "telecom_anomaly_report_flags.aconfig",
"telecom_callaudiomodestatemachine_flags.aconfig",
"telecom_calllog_flags.aconfig",
"telecom_resolve_hidden_dependencies.aconfig"
diff --git a/flags/telecom_anomaly_report_flags.aconfig b/flags/telecom_anomaly_report_flags.aconfig
new file mode 100644
index 0000000..dbacc08
--- /dev/null
+++ b/flags/telecom_anomaly_report_flags.aconfig
@@ -0,0 +1,8 @@
+package: "com.android.server.telecom.flags"
+
+flag {
+ name: "gen_anom_report_on_focus_timeout"
+ namespace: "telecom"
+ description: "When getCurrentFocusCall times out, generate an anom. report"
+ bug: "309541253"
+}
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index 0864c22..1c2b015 100755
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -2941,6 +2941,10 @@
// from the client via a transaction before answering.
call.answer(videoState);
} else {
+ if (!mFeatureFlags.genAnomReportOnFocusTimeout()) {
+ Call activeCall = (Call) mConnectionSvrFocusMgr.getCurrentFocusCall();
+ Log.d(this, "answerCall: Incoming call = %s Ongoing call %s", call, activeCall);
+ }
// Hold or disconnect the active call and request call focus for the incoming call.
Bundle bundle = new Bundle();
bundle.putLong(TelecomManager.EXTRA_CALL_ANSWERED_TIME_MILLIS,
diff --git a/src/com/android/server/telecom/ConnectionServiceFocusManager.java b/src/com/android/server/telecom/ConnectionServiceFocusManager.java
index 72cb7c4..35be0f8 100644
--- a/src/com/android/server/telecom/ConnectionServiceFocusManager.java
+++ b/src/com/android/server/telecom/ConnectionServiceFocusManager.java
@@ -30,6 +30,7 @@
import android.util.Printer;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.server.telecom.flags.Flags;
import com.android.internal.util.IndentingPrintWriter;
import java.util.ArrayList;
@@ -340,18 +341,23 @@
if (syncCallFocus != null) {
return syncCallFocus.orElse(null);
} else {
- Log.w(TAG, "Timed out waiting for synchronous current focus. Returning possibly"
- + " inaccurate result. returning currentFocusCall=[%s]", mCurrentFocusCall);
+ if (Flags.genAnomReportOnFocusTimeout()) {
+ Log.w(TAG, "Timed out waiting for synchronous current focus. Returning possibly"
+ + " inaccurate result. returning currentFocusCall=[%s]",
+ mCurrentFocusCall);
- // dump the state of the handler to better understand the timeout
- mEventHandler.dump(
- new LogPrinter(android.util.Log.INFO, TAG), "CsFocusMgr_timeout");
+ // dump the state of the handler to better understand the timeout
+ mEventHandler.dump(
+ new LogPrinter(android.util.Log.INFO, TAG), "CsFocusMgr_timeout");
- // report the timeout
- mAnomalyReporter.reportAnomaly(
- WATCHDOG_GET_CALL_FOCUS_TIMEOUT_UUID,
- WATCHDOG_GET_CALL_FOCUS_TIMEOUT_MSG);
-
+ // report the timeout
+ mAnomalyReporter.reportAnomaly(
+ WATCHDOG_GET_CALL_FOCUS_TIMEOUT_UUID,
+ WATCHDOG_GET_CALL_FOCUS_TIMEOUT_MSG);
+ } else {
+ Log.w(TAG, "Timed out waiting for synchronous current focus. Returning possibly"
+ + " inaccurate result");
+ }
return mCurrentFocusCall;
}
} catch (InterruptedException e) {