SET_VOLUME_KEY_LONG_PRESS_LISTENER

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Post Reply
anuraag
Posts: 280
Joined: 24 Jan 2015 02:06

SET_VOLUME_KEY_LONG_PRESS_LISTENER

Post by anuraag » 13 Apr 2019 09:50

@Martin
Can you please add this to your to do list? SET_VOLUME_KEY_LONG_PRESS_LISTENER was added in oreo source code and can be used as trigger with screen off too.

for ref
https://www.xda-developers.com/skip-mus ... s-no-root/

User avatar
Desmanto
Posts: 2144
Joined: 21 Jul 2017 17:50

Re: SET_VOLUME_KEY_LONG_PRESS_LISTENER

Post by Desmanto » 15 Apr 2019 01:24

Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

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

Re: SET_VOLUME_KEY_LONG_PRESS_LISTENER

Post by Martin » 15 Apr 2019 15:12

Sure :D

Pepy
Posts: 75
Joined: 31 Oct 2018 10:53
Location: Canada

Re: SET_VOLUME_KEY_LONG_PRESS_LISTENER

Post by Pepy » 05 Jun 2019 08:28

@Martin, would it also be possible to customize the duration of the long-press for the trigger to activate as well?
Using the Hardware Key Event, a key_duration variable was provided. Perhaps the same can be done with this one.
Newbie to device automation! Hope my post was helpful, useful or informative :D
Device: OnePlus 5T (Dumpling) running crDroid 5.x, rooted via Magisk 8-)

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

Re: SET_VOLUME_KEY_LONG_PRESS_LISTENER

Post by Martin » 08 Jun 2019 07:58

The system controls when the Down action is sent to Automagic and I don't see a way to configure this. But you could add a condition to the flow to execute different actions based on variable key_duration for the Up action.
e.g. a condition Expression: key_duration > 1500 to execute subsequent actions only when the duration was longer than 1500ms.

Delaying detection of the down event would also work but it's slightly more complicated since it requires to detect and ignore the down event when the delay is not reached. Something like this might work to execute an action when VOLUME_DOWN is pressed and hold more than initalDelay+500ms:
Flow 1:
-Trigger Volume Long Press Event: VOLUME_DOWN Down
-Action Sleep: 500ms
-Action ...

Flow 2:
-Trigger Volume Long Press Event: VOLUME_UP Up
-Action Stop Flows: Flow 1

I add a TODO item to integrate this feature directly into the trigger.

Regards,
Martin

Pepy
Posts: 75
Joined: 31 Oct 2018 10:53
Location: Canada

Re: SET_VOLUME_KEY_LONG_PRESS_LISTENER

Post by Pepy » 17 Sep 2019 02:00

Martin wrote:
08 Jun 2019 07:58
The system controls when the Down action is sent to Automagic and I don't see a way to configure this. But you could add a condition to the flow to execute different actions based on variable key_duration for the Up action.
e.g. a condition Expression: key_duration > 1500 to execute subsequent actions only when the duration was longer than 1500ms.
That's the method I'm currently using now :)
Unfortunately, it only works when the screen is on.
Martin wrote:
08 Jun 2019 07:58
Delaying detection of the down event would also work but it's slightly more complicated since it requires to detect and ignore the down event when the delay is not reached. Something like this might work to execute an action when VOLUME_DOWN is pressed and hold more than initalDelay+500ms:
Flow 1:
-Trigger Volume Long Press Event: VOLUME_DOWN Down
-Action Sleep: 500ms
-Action ...

Flow 2:
-Trigger Volume Long Press Event: VOLUME_UP Up
-Action Stop Flows: Flow 1
So in this case, wouldn't I need a condition to check if Flow 1 is still running?
Martin wrote:
08 Jun 2019 07:58
I add a TODO item to integrate this feature directly into the trigger.
Are you referring to the delay?
Newbie to device automation! Hope my post was helpful, useful or informative :D
Device: OnePlus 5T (Dumpling) running crDroid 5.x, rooted via Magisk 8-)

Post Reply