From 4f4caccefdd47d9d3ef98a0e1dacb8d00ff53a0a Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Tue, 8 Jan 2019 10:39:00 -0800 Subject: [PATCH] Revert "do not start shutdown animation from init" This reverts commit e2b04b71ae3792e2d8d2fda537343549ebfcc8bb. Conditionally reintroduce the shutdown animation as there is some interest in retaining it. Bug: 117854737 Test: n/a Change-Id: I99a085bc763e230de46aa44b3488d771f7ad04ce --- init/reboot.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/init/reboot.cpp b/init/reboot.cpp index 45dc6d316..e744be288 100644 --- a/init/reboot.cpp +++ b/init/reboot.cpp @@ -55,6 +55,7 @@ #include "service.h" #include "sigchld_handler.h" +using android::base::GetBoolProperty; using android::base::Split; using android::base::StringPrintf; using android::base::Timer; @@ -350,9 +351,31 @@ static void DoReboot(unsigned int cmd, const std::string& reason, const std::str Service* bootAnim = ServiceList::GetInstance().FindService("bootanim"); Service* surfaceFlinger = ServiceList::GetInstance().FindService("surfaceflinger"); if (bootAnim != nullptr && surfaceFlinger != nullptr && surfaceFlinger->IsRunning()) { - // will not check animation class separately + bool do_shutdown_animation = GetBoolProperty("ro.init.shutdown_animation", false); + + if (do_shutdown_animation) { + property_set("service.bootanim.exit", "0"); + // Could be in the middle of animation. Stop and start so that it can pick + // up the right mode. + bootAnim->Stop(); + } + for (const auto& service : ServiceList::GetInstance()) { - if (service->classnames().count("animation")) service->SetShutdownCritical(); + if (service->classnames().count("animation") == 0) { + continue; + } + + // start all animation classes if stopped. + if (do_shutdown_animation) { + service->Start().IgnoreError(); + } + service->SetShutdownCritical(); // will not check animation class separately + } + + if (do_shutdown_animation) { + bootAnim->Start().IgnoreError(); + surfaceFlinger->SetShutdownCritical(); + bootAnim->SetShutdownCritical(); } }