How To Guide Galaxy Fold 4, fold detection - how to

Search This thread

Lovemtucken

Member
Mar 3, 2023
7
9
G'day all, I figured out how to detect when the device folds using tasker/macrodroid.

The built in Bixby Modes and Routines can do it but it has a long(ish) delay and can really only be used to create a custom notification for tasker/macrodroid to intercept, which then also has to be cleared and adds even more of a delay.

So you set up a task/macro to read the logcat as a trigger.

Trigger logcat details are as follows:
Component: lid_state_changed
Value: 0 or 1 (0=folded and 1=unfolded)
In macrodroid, the buffer is "Events", not sure in tasker as I don't use it.

So I have a macro set up to detect when the device is folded or unfolded and set a global variable to store the status for use by other macros.

This detection method is instant, simple and the best and easiest way to detect when a fold occurs.

Hope it helps everyone and ta-ta :)



Screenshot_20230303_134939_MacroDroid.jpg



Screenshot_20230303_134941_MacroDroid.jpg
 
Last edited:

白い熊

Senior Member
Aug 29, 2011
969
330
相撲道
lid_state_changed -- how did you find it? I'm on the latest FW, OneUI 5.1 and this doesn't come up in logcat on phone open or closed - so can't set it by it.

I've been identifying open/close state by a nasty workaround in tasker via reading the edge_panel_width variable - as it has different values on open/close - but for this have to have the edge panel enabled, and I'd like to disable it...
 

Lovemtucken

Member
Mar 3, 2023
7
9
lid_state_changed -- how did you find it? I'm on the latest FW, OneUI 5.1 and this doesn't come up in logcat on phone open or closed - so can't set it by it.

I've been identifying open/close state by a nasty workaround in tasker via reading the edge_panel_width variable - as it has different values on open/close - but for this have to have the edge panel enabled, and I'd like to disable it...

That's strange. I'm on 5.0.... surely they didn't go through the effort of changing it :/

I found it by using macrodroid. When you select the logcat as the trigger, there's an option to identify the log entry by recording it then displaying it.

So when I did this, a floating button appeared on the screen. I tapped it and it starts recording the logcat. I quickly folded the phone shut then open again and hit the button to stop recording. It then displayed all logcat entries and I went through it until I found one that sounded like a fold event, then set it as the trigger and tested it. They must've changed the name of it in 5.1.

If you want, get an app that records the logcat, or even used macrodroid to do it the way I did, then quickly fold and unfold your phone and stop recording, then screenshot it and message it to me and I'll have a look :)
 

shdwphnx

Senior Member
Jul 26, 2005
104
18
Tucson
Is there a way to detect screen fold/unfold in Tasker or MacroDroid without using LogCat? My device has been updated to Android 13, which breaks LogCat functionality for this.
 

Lovemtucken

Member
Mar 3, 2023
7
9
Is there a way to detect screen fold/unfold in Tasker or MacroDroid without using LogCat? My device has been updated to Android 13, which breaks LogCat functionality for this.
I'm on 13 too and it works. LogCat needs either the abd hack or root to work. For abd, macrodroid will give you a command to enter which will let your phone read logcat without root.
 

Lovemtucken

Member
Mar 3, 2023
7
9
Is there a way to detect screen fold/unfold in Tasker or MacroDroid without using LogCat? My device has been updated to Android 13, which breaks LogCat functionality for this.
If you need help doing the abd hack, let me know. It doesn't really hack your phone or do anything to it... it literally just gives macrodroid permission to read the logcat and that's it.
 
  • Like
Reactions: galaxys

shdwphnx

Senior Member
Jul 26, 2005
104
18
Tucson
If you need help doing the abd hack, let me know. It doesn't really hack your phone or do anything to it... it literally just gives macrodroid permission to read the logcat and that's it.
Is MacroDroid's ADB hack different from the one that Tasker does via the "Tasker Permissions" tool? That one causes Android to pop-up a prompt to allow once or deny whenever Tasker tries to read the log, and automatically revokes the permission as soon as I switch to another application.
 

Lovemtucken

Member
Mar 3, 2023
7
9
Is MacroDroid's ADB hack different from the one that Tasker does via the "Tasker Permissions" tool? That one causes Android to pop-up a prompt to allow once or deny whenever Tasker tries to read the log, and automatically revokes the permission as soon as I switch to another application.
I'm not too sure, I don't use tasker.

The macrodroid adb permanently gives macrodroid logcat read permission by entering a command in Windows command line.

You may even be able to do it with tasker.

adb shell pm grant com.arlosoft.macrodroid android.permission.READ_LOGS

You could try changing "com.arlosoft.macrodroid" to the tasker package name and see if it works?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 3
    G'day all, I figured out how to detect when the device folds using tasker/macrodroid.

    The built in Bixby Modes and Routines can do it but it has a long(ish) delay and can really only be used to create a custom notification for tasker/macrodroid to intercept, which then also has to be cleared and adds even more of a delay.

    So you set up a task/macro to read the logcat as a trigger.

    Trigger logcat details are as follows:
    Component: lid_state_changed
    Value: 0 or 1 (0=folded and 1=unfolded)
    In macrodroid, the buffer is "Events", not sure in tasker as I don't use it.

    So I have a macro set up to detect when the device is folded or unfolded and set a global variable to store the status for use by other macros.

    This detection method is instant, simple and the best and easiest way to detect when a fold occurs.

    Hope it helps everyone and ta-ta :)



    Screenshot_20230303_134939_MacroDroid.jpg



    Screenshot_20230303_134941_MacroDroid.jpg
    1
    Is there a way to detect screen fold/unfold in Tasker or MacroDroid without using LogCat? My device has been updated to Android 13, which breaks LogCat functionality for this.
    If you need help doing the abd hack, let me know. It doesn't really hack your phone or do anything to it... it literally just gives macrodroid permission to read the logcat and that's it.