I have a Nexus 5 Android phone with standard pattern-locked screen. Is there a way to see a (recent) history of when my screen was unlocked?
I have a Nexus 5 Android phone with standard pattern-locked screen. Is there a way to see a (recent) history of when my screen was unlocked?
If you've not rebooted your Android, then you may be able to get the time stamp for the last few unlocks performed. Setup adb in PC and execute:
adb shell dumpsys activity broadcasts
In the overwhelming (possibly) output,
For stock Android 6.0.1:
In the new given info, locate the string android.intent.action.USER_PRESENT1. One of the next few lines to every matched line would show you the time stamp of a successful unlock.
The order of matched lines would be chronological with most recent entry being the first to show up.
For stock Android 5.1.1:
In the new given info, locate the string android.intent.action.USER_PRESENT1. One of the next few lines to every matched line would show you the time stamp of a successful unlock.
The order of matched lines would be chronological with most recent entry being the first to show up.
A demonstration performed on Android 6.0.1:
adb shell "dumpsys activity broadcasts | sed -ne '/Historical broadcasts summary \[background\]/,\$p' | grep -A2 'android.intent.action.USER_PRESENT'"
Output:
(Click image to enlarge)
In the output,
fin: finishedTime
I do not know what they particularly correspond to but I can assure you that one of them is what you're after, possibly the first one. The output is in consonance with the rudimentary observation performed in parallel by keeping a tab on time during screen unlock.
1 Courtesy of Chris for the answer here.
Q & A