Feature Request: "Device Locked" event

77 views
Skip to first unread message

Anees Ahmed

unread,
Aug 20, 2017, 4:29:06 AM8/20/17
to Tasker
You already have made "display unlocked" event. You just have to make the "locked" event counterpart. Please!!!

P.S. Is there a workaround/trick for now?

Pent

unread,
Aug 20, 2017, 6:16:54 AM8/20/17
to Tasker
I don't know any way to detect that happening.

Closest you can get is Display Off.

Pent

Anees Ahmed

unread,
Aug 20, 2017, 6:59:25 AM8/20/17
to Tasker
After googling, I found out that there is really no way to do this. :-(

But there is an instantaneous check available as shown here. If you could provide this instant check as an ACTION returning boolean, maybe I could detect lock poll style. I could set an interval between polls. I think I could further optimise the polls using "Display Off" and "Display unlocked" events... What do you think ???

hollywoodfrodo

unread,
Aug 22, 2017, 2:00:21 PM8/22/17
to Tasker
Since "locking" your phone is generally done by turning off the display, why wouldn't "display off" work?  What is it you're trying to accomplish with a "phone locked" event?

Anees Ahmed

unread,
Aug 23, 2017, 1:51:43 AM8/23/17
to Tasker
You are missing many corner cases, my friend.

Here are the gotchas if I follow that design:

1. Device is locked. I just press power button to wake up device to see the lock screen. Then I press power button again to turn off screen. [Bug: "display off" fires up, but "device locked" would never, because the device was never unlocked!]

2. (I haven't tested this one) Ever heard of Moto Notifications? It's when screen automatically lights up to show Notifications without waking the device and turns off. [Bug: same as above]

Soudane GMTA

unread,
Jan 28, 2023, 8:42:26 PM1/28/23
to Tasker
I found what I think is a solution to this ancient question ...

I found that I can detect that the device is getting locked by means of a Logcat Entry profile.

My device is a rooted Pixel 5 running crDroid-v.7.25 (Android 11), and all I have to do in Logcat Entry is set a filter on the KeyguardViewMediator component to match on the following:

~R.*notifyStartedGoingToSleep.*

This filter may very well be different on different devices and different OS's, but the screen that comes up for Logcat Entry allows you to query for logcat events by means of clicking on the magnifying glass icon on the "Component" line.  With this, you can select possible logcat events that correspond to the device starting to be locked.

For me, this is working very reliably to detect that my device is starting to be locked.

Soudane GMTA

unread,
Jan 29, 2023, 11:59:39 AM1/29/23
to Tasker
On Saturday, January 28, 2023 at 8:42:26 PM UTC-5 Soudane GMTA wrote:
I found what I think is a solution to this ancient question ...

I found that I can detect that the device is getting locked by means of a Logcat Entry profile.

My device is a rooted Pixel 5 running crDroid-v.7.25 (Android 11), and all I have to do in Logcat Entry is set a filter on the KeyguardViewMediator component to match on the following:

~R.*notifyStartedGoingToSleep.*

I discovered that the following works even better for me:

The Logcat Entry KeyguardViewMediator filter should be on ~R.*showLocked.*

Again, this is likely to vary between different devices and OS's, so you should use the magnifying glass icon on the Component line to select the proper logcat line to match on.

Reply all
Reply to author
Forward
0 new messages