am fd0ba81c: am baced375: Merge "Silently reject a ringing call when another call is dialing/ringing." into gingerbread

Merge commit 'fd0ba81c02c0881f7534333afc8c53e241158a3d'

* commit 'fd0ba81c02c0881f7534333afc8c53e241158a3d':
  Silently reject a ringing call when another call is dialing/ringing.
This commit is contained in:
Hung-ying Tyan
2010-10-21 10:56:02 -07:00
committed by Android Git Automerger

View File

@@ -1626,7 +1626,15 @@ public final class CallManager {
}
private boolean hasMoreThanOneRingingCall() {
int count = 0;
for (Call call : mRingingCalls) {
if (call.getState().isRinging()) {
if (++count > 1) return true;
}
}
return false;
}
private Handler mHandler = new Handler() {
@@ -1644,7 +1652,17 @@ public final class CallManager {
break;
case EVENT_NEW_RINGING_CONNECTION:
if (VDBG) Log.d(LOG_TAG, " handleMessage (EVENT_NEW_RINGING_CONNECTION)");
mNewRingingConnectionRegistrants.notifyRegistrants((AsyncResult) msg.obj);
if (getActiveFgCallState().isDialing() || hasMoreThanOneRingingCall()) {
Connection c = (Connection) ((AsyncResult) msg.obj).result;
try {
Log.d(LOG_TAG, "silently drop incoming call: " + c.getCall());
c.getCall().hangup();
} catch (CallStateException e) {
Log.w(LOG_TAG, "new ringing connection", e);
}
} else {
mNewRingingConnectionRegistrants.notifyRegistrants((AsyncResult) msg.obj);
}
break;
case EVENT_UNKNOWN_CONNECTION:
if (VDBG) Log.d(LOG_TAG, " handleMessage (EVENT_UNKNOWN_CONNECTION)");