Initialize lastUsedElapsedTime to Integer.MIN_VALUE.
Since 'lastUsedElapsedTime' indicates the timestamp at which the app was last used by the user and this isn't necessarily the reason why we create AppUsageHistory objects, we shouldn't be initializing the 'lastUsedElapsedTime' to the timestamp at which the object is being created. Also, update 'lastPredictedTime' to Integer.MIN_VALUE as getElapsedTime() time doesn't return predictable values for timestamps in the past and passing getElapsedTime(0) isn't accurate as it basically indicates the timestamp at boot. Bug: 206518483 Test: atest tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest.java Change-Id: Ib90b435b1efc34144f0461aaaf339fc6037ecdc2
Loading
Please register or sign in to comment