diff options
author | Chung-yih Wang <cywang@google.com> | 2010-09-16 19:00:01 +0800 |
---|---|---|
committer | Chung-yih Wang <cywang@google.com> | 2010-09-16 19:09:16 +0800 |
commit | d8f3d167353f6c6f6c5cb7a4c8e941c03b8e9511 (patch) | |
tree | 21df5a216e1f7e8146d2eeaaebb4edd9c5113db3 /telephony | |
parent | 0e0633828928481658c0e09e5893f6214b57ba38 (diff) | |
download | frameworks_base-d8f3d167353f6c6f6c5cb7a4c8e941c03b8e9511.zip frameworks_base-d8f3d167353f6c6f6c5cb7a4c8e941c03b8e9511.tar.gz frameworks_base-d8f3d167353f6c6f6c5cb7a4c8e941c03b8e9511.tar.bz2 |
Add a new phone state ANSWERING.
The state ANSWERING is set when we answer an incoming sip call, i.e.
sending a 'OK' response to the peer. The state will be set to ACTIVE
once the 'ACK' from peer is received.
Change-Id: I84ee3cc68222eb34e032896ce23f7431d4ad774a
Diffstat (limited to 'telephony')
4 files changed, 23 insertions, 4 deletions
diff --git a/telephony/java/com/android/internal/telephony/CallManager.java b/telephony/java/com/android/internal/telephony/CallManager.java index 8bd789c..83496dc 100644 --- a/telephony/java/com/android/internal/telephony/CallManager.java +++ b/telephony/java/com/android/internal/telephony/CallManager.java @@ -197,10 +197,12 @@ public final class CallManager { Phone.State s = Phone.State.IDLE; for (Phone phone : mPhones) { - if (phone.getState() == Phone.State.RINGING) { - return Phone.State.RINGING; + if (phone.getState() == Phone.State.ANSWERING) { + return Phone.State.ANSWERING; + } else if (phone.getState() == Phone.State.RINGING) { + s = Phone.State.RINGING; } else if (phone.getState() == Phone.State.OFFHOOK) { - s = Phone.State.OFFHOOK; + if (s == Phone.State.IDLE) s = Phone.State.OFFHOOK; } } return s; @@ -290,6 +292,18 @@ public final class CallManager { } /** + * @return the first answering call + */ + public Call getFirstAnsweringCall() { + for (Phone phone : mPhones) { + if (phone.getState() == Phone.State.ANSWERING) { + return phone.getForegroundCall(); + } + } + return null; + } + + /** * unregister phone from CallManager * @param phone */ diff --git a/telephony/java/com/android/internal/telephony/Phone.java b/telephony/java/com/android/internal/telephony/Phone.java index 9afade3..7464cc7 100644 --- a/telephony/java/com/android/internal/telephony/Phone.java +++ b/telephony/java/com/android/internal/telephony/Phone.java @@ -55,10 +55,12 @@ public interface Phone { * <li>OFFHOOK = The phone is off hook. At least one call * exists that is dialing, active or holding and no calls are * ringing or waiting.</li> + * <li>ANSWERING = The incoming call is picked up but the + * call is not established yet.</li> * </ul> */ enum State { - IDLE, RINGING, OFFHOOK; + IDLE, RINGING, OFFHOOK, ANSWERING; }; /** diff --git a/telephony/java/com/android/internal/telephony/sip/SipPhone.java b/telephony/java/com/android/internal/telephony/sip/SipPhone.java index 5af32da..07dd35d 100755 --- a/telephony/java/com/android/internal/telephony/sip/SipPhone.java +++ b/telephony/java/com/android/internal/telephony/sip/SipPhone.java @@ -158,6 +158,7 @@ public class SipPhone extends SipPhoneBase { } else { throw new CallStateException("phone not ringing"); } + updatePhoneState(); } } diff --git a/telephony/java/com/android/internal/telephony/sip/SipPhoneBase.java b/telephony/java/com/android/internal/telephony/sip/SipPhoneBase.java index 9098e6f..2efbd17 100755 --- a/telephony/java/com/android/internal/telephony/sip/SipPhoneBase.java +++ b/telephony/java/com/android/internal/telephony/sip/SipPhoneBase.java @@ -538,6 +538,8 @@ abstract class SipPhoneBase extends PhoneBase { if (getRingingCall().isRinging()) { state = State.RINGING; + } else if (getForegroundCall().isRinging()) { + state = State.ANSWERING; } else if (getForegroundCall().isIdle() && getBackgroundCall().isIdle()) { state = State.IDLE; |