Update UsageStats#checkAndGetTimeLocked behavior.

The time change event was happening for every user even if they were not
unlocked, causing UsageStatsService to crash. Since the data is now
located in CE, the #checkAndGetTimeLocked function has been moved to
UserUsageStatsService, tying time change events to each user instead of
UsageStatsService. This gives the guarantee that no usage stats data
will be accessed or modified if the user service is not existent while
keeping the same behavior as earlier.

References to #checkAndGetTimeLocked in UsageStatsService have been
updated to call System.currentTimeMillis() directly.

Bug: 140529704
Test: atest UsageStatsTest
Test: atest UsageStatsDatabaseTest
Change-Id: I746790f3918b927ac8ac76ee860c94cac603e5da
2 files changed