From 41c15b192e27565243100aede54db0b035caa3ad Mon Sep 17 00:00:00 2001 From: Stacy Harper Date: Wed, 30 Jun 2021 09:15:13 +0200 Subject: [PATCH] Prevent rtcwake to go to crust when not expected If you unlock the phone in rtcwake, then the next rtcwake will put the phone back to crust cause last wake up reason still is rtc. To prevent this, we also check the last state and expect it to be crust. Signed-off-by: Stacy Harper Signed-off-by: Anjandev Momi --- scripts/core/sxmo_rtcwake.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/core/sxmo_rtcwake.sh b/scripts/core/sxmo_rtcwake.sh index 7b89524..9b80788 100644 --- a/scripts/core/sxmo_rtcwake.sh +++ b/scripts/core/sxmo_rtcwake.sh @@ -11,11 +11,11 @@ finish() { sxmo_screenlock.sh updateLed - if grep -q rtc "$UNSUSPENDREASONFILE"; then + if grep -q crust "$LASTSTATE" \ + && grep -q rtc "$UNSUSPENDREASONFILE" \ + && [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; then # Going back to crust - if [ "$(sxmo_screenlock.sh getCurState)" != "unlock" ]; then - sxmo_screenlock.sh crust - fi + sxmo_screenlock.sh crust fi exit 0