Handle hangupForegroundResumeBackground operation.
Change-Id: I4526e80cfe4fbe145cbc9f6d96f3e67560ed351c
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index 88e5d85..2dfcd91 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -427,7 +427,14 @@
*/
static boolean hangup(Call call) {
try {
- call.hangup();
+ CallManager cm = PhoneApp.getInstance().mCM;
+
+ if (call.getState() == Call.State.ACTIVE && cm.hasActiveBgCall()) {
+ // handle foreground call hangup while there is background call
+ cm.hangupForegroundResumeBackground(cm.getFirstActiveBgCall());
+ } else {
+ call.hangup();
+ }
return true;
} catch (CallStateException ex) {
Log.e(LOG_TAG, "Call hangup: caught " + ex, ex);
@@ -2338,6 +2345,7 @@
}
return null;
}
+
public static boolean isRealIncomingCall(Call.State state) {
return (state == Call.State.INCOMING && !PhoneApp.getInstance().mCM.hasActiveFgCall());