1

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?

2

If you've not rebooted your Android, then you may be able to get the time stamp for the last few unlocks performed. Setup in PC and execute:

adb shell dumpsys activity broadcasts 

In the overwhelming (possibly) output,

  • For stock Android 6.0.1:

    • locate the string Historical broadcasts summary [background]. Following it would be the summary of some historical broadcasts.
    • 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:

    • locate the string Historical broadcasts [background]. Following it would be details of some historical broadcasts.
    • 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)

IMG

In the output,

  • enq: enqueueClockTime
  • disp: dispatchedClockTime
  • 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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.