Search Issue Tracker

Won't Fix

Votes

1

Found in

2018.1.0f2

2018.4

2020.2

Issue ID

1044454

Regression

No

[Android] System.Diagnostics.StopWatch don't track time properly when application is on background

Mobile

-

When the application is put on the background on Android Time.realtimeSinceStartup and System.Diagnostics.StopWatch either run slower or stops running completely. This is against the expected behavior for Stopwatch and the documented behavior for Time.realtimeSinceStartup:
"realtimeSinceStartup also keeps increasing while the player is paused (in the background)"

To reproduce:
1. Download attached project "AndroidBlit.zip" and open in Unity
2. Open "SampleScene" scene
3. Build and Run for Android.
4. Launch application on a device
5. Disconnect device from the computer
6. Lock the device and wait for few minutes
7. Unlock the phone notice

Expected results: Observe that RealtimeSinceStartup, StopWatch, DateTime, and SystemClock elapsed times are the same after coming back to the app from sleep
Actual results: Observe that RealtimeSinceStartup, StopWatch, DateTime, and SystemClock elapsed times are not the same after coming back to the app from sleep

Notes:
- This issue reproduces only on Android devices
- On iOS devices, this issue does not reproduce
- If a phone is connected to PC via USB it works fine because it affects the power management of the device causing the clock to run properly

Reproducible with: 2018.4.27f1, 2019.4.11f1, 2020.1.7f1, 2020.2.0b5

Devices:
- Google Pixel 2, OS: 8.1.0, CPU: arm64-v8a, GPU: Adreno (TM) 540 - Reproduced
- VLNQA00015, Samsung Galaxy Note8 (SM-N950W), Android 8.0.0, CPU: Snapdragon 835 MSM8998, GPU: Adreno (TM) 540
- iPhone 6s, iOS: 10.3.2, CPU: A9 - Not reproduced

RESOLUTION:
The Time.RealtimeSinceStartup case is a duplicate of case 1037712.

  1. Resolution Note (2020.1.X):

    At this time the Stopwatch implementation for Android is as monotonic as is possible.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.