Fix profile switching in the brightness actions
@ngraham suggested in 394945 that I try to fix the bug. So here is the fix, I hope this is the appropriate channel to submit it.
The current code assumes that the action is notified of every profile change, which is only the case when the action is configured to run in all profiles. The code that prevents brightness from being raised when switching to a more conservative profile gets confused if the action didn't run in the "previous" profile. Make it more robust by always querying the core for the previous profile, which it luckily hasn't updated yet when the action gets executed.
BUG: 394945
FIXED-IN: 5.25
The bug appears to be present in the wireless action as well. The fix there will probably be more involved because there is no equivalent to brightness()
--- i.e. the state needed by the action isn't magically recorded elsewhere in the system. So I need to teach the action that a profile where it's disabled is equivalent to NoAction
... Hints welcome.