diff options
author | Yorke Lee <yorkelee@google.com> | 2014-09-14 21:38:51 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-09-14 21:38:51 +0000 |
commit | e4ac5fdd3160c350afb3b4f58cdabc6fe85f19eb (patch) | |
tree | 60827ff39fc17a0250d1cd9aad54ee5b35ec7721 /InCallUI | |
parent | d65c81b330eaa558514c3dbb5fed6268108511f6 (diff) | |
parent | 15fe8f756689d48a9b3bc6d1acac4fae996bf395 (diff) |
am f80174bb: am a246b4c0: am 3034f16f: Fix for quick response option not showing up for call waiting
* commit 'f80174bb3f81234a2817daafa33d1e4a1b10bd7d':
Fix for quick response option not showing up for call waiting
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/AnswerPresenter.java | 57 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallList.java | 3 |
2 files changed, 36 insertions, 24 deletions
diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java index 2d861f2dd..e42f1fcae 100644 --- a/InCallUI/src/com/android/incallui/AnswerPresenter.java +++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java @@ -32,6 +32,7 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> private String mCallId; private Call mCall = null; + private boolean mHasTextMessages = false; @Override public void onUiReady(AnswerUi ui) { @@ -98,28 +99,7 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> Log.d(TAG, "Showing incoming for call id: " + mCallId + " " + this); final List<String> textMsgs = CallList.getInstance().getTextResponses(call.getId()); getUi().showAnswerUi(true); - - final Context context = getUi().getContext(); - final KeyguardManager km = - (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); - final boolean isLockScreenShowing = km.inKeyguardRestrictedInputMode(); - - boolean withSms = call.can(PhoneCapabilities.RESPOND_VIA_TEXT) && textMsgs != null; - if (call.isVideoCall(context)) { - if (withSms && !isLockScreenShowing) { - getUi().showTargets(AnswerFragment.TARGET_SET_FOR_VIDEO_WITH_SMS); - getUi().configureMessageDialog(textMsgs); - } else { - getUi().showTargets(AnswerFragment.TARGET_SET_FOR_VIDEO_WITHOUT_SMS); - } - } else { - if (withSms && !isLockScreenShowing) { - getUi().showTargets(AnswerFragment.TARGET_SET_FOR_AUDIO_WITH_SMS); - getUi().configureMessageDialog(textMsgs); - } else { - getUi().showTargets(AnswerFragment.TARGET_SET_FOR_AUDIO_WITHOUT_SMS); - } - } + configureAnswerTargetsForSms(call, textMsgs); } private void processVideoUpgradeRequestCall(Call call) { @@ -136,7 +116,7 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> @Override public void onCallChanged(Call call) { Log.d(this, "onCallStateChange() " + call + " " + this); - if (call.getState() != Call.State.INCOMING && call.getState() != Call.State.CALL_WAITING) { + if (call.getState() != Call.State.INCOMING) { // Stop listening for updates. CallList.getInstance().removeCallUpdateListener(mCallId, this); @@ -145,6 +125,12 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> // mCallId will hold the state of the call. We don't clear the mCall variable here as // it may be useful for sending text messages after phone disconnects. mCallId = null; + mHasTextMessages = false; + } else if (!mHasTextMessages) { + final List<String> textMsgs = CallList.getInstance().getTextResponses(call.getId()); + if (textMsgs != null) { + configureAnswerTargetsForSms(call, textMsgs); + } } } @@ -188,6 +174,31 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi> InCallPresenter.getInstance().onDismissDialog(); } + private void configureAnswerTargetsForSms(Call call, List<String> textMsgs) { + final Context context = getUi().getContext(); + final KeyguardManager km = + (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); + final boolean isLockScreenShowing = km.inKeyguardRestrictedInputMode(); + + mHasTextMessages = textMsgs != null; + boolean withSms = call.can(PhoneCapabilities.RESPOND_VIA_TEXT) && mHasTextMessages; + if (call.isVideoCall(context)) { + if (withSms && !isLockScreenShowing) { + getUi().showTargets(AnswerFragment.TARGET_SET_FOR_VIDEO_WITH_SMS); + getUi().configureMessageDialog(textMsgs); + } else { + getUi().showTargets(AnswerFragment.TARGET_SET_FOR_VIDEO_WITHOUT_SMS); + } + } else { + if (withSms && !isLockScreenShowing) { + getUi().showTargets(AnswerFragment.TARGET_SET_FOR_AUDIO_WITH_SMS); + getUi().configureMessageDialog(textMsgs); + } else { + getUi().showTargets(AnswerFragment.TARGET_SET_FOR_AUDIO_WITHOUT_SMS); + } + } + } + interface AnswerUi extends Ui { public void showAnswerUi(boolean show); public void showTargets(int targetSet); diff --git a/InCallUI/src/com/android/incallui/CallList.java b/InCallUI/src/com/android/incallui/CallList.java index 7e3ec21e4..ea0448705 100644 --- a/InCallUI/src/com/android/incallui/CallList.java +++ b/InCallUI/src/com/android/incallui/CallList.java @@ -88,6 +88,7 @@ public class CallList implements InCallPhoneListener { if (updateCallInMap(call)) { Log.w(this, "Removing call not previously disconnected " + call.getId()); } + updateCallTextMap(call, null); } } }; @@ -380,7 +381,7 @@ public class CallList implements InCallPhoneListener { if (updateCallInMap(call)) { Log.i(this, "onUpdate - " + call); } - updateCallTextMap(call, null); + updateCallTextMap(call, call.getCannedSmsResponses()); notifyCallUpdateListeners(call); } |