diff options
Diffstat (limited to 'cmds/dumpstate/dumpstate.cpp')
| -rw-r--r-- | cmds/dumpstate/dumpstate.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index 72f64eae1f..ae08f95cbb 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -68,6 +68,7 @@ #include <debuggerd/client.h> #include <dumpsys.h> #include <dumputils/dump_utils.h> +#include <hardware_legacy/power.h> #include <hidl/ServiceManagement.h> #include <log/log.h> #include <openssl/sha.h> @@ -174,6 +175,8 @@ static const std::string ANR_FILE_PREFIX = "anr_"; func_ptr(__VA_ARGS__); \ RETURN_IF_USER_DENIED_CONSENT(); +static const char* WAKE_LOCK_NAME = "dumpstate_wakelock"; + namespace android { namespace os { namespace { @@ -2431,6 +2434,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? |