Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04541ec1 authored by David Anderson's avatar David Anderson Committed by Automerger Merge Worker
Browse files

Merge "Fix shutdown animation cannot be shown" am: 95983cbb am: 5392f87b am: ffeb077b

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1795394

Change-Id: Ic7481651306e2cfdcdd69f81327b75a29dd54215
parents e0d2ffe2 ffeb077b
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -639,6 +639,7 @@ static void DoReboot(unsigned int cmd, const std::string& reason, const std::str
        abort();
        abort();
    }
    }


    bool do_shutdown_animation = GetBoolProperty("ro.init.shutdown_animation", false);
    // watchdogd is a vendor specific component but should be alive to complete shutdown safely.
    // watchdogd is a vendor specific component but should be alive to complete shutdown safely.
    const std::set<std::string> to_starts{"watchdogd"};
    const std::set<std::string> to_starts{"watchdogd"};
    std::set<std::string> stop_first;
    std::set<std::string> stop_first;
@@ -652,6 +653,8 @@ static void DoReboot(unsigned int cmd, const std::string& reason, const std::str
                           << "': " << result.error();
                           << "': " << result.error();
            }
            }
            s->SetShutdownCritical();
            s->SetShutdownCritical();
        } else if (do_shutdown_animation) {
            continue;
        } else if (s->IsShutdownCritical()) {
        } else if (s->IsShutdownCritical()) {
            // Start shutdown critical service if not started.
            // Start shutdown critical service if not started.
            if (auto result = s->Start(); !result.ok()) {
            if (auto result = s->Start(); !result.ok()) {
@@ -664,14 +667,13 @@ static void DoReboot(unsigned int cmd, const std::string& reason, const std::str
    }
    }


    // remaining operations (specifically fsck) may take a substantial duration
    // remaining operations (specifically fsck) may take a substantial duration
    if (cmd == ANDROID_RB_POWEROFF || is_thermal_shutdown) {
    if (!do_shutdown_animation && (cmd == ANDROID_RB_POWEROFF || is_thermal_shutdown)) {
        TurnOffBacklight();
        TurnOffBacklight();
    }
    }


    Service* boot_anim = ServiceList::GetInstance().FindService("bootanim");
    Service* boot_anim = ServiceList::GetInstance().FindService("bootanim");
    Service* surface_flinger = ServiceList::GetInstance().FindService("surfaceflinger");
    Service* surface_flinger = ServiceList::GetInstance().FindService("surfaceflinger");
    if (boot_anim != nullptr && surface_flinger != nullptr && surface_flinger->IsRunning()) {
    if (boot_anim != nullptr && surface_flinger != nullptr && surface_flinger->IsRunning()) {
        bool do_shutdown_animation = GetBoolProperty("ro.init.shutdown_animation", false);


        if (do_shutdown_animation) {
        if (do_shutdown_animation) {
            SetProperty("service.bootanim.exit", "0");
            SetProperty("service.bootanim.exit", "0");