summaryrefslogtreecommitdiff
path: root/cmds/dumpstate/dumpstate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/dumpstate/dumpstate.cpp')
-rw-r--r--cmds/dumpstate/dumpstate.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 1fc8107f9e..483cb9e938 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -58,6 +58,7 @@
#include <debuggerd/client.h>
#include <dumpsys.h>
#include <dumputils/dump_utils.h>
+#include <hardware_legacy/power.h>
#include <hidl/ServiceManagement.h>
#include <openssl/sha.h>
#include <private/android_filesystem_config.h>
@@ -144,6 +145,8 @@ static Dumpstate& ds = Dumpstate::GetInstance();
func_ptr(__VA_ARGS__); \
RETURN_IF_USER_DENIED_CONSENT();
+static const char* WAKE_LOCK_NAME = "dumpstate_wakelock";
+
namespace android {
namespace os {
namespace {
@@ -2405,6 +2408,13 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid,
MYLOGI("begin\n");
+ if (acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_NAME) < 0) {
+ MYLOGE("Failed to acquire wake lock: %s\n", strerror(errno));
+ } else {
+ // Wake lock will be released automatically on process death
+ MYLOGD("Wake lock acquired.\n");
+ }
+
register_sig_handler();
// TODO(b/111441001): maybe skip if already started?