Files
sxmo-utils/scripts/core/sxmo_lock_idle.sh
Stacy Harper 37425a5809 Prevent the phone to be soft lock in dangling not suspended state
The current while : sleep 30 code can cause some random issues and leave
the phone in not suspended state indefinitely. Ex:

* just after the 30 second check
* mpc play a 20 second duration music
* lock
* 8 and 16 seconds timeouts will not lock deeper cause the phone is idle
* the music stop
* 30 seconds check will then still see the phone as not idle

Here we can see how sxmo will never restart the idle timeouts timers.

To solve this, this patch try to simplify some things.

We will use the sxmo_idle.sh to restart itself. It means
that 10 seconds after last user action (2 seconds after the lock idle
trigger at 8 seconds), the timeout timer will be restarted, every time.

With this patch, it looks to me impossible for the phone to stay in an
dangling not suspended mode cause it will trigger a
sxmo_screenlock_deeper every 10 seconds whathever the phone is idle
doing thing or not.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-11-05 18:07:36 +01:00

25 lines
318 B
Bash

#!/bin/sh
stop_idle() {
kill "$IDLEPID"
}
start_idle() {
sxmo_idle.sh \
timeout 8 'sxmo_screenlock_deeper.sh --idle' \
timeout 10 "busybox kill -USR1 $$" &
IDLEPID=$!
}
restart_idle() {
stop_idle
start_idle
wait "$IDLEPID"
}
trap 'restart_idle' USR1
trap 'stop_idle' TERM INT
start_idle
wait "$IDLEPID"