Commit 19eb6004 authored by Himanshu Jaju's avatar Himanshu Jaju Committed by Commit Bot

Update rules for opening dialer directly.

For Q and above, we don't open the dialer in any case.
For N and below, we always open the dialer. If the device is locked then
a notification is shown which is dismissed on unlock.
For O and P, we open dialer if devices is unlocked. If the devices is
locked then we don't open the dialer and keep the notification.

Bug: 1002137
Change-Id: I81f4386439efe2b60b6b35a8bb8cdc7c59fb591c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1795766
Commit-Queue: Himanshu Jaju <himanshujaju@chromium.org>
Reviewed-by: default avatarAlex Chau <alexchau@chromium.org>
Reviewed-by: default avatarMichael van Ouwerkerk <mvanouwerkerk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695560}
parent df8d80cf
......@@ -10,6 +10,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import org.chromium.base.BuildInfo;
......@@ -127,9 +128,26 @@ public class ClickToCallMessageHandler {
* Returns true if we should open the dialer straight away.
*/
private static boolean shouldOpenDialer() {
// On Q and above, we never open the dialer directly. On pre-Q, we always open the dialer
// directly.
return !BuildInfo.isAtLeastQ() && FeatureUtilities.isClickToCallOpenDialerDirectlyEnabled();
if (!FeatureUtilities.isClickToCallOpenDialerDirectlyEnabled()) {
return false;
}
// On Android Q and above, we never open the dialer directly.
if (BuildInfo.isAtLeastQ()) {
return false;
}
// On Android N and below, we always open the dialer. If device is locked, we also show a
// notification. We can listen to ACTION_USER_PRESENT and remove this notification when
// device is unlocked.
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
return true;
}
// On Android O and P, we open dialer only when device is unlocked since we cannot listen to
// ACTION_USER_PRESENT.
return DeviceConditions.isCurrentlyScreenOnAndUnlocked(
ContextUtils.getApplicationContext());
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment