postmarketos-base: conditionally cancel suspend with elogind
This is an attempt to implement the 'short term' solution described here: #843 (comment 436873580)
TODO:
-
Once a suspend is canceled by the hook, elogind doesn't try to suspend the system again. It should try again after the amount of idle time has been surpassed (again) - it looks like it tries again if elogind sees action in the session (e.g. display is woken up, UI interaction takes place). Is this good enough?
- EDIT: This is good enough for now
-
/lib/apk/db/lock
doesn't actually get cleaned up by apk, so another test is needed for determining if apk is active (pgrep for process, or ??)- apk doesn't create/remove this file, it gets an exclusive lock on it, so the hook uses lslocks to check this condition.
-
Anything else to block suspend on? Not sure if music players, etc can be added to this.. - EDIT: No, will do follow up MR for anything else that comes along
Edited by Administrator