diff options
author | Luca Stefani <luca.stefani.ge1@gmail.com> | 2020-03-07 13:27:25 +0100 |
---|---|---|
committer | Luca Stefani <luca.stefani.ge1@gmail.com> | 2020-03-07 13:27:25 +0100 |
commit | 0188d6577997ed082763025a39e1fe6c85f21e08 (patch) | |
tree | 1296b828eaa65d7a31be197697386c9bd173f1b6 /java/com | |
parent | 7266cac8d53cfa332b123cc564d75a0cabb4cbc3 (diff) | |
parent | 2468ae1ccdeee49b0d1af0836090c35ab736d997 (diff) | |
download | android_packages_apps_Dialer-0188d6577997ed082763025a39e1fe6c85f21e08.tar.gz android_packages_apps_Dialer-0188d6577997ed082763025a39e1fe6c85f21e08.tar.bz2 android_packages_apps_Dialer-0188d6577997ed082763025a39e1fe6c85f21e08.zip |
Merge tag 'android-10.0.0_r31' into lineage-17.1-android-10.0.0_r31
Android 10.0.0 release 31
* tag 'android-10.0.0_r31':
Require unlock for custom SMS dialog
Change-Id: Icc08223fd37f937cd3ef8163be88d2db8d9c5341
Diffstat (limited to 'java/com')
-rw-r--r-- | java/com/android/incallui/answer/impl/AnswerFragment.java | 49 |
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); |