Skip to content

Commit

Permalink
call /system/etc/(post/pre)_sleep.sh before and after sleep, allow mo…
Browse files Browse the repository at this point in the history
…dule probing
  • Loading branch information
Kethen committed Feb 8, 2024
1 parent 08dd259 commit 815b894
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions suspend/1.0/default/SystemSuspend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

#include <string>
#include <thread>
#include <cstdlib>

using ::android::base::Error;
using ::android::base::GetBoolProperty;
Expand Down Expand Up @@ -356,6 +357,8 @@ 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");

auto counterLock = std::unique_lock(mCounterLock);
bool success = WriteStringToFd(getSleepState(), mStateFd);
counterLock.unlock();
Expand All @@ -366,6 +369,8 @@ 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");

return success;
}

Expand Down
2 changes: 1 addition & 1 deletion suspend/1.0/default/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ service system_suspend /system/bin/hw/[email protected]
class early_hal
user system
group system wakelock uhid input
capabilities BLOCK_SUSPEND
capabilities BLOCK_SUSPEND SYS_MODULE

0 comments on commit 815b894

Please sign in to comment.