Cache call events to ensure that cap exchange events are not missed

At the beginning of the call, if a call event is sent too soon, it
can result in the voip app missing a call event. Cache the pending call
events in a CachedCallback and deliver them when the ServiceWrapper
is set.

Flag: com.android.server.telecom.flags.cache_call_events
Bug: 364311190
Test: atest TelecomUnitTests:CallTest and manual ICS app testing
Change-Id: Ib577a652736634ca9be81adaed254f74b4d0fc4e
diff --git a/flags/telecom_call_flags.aconfig b/flags/telecom_call_flags.aconfig
index ed75f14..331c328 100644
--- a/flags/telecom_call_flags.aconfig
+++ b/flags/telecom_call_flags.aconfig
@@ -16,6 +16,17 @@
   bug: "321369729"
 }
 
+# OWNER=breadley TARGET=24Q4
+flag {
+  name: "cache_call_events"
+  namespace: "telecom"
+  description: "Cache call events to wait for the ServiceWrapper to be set"
+  bug: "364311190"
+  metadata {
+      purpose: PURPOSE_BUGFIX
+    }
+}
+
 # OWNER = breadley TARGET=24Q3
 flag {
   name: "cancel_removal_on_emergency_redial"