OSDN Git Service

Delay bootanimation exit until told to shutdown.
authorEd Coyne <edcoyne@google.com>
Tue, 26 Sep 2017 20:19:04 +0000 (13:19 -0700)
committerEd Coyne <edcoyne@google.com>
Tue, 26 Sep 2017 21:28:08 +0000 (14:28 -0700)
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

cmds/bootanimation/iot/iotbootanimation_main.cpp

index d62478b..d4b3bca 100644 (file)
@@ -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);