Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix calculation of durationInForeground when autoCaptureSessions is false #394

Merged
merged 5 commits into from
Dec 17, 2018

Conversation

fractalwrench
Copy link
Contributor

Goal

If autoCaptureSessions is set to false, the app.durationInForeground value always equals 0 in reports.

Additionally, if the app is put into the background and then brought back into the foreground within a 30 second threshold, the durationInForeground value is not reset, and can be erroneously large.

This changeset fixes these two issues.

Design

Please see the design doc for a detailed overview.

Tests

Added a mazerunner scenario to verify that durationInForeground is > 0 when autoCaptureSessions is false. Additionally, manual testing checked the following scenarios, for both potential values of autoCaptureSessions:

  • Handled/Unhandled exceptions have non-zero value for durationInForeground
  • Putting the activity in the background (by clicking the home button then recent tasks button) immediately resets the durationInForeground field

The session tracker class failed to record activities entering the foreground when automatic
tracking was disabled. This led to durationInForeground always showing as 0 in reports.
@Pezzah
Copy link
Contributor

Pezzah commented Dec 12, 2018

Can there be a test for the application sending an error while it is not in the foreground, and check that durationInForeground is set to zero

@fractalwrench
Copy link
Contributor Author

thanks @Pezzah - I've added a mazerunner scenario that verifies the inForeground and durationInForeground values when the app exits the foreground.

@fractalwrench fractalwrench merged commit de47c8a into master Dec 17, 2018
@fractalwrench fractalwrench deleted the in-foreground-fixes branch December 17, 2018 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants