diff options
author | Ravi Paluri <rpaluri@codeaurora.org> | 2014-11-14 17:52:25 +0530 |
---|---|---|
committer | Ravi Paluri <rpaluri@codeaurora.org> | 2014-11-18 16:50:07 +0530 |
commit | 327d61e129726df73f8cc053158f290871989b91 (patch) | |
tree | 8d6323a6ff48d26c7153591e98454c0f6b70563c /src/com/android/incallui/AnswerPresenter.java | |
parent | e6fb1bd1ec270e7346b3c36b55d62db87b81d75f (diff) | |
download | packages_apps_InCallUI-327d61e129726df73f8cc053158f290871989b91.tar.gz packages_apps_InCallUI-327d61e129726df73f8cc053158f290871989b91.tar.bz2 packages_apps_InCallUI-327d61e129726df73f8cc053158f290871989b91.zip |
Ims: Reject upgrade request
1. If there is waiting call that is pending user action and
2. Before offering a waiting call
Change-Id: Ic52340de09d71b6d43291b69a1757e717a787370
CRs-Fixed: 748298
Diffstat (limited to 'src/com/android/incallui/AnswerPresenter.java')
-rw-r--r-- | src/com/android/incallui/AnswerPresenter.java | 56 |
1 files changed, 38 insertions, 18 deletions
diff --git a/src/com/android/incallui/AnswerPresenter.java b/src/com/android/incallui/AnswerPresenter.java index 5e8cd554..90dcff84 100644 --- a/src/com/android/incallui/AnswerPresenter.java +++ b/src/com/android/incallui/AnswerPresenter.java @@ -42,7 +42,12 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> super.onUiReady(ui); final CallList calls = CallList.getInstance(); - Call call; + Call call = calls.getVideoUpgradeRequestCall(); + Log.d(this, "getVideoUpgradeRequestCall call =" + call); + + if (call != null && calls.getIncomingCall() == null) { + processVideoUpgradeRequestCall(call); + } for (int i = 0; i < CallList.PHONE_COUNT; i++) { long[] subId = CallList.getInstance().getSubId(i); call = calls.getCallWithState(Call.State.INCOMING, 0, subId[0]); @@ -53,11 +58,6 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> processIncomingCall(call); } } - call = calls.getVideoUpgradeRequestCall(); - Log.d(this, "getVideoUpgradeRequestCall call=" + call); - if (call != null) { - processVideoUpgradeRequestCall(call); - } // Listen for incoming calls. calls.addListener(this); @@ -99,6 +99,14 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> // getting updates here. Log.d(this, "onIncomingCall: " + this); if (getUi() != null) { + Call modifyCall = CallList.getInstance().getVideoUpgradeRequestCall(); + if (modifyCall != null) { + getUi().showAnswerUi(false); + int modifyPhoneId = CallList.getInstance().getPhoneId(modifyCall.getSubId()); + Log.d(this, "declining upgrade request id: " + modifyPhoneId); + CallList.getInstance().removeCallUpdateListener(mCallId[modifyPhoneId], this); + InCallPresenter.getInstance().declineUpgradeRequest(getUi().getContext()); + } if (!call.getId().equals(mCallId[phoneId])) { // A new call is coming in. processIncomingCall(call); @@ -106,6 +114,15 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> } } + private boolean isVideoUpgradePending(Call call) { + boolean isUpgradePending = false; + if (call.getSessionModificationState() + == Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) { + isUpgradePending = true; + } + return isUpgradePending; + } + @Override public void onUpgradeToVideo(Call call) { Log.d(this, "onUpgradeToVideo: " + this + " call=" + call); @@ -113,8 +130,14 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> Log.d(this, "onUpgradeToVideo ui is null"); return; } - if (call.getSessionModificationState() - == Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) { + boolean isUpgradePending = isVideoUpgradePending(call); + InCallPresenter inCallPresenter = InCallPresenter.getInstance(); + if (isUpgradePending + && inCallPresenter.getInCallState() == InCallPresenter.InCallState.INCOMING) { + Log.d(this, "declining upgrade request"); + inCallPresenter.declineUpgradeRequest(getUi().getContext()); + } else if (isUpgradePending) { + Log.d(this, "process upgrade request as no MT call"); processVideoUpgradeRequestCall(call); } } @@ -153,13 +176,15 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> if (call.getState() != Call.State.INCOMING) { long subId = call.getSubId(); int phoneId = CallList.getInstance().getPhoneId(subId); - // Stop listening for updates. - CallList.getInstance().removeCallUpdateListener(mCallId[phoneId], this); + + boolean isUpgradePending = isVideoUpgradePending(call); + if (!isUpgradePending) { + // Stop listening for updates. + CallList.getInstance().removeCallUpdateListener(mCallId[phoneId], this); + } final Call incall = CallList.getInstance().getIncomingCall(); - if (incall != null - || call.getSessionModificationState() - == Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) { + if (incall != null || isUpgradePending) { getUi().showAnswerUi(true); } else { getUi().showAnswerUi(false); @@ -175,11 +200,6 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> configureAnswerTargetsForSms(call, textMsgs); } } - if (getUi() != null - && call.getSessionModificationState() - == Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) { - processVideoUpgradeRequestCall(call); - } } // get active phoneId, for which call is visible to user |