diff options
-rw-r--r-- | telephony/java/com/android/internal/telephony/CallManager.java | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/telephony/java/com/android/internal/telephony/CallManager.java b/telephony/java/com/android/internal/telephony/CallManager.java index 3f0ec0a..ab7b601 100644 --- a/telephony/java/com/android/internal/telephony/CallManager.java +++ b/telephony/java/com/android/internal/telephony/CallManager.java @@ -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)"); |