Change isRinging and isInAPhoneCall to execute from binder thread.
We call into the audio service from telecomm main thread through
setMode, but it calls us back on isInAPhoneCall which tries to move
the code execution to the main thread (where it waiting for
audio service) causing a deadlock. Change isInAPhoneCall() to support
multi-threaded execution and do not force the invocation onto the
main thread.
Bug: 16179606
Change-Id: I2cc6f6220b34a2b35841a08897a50f2dc50839c6
diff --git a/src/com/android/telecomm/CallsManager.java b/src/com/android/telecomm/CallsManager.java
index 3811de1..99731d7 100644
--- a/src/com/android/telecomm/CallsManager.java
+++ b/src/com/android/telecomm/CallsManager.java
@@ -33,6 +33,7 @@
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
+import java.util.concurrent.CopyOnWriteArraySet;
/**
* Singleton.
@@ -72,7 +73,7 @@
* The main call repository. Keeps an instance of all live calls. New incoming and outgoing
* calls are added to the map and removed when the calls move to the disconnected state.
*/
- private final Set<Call> mCalls = new LinkedHashSet<>();
+ private final Set<Call> mCalls = new CopyOnWriteArraySet<Call>();
private final DtmfLocalTonePlayer mDtmfLocalTonePlayer = new DtmfLocalTonePlayer();
private final InCallController mInCallController = new InCallController();