diff options
| author | 2019-07-12 10:47:52 +0100 | |
|---|---|---|
| committer | 2019-07-19 14:52:39 +0100 | |
| commit | f35ed4393db016b19d3d254840200722afa4a0cb (patch) | |
| tree | 961d2f4f8bafd3186bea7cf29743922f007f443b /cmds/dumpstate/dumpstate.cpp | |
| parent | a18cfb64c9a524289b1ea568e6cb343c8076c158 (diff) | |
Hold a wake lock when taking bug report
Bug: 128012377
Test: Turn the screen off after initiating bugreport,
Bugreport takes 2-5 minutes now, same takes around 30-40 minutes
without wake lock.
Test: Added debug messages in SystemSuspend logs to confirm
wake lock cleanup on dumpstate crash/exit.
Change-Id: Idbd2466e1d67e0157657f587cf951e9bc4a1ea05
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 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? |