diff options
author | Yorke Lee <yorkelee@google.com> | 2015-07-09 14:53:37 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-07-09 16:09:48 -0700 |
commit | 609e34420d2ce8053d0f84cfd31bec040317fbff (patch) | |
tree | 87bbd88e07ff8f7119995055884d9a9906e7d9e3 | |
parent | d5388a70f8271bdfadef6b01f9820767e880be67 (diff) |
Fix for glowpad not showing when dialing out + call waiting
The AnswerPresenter is responsible for initiating the creation
of the UI during a new incoming call, so there is no need
to do a null check on getUi in onIncomingCall.
Original fix was made in ag/651766 but seems to have been
lost in a series of merges.
Also, if the same instance of InCallPresenter is reused across
activity teardown and setups, this can result in mAnswerPresenter
getting lost from the set of incoming call listeners. To fix this,
always readd it at setup.
Bug: 22357229
Change-Id: Iecd80fa0187d756181ada7631c4246ad48f7131e
-rw-r--r-- | InCallUI/src/com/android/incallui/AnswerPresenter.java | 24 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallPresenter.java | 5 |
2 files changed, 14 insertions, 15 deletions
diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java index 950db3912..1453fa517 100644 --- a/InCallUI/src/com/android/incallui/AnswerPresenter.java +++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java @@ -71,18 +71,16 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> @Override public void onIncomingCall(InCallState oldState, InCallState newState, Call call) { Log.d(this, "onIncomingCall: " + this); - if (getUi() != null) { - Call modifyCall = CallList.getInstance().getVideoUpgradeRequestCall(); - if (modifyCall != null) { - showAnswerUi(false); - Log.d(this, "declining upgrade request id: "); - CallList.getInstance().removeCallUpdateListener(mCallId, this); - InCallPresenter.getInstance().declineUpgradeRequest(getUi().getContext()); - } - if (!call.getId().equals(mCallId)) { - // A new call is coming in. - processIncomingCall(call); - } + Call modifyCall = CallList.getInstance().getVideoUpgradeRequestCall(); + if (modifyCall != null) { + showAnswerUi(false); + Log.d(this, "declining upgrade request id: "); + CallList.getInstance().removeCallUpdateListener(mCallId, this); + InCallPresenter.getInstance().declineUpgradeRequest(getUi().getContext()); + } + if (!call.getId().equals(mCallId)) { + // A new call is coming in. + processIncomingCall(call); } } @@ -98,7 +96,7 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> public void onDisconnect(Call call) { // no-op } - + public void onSessionModificationStateChange(int sessionModificationState) { boolean isUpgradePending = sessionModificationState == Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST; diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 236129637..ff1a50fcb 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -219,6 +219,9 @@ public class InCallPresenter implements CallList.Listener, mProximitySensor = proximitySensor; addListener(mProximitySensor); + addIncomingCallListener(mAnswerPresenter); + addInCallUiListener(mAnswerPresenter); + mCallList = callList; // This only gets called by the service so this is okay. @@ -1556,8 +1559,6 @@ public class InCallPresenter implements CallList.Listener, * Private constructor. Must use getInstance() to get this singleton. */ private InCallPresenter() { - addIncomingCallListener(mAnswerPresenter); - addInCallUiListener(mAnswerPresenter); } /** |