The file under consideration is any file under /data/system/usagestats/0/daily/
. The entries it has are like:
<package lastTimeActive="77497976" package="com.android.settings" timeActive="471657" lastEvent="2" />
<package lastTimeActive="50486897" package="com.android.dialer" timeActive="180327" lastEvent="2" />
<package lastTimeActive="83158956" package="com.cyanogenmod.trebuchet" timeActive="461860" lastEvent="2" />
<package lastTimeActive="59444603" package="com.slovoed.oald" timeActive="405608" lastEvent="2" />
Here is the complete text for the file 1438905600000
.
The value 77497976
doesn't seem to be Unix Time, and 471657
seems to be milliseconds.
I added that value into the value mentioned in file name i.e. 1438905600000
+ 77497976
, and the converted resultant of 1438983097976
here doesn't reflect the actual result shown in GUI here:
(Click image to enlarge; screenshot was taken on Aug 8, 2015 at 05:08 AM)
Package name of apps shown in screenshot whose raw time-stamps you can see in the file:
- Settings →
com.android.settings
- Dialer →
com.android.dialer
- Launcher3 →
com.cyanogenmod.trebuchet
- SQLite Editor →
com.speedsoftware.sqleditor
- Titanium Backup →
com.keramidas.titaniumbackup
- OALD →
com.slovoed.oald
- ES File Explorer →
com.estrongs.android.pop
- Clock →
com.android.deskclock
adb shell su -c 'dumpsys usagestats'
is of no help since it gives no output to me.
In Android 4.x, it is easy to understand the time-stampIn Android 4.x, it is easy to understand the time-stamp (mainly the "last time used") because Unix Time is written in the logs, and you can convert it into human readable time easily.
I looked at UsageStats, UsageStatsManager, UsageStatsActivity but couldn't understand how the time gets converted.
Alternatively, is there a schema which Lollipop follows to write entries in those usage-stats file? Perhaps, that can help to figure out in conversion?
I'm using a rooted OnePlus One running CM12.