summaryrefslogtreecommitdiffstats
path: root/telephony
diff options
context:
space:
mode:
authorHung-ying Tyan <tyanh@google.com>2010-10-08 10:25:50 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-08 10:25:50 -0700
commit026284745bb2f84e96fe132071f48a8cd4c1e715 (patch)
treebd170949348f7e4771d70967fc607de44fd90674 /telephony
parentc6a69559cb62bd20166c0c9684e64c60d779da38 (diff)
parent88b4bd5f3e8d6e68541eec4a603b1df83291cf1f (diff)
downloadframeworks_base-026284745bb2f84e96fe132071f48a8cd4c1e715.zip
frameworks_base-026284745bb2f84e96fe132071f48a8cd4c1e715.tar.gz
frameworks_base-026284745bb2f84e96fe132071f48a8cd4c1e715.tar.bz2
am 88b4bd5f: am fc7e7766: Merge "CallManager/SipPhone: fix reject a ringing call" into gingerbread
Merge commit '88b4bd5f3e8d6e68541eec4a603b1df83291cf1f' * commit '88b4bd5f3e8d6e68541eec4a603b1df83291cf1f': CallManager/SipPhone: fix reject a ringing call
Diffstat (limited to 'telephony')
-rw-r--r--telephony/java/com/android/internal/telephony/CallManager.java46
-rwxr-xr-xtelephony/java/com/android/internal/telephony/sip/SipPhone.java5
2 files changed, 34 insertions, 17 deletions
diff --git a/telephony/java/com/android/internal/telephony/CallManager.java b/telephony/java/com/android/internal/telephony/CallManager.java
index 09b7d05..7a026fa 100644
--- a/telephony/java/com/android/internal/telephony/CallManager.java
+++ b/telephony/java/com/android/internal/telephony/CallManager.java
@@ -1468,13 +1468,27 @@ public final class CallManager {
*
*/
public Call getActiveFgCall() {
- for (Call call : mForegroundCalls) {
- if (call.getState() != Call.State.IDLE) {
+ Call call = getFirstNonIdleCall(mForegroundCalls);
+ if (call == null) {
+ call = (mDefaultPhone == null)
+ ? null
+ : mDefaultPhone.getForegroundCall();
+ }
+ return call;
+ }
+
+ // Returns the first call that is not in IDLE state. If both active calls
+ // and disconnecting/disconnected calls exist, return the first active call.
+ private Call getFirstNonIdleCall(List<Call> calls) {
+ Call result = null;
+ for (Call call : calls) {
+ if (!call.isIdle()) {
return call;
+ } else if (call.getState() != Call.State.IDLE) {
+ if (result == null) result = call;
}
}
- return (mDefaultPhone == null) ?
- null : mDefaultPhone.getForegroundCall();
+ return result;
}
/**
@@ -1491,13 +1505,13 @@ public final class CallManager {
* Complete background calls list can be get by getBackgroundCalls()
*/
public Call getFirstActiveBgCall() {
- for (Call call : mBackgroundCalls) {
- if (call.getState() != Call.State.IDLE) {
- return call;
- }
+ Call call = getFirstNonIdleCall(mBackgroundCalls);
+ if (call == null) {
+ call = (mDefaultPhone == null)
+ ? null
+ : mDefaultPhone.getBackgroundCall();
}
- return (mDefaultPhone == null) ?
- null : mDefaultPhone.getBackgroundCall();
+ return call;
}
/**
@@ -1514,13 +1528,13 @@ public final class CallManager {
* Complete ringing calls list can be get by getRingingCalls()
*/
public Call getFirstActiveRingingCall() {
- for (Call call : mRingingCalls) {
- if (!call.isIdle()) {
- return call;
- }
+ Call call = getFirstNonIdleCall(mRingingCalls);
+ if (call == null) {
+ call = (mDefaultPhone == null)
+ ? null
+ : mDefaultPhone.getRingingCall();
}
- return (mDefaultPhone == null) ?
- null : mDefaultPhone.getRingingCall();
+ return call;
}
/**
diff --git a/telephony/java/com/android/internal/telephony/sip/SipPhone.java b/telephony/java/com/android/internal/telephony/sip/SipPhone.java
index 6ed9295..878d30c 100755
--- a/telephony/java/com/android/internal/telephony/sip/SipPhone.java
+++ b/telephony/java/com/android/internal/telephony/sip/SipPhone.java
@@ -810,7 +810,10 @@ public class SipPhone extends SipPhoneBase {
} catch (SipException e) {
throw new CallStateException("hangup(): " + e);
} finally {
- mAdapter.onCallEnded(DisconnectCause.LOCAL);
+ mAdapter.onCallEnded(((mState == Call.State.INCOMING)
+ || (mState == Call.State.WAITING))
+ ? DisconnectCause.INCOMING_REJECTED
+ : DisconnectCause.LOCAL);
}
}
}