am d8f3d167: Add a new phone state ANSWERING.

Merge commit 'd8f3d167353f6c6f6c5cb7a4c8e941c03b8e9511' into gingerbread-plus-aosp

* commit 'd8f3d167353f6c6f6c5cb7a4c8e941c03b8e9511':
  Add a new phone state ANSWERING.
This commit is contained in:
Chung-yih Wang
2010-09-16 04:45:44 -07:00
committed by Android Git Automerger
4 changed files with 23 additions and 4 deletions

View File

@@ -197,10 +197,12 @@ public final class CallManager {
Phone.State s = Phone.State.IDLE; Phone.State s = Phone.State.IDLE;
for (Phone phone : mPhones) { for (Phone phone : mPhones) {
if (phone.getState() == Phone.State.RINGING) { if (phone.getState() == Phone.State.ANSWERING) {
return Phone.State.RINGING; return Phone.State.ANSWERING;
} else if (phone.getState() == Phone.State.RINGING) {
s = Phone.State.RINGING;
} else if (phone.getState() == Phone.State.OFFHOOK) { } else if (phone.getState() == Phone.State.OFFHOOK) {
s = Phone.State.OFFHOOK; if (s == Phone.State.IDLE) s = Phone.State.OFFHOOK;
} }
} }
return s; return s;
@@ -289,6 +291,18 @@ public final class CallManager {
return getFirstActiveRingingCall().getPhone(); return getFirstActiveRingingCall().getPhone();
} }
/**
* @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 * unregister phone from CallManager
* @param phone * @param phone

View File

@@ -55,10 +55,12 @@ public interface Phone {
* <li>OFFHOOK = The phone is off hook. At least one call * <li>OFFHOOK = The phone is off hook. At least one call
* exists that is dialing, active or holding and no calls are * exists that is dialing, active or holding and no calls are
* ringing or waiting.</li> * ringing or waiting.</li>
* <li>ANSWERING = The incoming call is picked up but the
* call is not established yet.</li>
* </ul> * </ul>
*/ */
enum State { enum State {
IDLE, RINGING, OFFHOOK; IDLE, RINGING, OFFHOOK, ANSWERING;
}; };
/** /**

View File

@@ -158,6 +158,7 @@ public class SipPhone extends SipPhoneBase {
} else { } else {
throw new CallStateException("phone not ringing"); throw new CallStateException("phone not ringing");
} }
updatePhoneState();
} }
} }

View File

@@ -538,6 +538,8 @@ abstract class SipPhoneBase extends PhoneBase {
if (getRingingCall().isRinging()) { if (getRingingCall().isRinging()) {
state = State.RINGING; state = State.RINGING;
} else if (getForegroundCall().isRinging()) {
state = State.ANSWERING;
} else if (getForegroundCall().isIdle() } else if (getForegroundCall().isIdle()
&& getBackgroundCall().isIdle()) { && getBackgroundCall().isIdle()) {
state = State.IDLE; state = State.IDLE;