Version 5.53 changes in detection of foreground apps when locked

sevadro

New member
Hi,

I have a macro to skip a track in AIMP app with the proximity sensor. The screenshot is below, but the main point about the constraints is that the app should be in the foreground and device should be locked. The macro was created in 2020 for a Meizu phone, worked there flawlessly, now (for a couple of years) it is used on a Redmi (MIUI 12.5.8 = Android 12, Helper is installed, root right is given to MD). Everything worked fine until the version 5.53 (April 2025)

The symptoms are
  • Track don't skip when locked. The system log universally contains the line [Proximity Sensor (Near) did not fire because constraint failed: Device Locked (Skip track aimp) Skip track aimp]
  • If I disable the Locked part of constraint and test the macro with the unlocked phone and the AIMP app in the foreground, the macro works
  • Early last week when I tried to detect what was wrong, reentering the dialog with choosing the app and resaving the macro helped temporary. So the skipping started to work in the locked state, but this was not consistent, so like now it works, the next day this "fixed" macro didn't work
  • Changing choosing the package name instead of the app didn't help
The attached log is a fragment containing some latest tests when I tried to use the package name and probably tested without locking

Skip_Screen.jpg
 

Attachments

  • MacroDroidLog.txt
    4.8 KB · Views: 2

Endercraft

Moderator
Your app isn't in the foreground if the phone is locked (maybe that was the behavior before). Though the fact that it only stopped working at v5.53 is weird.
 

sevadro

New member
Thanks for your response.

A correction to my initial report, the universal log line that is produced is [Proximity Sensor (Near) did not fire because constraint failed: App foreground (AIMP) (Skip track aimp) (Skip track aimp)], sorry, I copied a wrong one to the post. A suggestion for future diagnostics of similar cases if it's possible: to add the package of the app that is foreground according the the MD to this message or maybe a sibling log line about this

Also, I'm not a deep Android developer, rather occasional so maybe the method I found is not the one the developers of MD use. Anyway, with adb in all three cases (not locked, locked with the screen on, locked with the screen off) the result is the same (this player AIMP I'm checking against)

> adb shell "dumpsys activity activities | grep ResumedActivity"
ResumedActivity: ActivityRecord{5c879a9 u0 com.aimp.player/.ui.activities.main.MainActivity t14040}
 

MacroDroidDev

Administrator
Staff member
@sevadro There was an inadvertant change in v5.53 that cause this issue. It should be back to how it was in 5.54 which should be in beta by the end of this week.
 

sevadro

New member
Thanks! That was quick

I must admit that the suggestion about the app name in the log was not necessary, MD already has the tool to output many useful things to the user log including the foreground app / package name.
 
Top