diff --git a/suspend/1.0/default/SystemSuspend.cpp b/suspend/1.0/default/SystemSuspend.cpp index 9d88441..1f02992 100644 --- a/suspend/1.0/default/SystemSuspend.cpp +++ b/suspend/1.0/default/SystemSuspend.cpp @@ -33,6 +33,7 @@ #include #include +#include using ::android::base::GetBoolProperty; using ::android::base::GetProperty; @@ -292,6 +293,9 @@ bool SystemSuspend::forceSuspend() { // or reset mSuspendCounter, it just ignores them. When the system // returns from suspend, the wakelocks and SuspendCounter will not have // changed. + std::system("/system/bin/sh /system/etc/pre_sleep.sh"); + std::system("/system/bin/sh /vendor/etc/pre_sleep.sh"); + auto counterLock = std::unique_lock(mCounterLock); bool success = WriteStringToFd(getSleepState(), mStateFd); counterLock.unlock(); @@ -302,6 +306,9 @@ bool SystemSuspend::forceSuspend() { // light the screen up after suspend attempt, regardless of it failed or not // that way the user would know to try and sleep the device again if they want to mPwrbtnd->sendKeyWakeup(); + std::system("/system/bin/sh /system/etc/post_sleep.sh"); + std::system("/system/bin/sh /vendor/etc/post_sleep.sh"); + return success; } diff --git a/suspend/1.0/default/android.system.suspend@1.0-service.rc b/suspend/1.0/default/android.system.suspend@1.0-service.rc index f353302..05a2f33 100644 --- a/suspend/1.0/default/android.system.suspend@1.0-service.rc +++ b/suspend/1.0/default/android.system.suspend@1.0-service.rc @@ -1,5 +1,8 @@ service system_suspend /system/bin/hw/android.system.suspend@1.0-service class hal - user system - group system wakelock uhid input - capabilities BLOCK_SUSPEND + #user system + #group system wakelock uhid input + #capabilities BLOCK_SUSPEND + user root + group root + seclabel u:r:su:s0