From 6861dc525e2caa9ced087e1c11ad0274e6e6ea12 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Mon, 8 Sep 2014 14:24:23 -0700 Subject: Disable respond via message option if lockscreen is active Bug: 17399771 Change-Id: I54cdbd41df05c932ed8c5a61a9bc7f8eba9c8153 --- InCallUI/src/com/android/incallui/AnswerPresenter.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java index 4022bb49d..aeb0bc3c5 100644 --- a/InCallUI/src/com/android/incallui/AnswerPresenter.java +++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java @@ -17,6 +17,7 @@ package com.android.incallui; import android.telecomm.PhoneCapabilities; +import android.app.KeyguardManager; import android.content.Context; import java.util.List; @@ -98,16 +99,21 @@ public class AnswerPresenter extends Presenter final List 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(getUi().getContext())) { - if (withSms) { + 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) { + if (withSms && !isLockScreenShowing) { getUi().showTargets(AnswerFragment.TARGET_SET_FOR_AUDIO_WITH_SMS); getUi().configureMessageDialog(textMsgs); } else { -- cgit v1.2.3