diff options
| author | 2017-09-26 13:19:04 -0700 | |
|---|---|---|
| committer | 2017-09-26 14:28:08 -0700 | |
| commit | aa599b90f79db61c843a6bb08a03a4e2a6fa1a20 (patch) | |
| tree | 0bc76c64c6e94eaa2524e73fd3210084edcf7776 | |
| parent | f2ebc4028659ff153e0cf56043f75c7b90eeb4b8 (diff) | |
Delay bootanimation exit until told to shutdown.
We delay shutting down the animation if there is a boot action present
until we are told by the system to shutdown.
This addresses an issue we are seeing where we switched to a very short
bootanimation (bootanimation_mini.zip) to save CPU but this kills the
boot action prematurely.
Bug: 37992717
Test: Ran locally against imx7d.
Change-Id: I23556b21128b80d08cc55eaa761439a570b8eebe
| -rw-r--r-- | cmds/bootanimation/iot/iotbootanimation_main.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cmds/bootanimation/iot/iotbootanimation_main.cpp b/cmds/bootanimation/iot/iotbootanimation_main.cpp index d62478b27638..d4b3bca9967c 100644 --- a/cmds/bootanimation/iot/iotbootanimation_main.cpp +++ b/cmds/bootanimation/iot/iotbootanimation_main.cpp @@ -64,6 +64,20 @@ class BootActionAnimationCallbacks : public android::BootAnimation::Callbacks {p void shutdown() override { if (mBootAction != nullptr) { + // If we have a bootaction we want to wait until we are actually + // told to shut down. If the animation exits early keep the action + // running. + char value[PROPERTY_VALUE_MAX] = {0}; + for (int exitRequested = 0; exitRequested == 0; ) { + property_get("service.bootanim.exit", value, "0"); + exitRequested = atoi(value); + + // Poll value at 10hz. + if (exitRequested == 0) { + usleep(100000); + } + } + mBootAction->shutdown(); // Give it two seconds to shut down. sleep(2); |