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
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);