0

[WebOTP] Record whether the phone is on and unlocked upon notification

We expected in most cases the phone is locked when we show notifications
to users for cross-device WebOTP. During UX review we learned that users
may unlock their phone before the SMS arrives because they are expecting
an SMS.

Bug: 1238445
Change-Id: I247e96e1d0d6401e46b53d47a9bdf9a6e548dad3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3088026
Reviewed-by: Peter Beverloo <peter@chromium.org>
Reviewed-by: Elly Fong-Jones <ellyjones@chromium.org>
Commit-Queue: Yi Gu <yigu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#912706}
This commit is contained in:
Yi Gu
2021-08-17 20:02:13 +00:00
committed by Chromium LUCI CQ
parent a580329ebd
commit ca8aea8640
2 changed files with 14 additions and 0 deletions
chrome/android/java/src/org/chromium/chrome/browser/sharing/sms_fetcher
tools/metrics/histograms/metadata/sharing

@ -16,6 +16,7 @@ import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.device.DeviceConditions;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.notifications.NotificationConstants;
import org.chromium.chrome.browser.notifications.NotificationUmaTracker;
@ -129,6 +130,8 @@ public class SmsFetcherMessageHandler {
sEmbeddedOrigin = embeddedOrigin;
sSmsFetcherMessageHandlerAndroid = smsFetcherMessageHandlerAndroid;
Context context = ContextUtils.getApplicationContext();
RecordHistogram.recordBooleanHistogram("Sharing.SmsFetcherScreenOnAndUnlocked",
DeviceConditions.isCurrentlyScreenOnAndUnlocked(context));
PendingIntentProvider confirmIntent = PendingIntentProvider.getBroadcast(context,
/*requestCode=*/0,
new Intent(context, NotificationReceiver.class)

@ -641,6 +641,17 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary>
</histogram>
<histogram name="Sharing.SmsFetcherScreenOnAndUnlocked" enum="Boolean"
expires_after="M96">
<owner>yigu@chromium.org</owner>
<owner>web-identity@google.com</owner>
<summary>
Records whether the phone is on and unlocked when we show the notification
to users. False if either the phone is locked or the phone does not have a
screen lock but the screen is off. This is logged once per notification.
</summary>
</histogram>
<histogram name="Sharing.SmsFetcherTapWithChromeDestroyed" enum="Boolean"
expires_after="M96">
<owner>yigu@chromium.org</owner>