New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 678276 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Android: Session.TotalDuration metric doesn't count time a dialog is displayed

Project Member Reported by asvitk...@chromium.org, Jan 4 2017

Issue description

Android: Session.TotalDuration metric may not be accurate if a dialog is displayed.

Details from Bryan McQuade:

"
On Android, we record Session.TotalDuration during this flow, which is described as "The length of a session (launch/foregrounding to backgrounding) in milliseconds."

Unfortunately, it seems that onPause can be called in cases where the app isn't really going into the background. In particular, in https://developer.android.com/guide/topics/processes/process-lifecycle.html, when describing different process/activity states, it says:

"A visible process ... is running an Activity that is visible to the user on-screen but not in the foreground (its onPause() method has been called). This may occur, for example, if the foreground Activity is displayed as a dialog that allows the previous Activity to be seen behind it."

I've confirmed that if Chrome displays a dialog, due to for example a JavaScript alert, onPause gets invoked, and we log Session.TotalDuration at this point, even though Chrome is in the foreground. When the dialog gets dismissed, we begin recording a new session. This means both that time spent displaying dialogs is not included in session duration (not necessarily a bad thing), but also that we end up recording a single Chrome session as multiple separate sessions, which means both our session counts and individual session duration tracking logic are incorrect (though the sum total of all durations is correct, excluding time spent with dialogs displayed).

In my case, we saw a somewhat significant number of cases where the onPause->OnAppEnterBackground flow was invoked without Chrome going into the background: as a result of updating the page load metrics 'hidden' state as part of the OnAppEnterBackground path and updating our visibility, the reported number of page loads that went into the background more than doubled. So it seems that this happens with enough frequency that it's probably worth trying to address it."

One solution that was proposed was to delay recording the session end for a few seconds, which could allow merging sessions that would be interrupted by a dialog - but a concern was brought up that this could cause us to lose sessions when the app gets killed after going to the background.

For now, I'll land a CL to put this disclaimer in the histogram description.


 
Cc: mariakho...@chromium.org
Project Member

Comment 2 by bugdroid1@chromium.org, Jan 4 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/7fcd6039392cb3f571925505c1b7fdb14dc786a0

commit 7fcd6039392cb3f571925505c1b7fdb14dc786a0
Author: asvitkine <asvitkine@chromium.org>
Date: Wed Jan 04 19:20:06 2017

Update Session.TotalDuration description to mention known issue.

BUG=678276

Review-Url: https://codereview.chromium.org/2610923002
Cr-Commit-Position: refs/heads/master@{#441431}

[modify] https://crrev.com/7fcd6039392cb3f571925505c1b7fdb14dc786a0/tools/metrics/histograms/histograms.xml

The changelist description only warns about javascript dialogs.

Yet, this issue sounds broader than that.  Are there other known instances where we'd run into onPause calls?  e.g., other forms of modal dialogs spawned by Chrome?  Perhaps interactions with other apps via the notifications bar?  (Example: I have the "Twilight" screen-dimming app installed.  Sometime I swipe down to see its notification and tap on it, which yields its settings dialog superimposed on the middle of my screen with Chrome still visible behind it.)
Project Member

Comment 4 by bugdroid1@chromium.org, Jan 12 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/259cf56296a4fdcc78d97875589aa466858f4402

commit 259cf56296a4fdcc78d97875589aa466858f4402
Author: asvitkine <asvitkine@chromium.org>
Date: Thu Jan 12 00:19:03 2017

Expand Session.TotalDuration disclaimer on Android.

BUG=678276

Review-Url: https://codereview.chromium.org/2628983003
Cr-Commit-Position: refs/heads/master@{#443074}

[modify] https://crrev.com/259cf56296a4fdcc78d97875589aa466858f4402/tools/metrics/histograms/histograms.xml

Project Member

Comment 5 by sheriffbot@chromium.org, Feb 15 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Available (was: Untriaged)
Summary: Android: Session.TotalDuration metric doesn't count time a dialog is displayed (was: Android: Session.TotalDuration metric may not be accurate if a dialog is displayed)

Sign in to add a comment