summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2020-01-15 15:57:18 -0800
committerXin Li <delphij@google.com>2020-01-15 15:57:18 -0800
commitf6b13b7304561f5a698dde9278cef9aeab32f451 (patch)
tree25be69fac8f805d56df2172732a15661f4d1f59b
parent80a6f0558b9ad4264b0c47de386aecc62e9f4525 (diff)
parent5fce345b14b5147c0e757bcf1a3fdc7dd70db22f (diff)
DO NOT MERGE - Merge qt-qpr1-dev-plus-aosp-without-vendor (6129114) into stage-aosp-master
Bug: 146167222 Change-Id: I44c4fcf7b96d13ecdbcce4f79517f18a38c9726c
-rw-r--r--java/com/android/incallui/answer/impl/AnswerFragment.java49
1 files changed, 46 insertions, 3 deletions
diff --git a/java/com/android/incallui/answer/impl/AnswerFragment.java b/java/com/android/incallui/answer/impl/AnswerFragment.java
index 8d8b08791..2405b8edd 100644
--- a/java/com/android/incallui/answer/impl/AnswerFragment.java
+++ b/java/com/android/incallui/answer/impl/AnswerFragment.java
@@ -22,10 +22,15 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
+import android.annotation.TargetApi;
+import android.app.KeyguardManager;
+import android.app.KeyguardManager.KeyguardDismissCallback;
import android.content.Context;
import android.content.pm.PackageManager;
import android.location.Location;
import android.net.Uri;
+import android.os.Build.VERSION;
+import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
@@ -1052,14 +1057,47 @@ public class AnswerFragment extends Fragment
}
@Override
+ @TargetApi(VERSION_CODES.O)
public void smsSelected(@Nullable CharSequence text) {
LogUtil.i("AnswerFragment.smsSelected", null);
textResponsesFragment = null;
if (text == null) {
- createCustomSmsDialogFragment = CreateCustomSmsDialogFragment.newInstance();
- createCustomSmsDialogFragment.show(getChildFragmentManager(), null);
- return;
+ if (VERSION.SDK_INT < VERSION_CODES.O) {
+ LogUtil.i("AnswerFragment.smsSelected", "below O, showing dialog directly");
+ showCustomSmsDialog();
+ return;
+ }
+ if (!getContext().getSystemService(KeyguardManager.class).isKeyguardLocked()) {
+ LogUtil.i("AnswerFragment.smsSelected", "not locked, showing dialog directly");
+ showCustomSmsDialog();
+ return;
+ }
+
+ // Show the custom reply dialog only after device is unlocked, as it may cause impersonation
+ // see b/137134588
+ LogUtil.i("AnswerFragment.smsSelected", "dismissing keyguard");
+ getContext()
+ .getSystemService(KeyguardManager.class)
+ .requestDismissKeyguard(
+ getActivity(),
+ new KeyguardDismissCallback() {
+ @Override
+ public void onDismissCancelled() {
+ LogUtil.i("AnswerFragment.smsSelected", "onDismissCancelled");
+ }
+
+ @Override
+ public void onDismissError() {
+ LogUtil.i("AnswerFragment.smsSelected", "onDismissError");
+ }
+
+ @Override
+ public void onDismissSucceeded() {
+ LogUtil.i("AnswerFragment.smsSelected", "onDismissSucceeded");
+ showCustomSmsDialog();
+ }
+ });return;
}
if (primaryCallState != null && canRejectCallWithSms()) {
@@ -1068,6 +1106,11 @@ public class AnswerFragment extends Fragment
}
}
+ private void showCustomSmsDialog() {
+ createCustomSmsDialogFragment = CreateCustomSmsDialogFragment.newInstance();
+ createCustomSmsDialogFragment.showNow(getChildFragmentManager(), null);
+ }
+
@Override
public void smsDismissed() {
LogUtil.i("AnswerFragment.smsDismissed", null);