UI Event trigger for power button?

Post your questions and help other users.

Moderator: Martin

Post Reply
Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

UI Event trigger for power button?

Post by Wibbly » 08 Dec 2014 16:28

I use the standard pattern login so (on ny Lollipop Nexus 4) the failed login trigger does work (it only seems to work for PIN type logins).

So I would like to create a flow that triggers an action based on the user not logging in with a certain time. I can test when they have logged in with the User Present trigger, but also need to detect when they are stuck on the login screen. I was thinking of using the UI Event trigger to find when the power button has been pressed. Anyone know what Package Name/Event type to use for this. Or maybe there's a Package Name/Event type for the lock screen being active specifically?

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: UI Event trigger for power button?

Post by Martin » 08 Dec 2014 17:45

Hi,

Failed login attempt should also work with the pattern lock screen but the system only counts a login attempt as failed when at least 4 dots are connected. Failed login attempts with 3 dots or less are not sent to Automagic.
You could use UI Event with event type Announcement and package name set to com.android.systemui to detect failed login attempts with less than 4 connected dots. The text on a Nexus5/Android5 is Wrong Pattern in such a case. Successful attempts produce the announcement Pattern completed. I think that some earlier versions of Android also produced an announcement for each connected dot but the events have only been sent when the pattern was drawn very slowly.

The power button can not be detected using the UI Event. Detecting keyboard events requires a rooted device the command getevent. There are some examples available in the flow sharing area.
Trigger Display State: Off could work to detect a regular short-press of the power button.

Regards,
Martin

Wibbly
Posts: 418
Joined: 17 Mar 2014 09:02

Re: UI Event trigger for power button?

Post by Wibbly » 08 Dec 2014 18:43

Sorry - my bad. I was caught by the requirement for 4 dots :-(

Failed Login does indeed work :-)

And thanks for the quick response.

Post Reply