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

Use SystemClock.elapsedRealtime to track app.durationInForeground #1378

Merged
merged 1 commit into from
Sep 21, 2021

Conversation

fractalwrench
Copy link
Contributor

@fractalwrench fractalwrench commented Sep 17, 2021

Goal

Uses SystemClock.elapsedRealtime() rather than System.currentTimeMillis() to track the duration and durationInForeground values. SystemClock is recommended for timing intervals as it is not affected by CPU power saving mode or the user altering the device time.

System.currentTimeMillis() is still used in the codebase elsewhere where accuracy is not as key - for example, adding a timestamp to the filename of persisted errors.

Testing

Updated existing test coverage and manually tested to confirm that the values are correct.

@fractalwrench fractalwrench changed the title Use SystemClock.elapsedRealtime to track durationInForeground Use SystemClock.elapsedRealtime to track app.durationInForeground Sep 17, 2021
@fractalwrench fractalwrench marked this pull request as ready for review September 17, 2021 16:00
@bugsnagbot
Copy link
Collaborator

Android notifier sizes

Format Size impact of Bugsnag (kB) Size impact of Bugsnag when Minified (kB)
APK 1272.15 1159.48
arm64_v8a 405.9 295.31
armeabi -492.59 -21.55
armeabi_v7a 377.23 266.64
x86 446.84 336.25
x86_64 430.47 319.87

Generated by 🚫 Danger

Copy link
Contributor

@lemnik lemnik left a comment

Choose a reason for hiding this comment

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

LGTM

@fractalwrench fractalwrench merged commit b41619c into next Sep 21, 2021
@fractalwrench fractalwrench deleted the PLAT-7121/system-clock-time branch September 21, 2021 08:15
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.

3 participants