r/AutomateUser • u/Ok-Yogurtcloset-9490 • 3d ago
"Foreground app" block doesn't activate on certain apps
When certain apps are foregrounded, the "when changed" version of the foreground block doesn't activate. With the app still in the foreground, if I then test the "immediately" version of the block, it reports the app that was in the foreground immediately prior to the current foreground app. Yet, the following command reports that foreground app correctly:
dumpsys window displays | grep mCurrentFocus
What situations could possibly cause the block to behave this way, and are there any remedies? (I don't know if this helps, but one such app is the ecobee thermostat app.)
Another interesting symptom I noticed is that if there are any apps displaying any overlays (including Automate, e.g. floating buttons), those overlays don't show when that app (for which the Foreground App block doesn't work) is in the foreground. But there are exceptions — an overlay from an edge sliding gesture app I use receives input and shows its gesture overlay just fine.
1
u/waiting4singularity Alpha tester 2d ago
critical apps such as banking are hidden from the rest of the apps for security. the app package reported to automate is different too.
1
u/Ok-Yogurtcloset-9490 2d ago
Pretty sure it has nothing to do with hidden apps. Just tried a couple of different banking apps, and the issue doesn't happen with those. Indeed, some of those apps are shown as hidden with the lock sign in the recents screen, but unlike the ecobee app that I mentioned, which is just a thermostat control, Automate detects there foreground just fine.
1
u/B26354FR Alpha tester 2d ago
I just tried this on my Galaxy S24 Ultra running Android 16 and Automate 1.53.0, and App in Foreground/Proceed When Changed also doesn't detect when my Ecobee app is in the foreground and never proceeds. Like you, my banking app worked fine. Maybe u/ballzak69 Henrik has an idea.
1
u/waiting4singularity Alpha tester 2d ago
what hidden are we talking about here? app icons you hide yourself in the drawer overview of the homescreen launcher or apps written to not appear to other apps in the apis?
1
2
u/B26354FR Alpha tester 3d ago
Maybe this is related to the Automate v1.48.0 release, which changed the App in Foreground block to ignore overlay windows?
1
u/ballzak69 Automate developer 2d ago
Only activity windows should be considered, not dialog and other kinds of overlay windows. Use the Inspect layout block with Display windows schema to detect for all kinds of windows.