am 06e8cdc0: Fix race between ending and answering a SIP call.
* commit '06e8cdc0f81ead604d5adf9d7b3f982e10226fd2':
Fix race between ending and answering a SIP call.
diff --git a/voip/java/com/android/server/sip/SipSessionGroup.java b/voip/java/com/android/server/sip/SipSessionGroup.java
index 29f5f5a..30ddfb5 100644
--- a/voip/java/com/android/server/sip/SipSessionGroup.java
+++ b/voip/java/com/android/server/sip/SipSessionGroup.java
@@ -527,11 +527,14 @@
}
public void answerCall(String sessionDescription, int timeout) {
- try {
- processCommand(new MakeCallCommand(mPeerProfile,
- sessionDescription, timeout));
- } catch (SipException e) {
- onError(e);
+ synchronized (SipSessionGroup.this) {
+ if (mPeerProfile == null) return;
+ try {
+ processCommand(new MakeCallCommand(mPeerProfile,
+ sessionDescription, timeout));
+ } catch (SipException e) {
+ onError(e);
+ }
}
}
@@ -540,14 +543,11 @@
}
public void changeCall(String sessionDescription, int timeout) {
- doCommandAsync(new MakeCallCommand(mPeerProfile, sessionDescription,
- timeout));
- }
-
- public void changeCallWithTimeout(
- String sessionDescription, int timeout) {
- doCommandAsync(new MakeCallCommand(mPeerProfile, sessionDescription,
- timeout));
+ synchronized (SipSessionGroup.this) {
+ if (mPeerProfile == null) return;
+ doCommandAsync(new MakeCallCommand(mPeerProfile,
+ sessionDescription, timeout));
+ }
}
public void register(int duration) {