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

Reduce sensitivity of Foreground Detection, reducing potential ANR false positives #482

Merged
merged 6 commits into from
May 17, 2019

Conversation

fractalwrench
Copy link
Contributor

Goal

When detecting whether the application is in the foreground, we should try using
IMPORTANCE_FOREGROUND_SERVICE rather than IMPORTANCE_VISIBLE. We have observed false positives in ANRs for some specific device manufacturers and tightening the threshold for what is considered the foreground may reduce the signal-noise ratio.

Tests

Ran ANR mazerunner scenarios locally.

When detecting whether the application is in the foreground, we should use
IMPORTANCE_FOREGROUND_SERVICE rather than IMPORTANCE_VISIBLE. We have observed false positives in
ANRs for some specific device manufacturers and tightening the threshold for what is considered the
foreground may reduce the signal-noise ratio.
Copy link
Contributor

@bengourley bengourley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

One related question: could it be that we are getting false positives from this logic too?

In the unlikely event that information about the process cannot be retrieved, this method will return true. This is deemed preferable as ANRs are only reported when the application is in the foreground, and we would rather deliver false-positives than miss true ANRs in this case

?

@fractalwrench
Copy link
Contributor Author

Thanks @bengourley - I've updated that method to return false if that information isn't available.

@fractalwrench fractalwrench merged commit b909dce into master May 17, 2019
@fractalwrench fractalwrench deleted the tweak-foreground-detection branch May 17, 2019 09:20
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.

None yet

2 participants