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

Commit 849b4817 authored by Tom Cherry's avatar Tom Cherry Committed by android-build-merger
Browse files

Merge "init: log all failures of Service::Start()"

am: 9bde0dc7

Change-Id: Ibb27338bb694482108ffc558b2823c583a9701d3
parents 83114035 9bde0dc7
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -177,7 +177,9 @@ static std::optional<boot_clock::time_point> RestartProcesses() {

        auto restart_time = s->time_started() + 5s;
        if (boot_clock::now() > restart_time) {
            s->Start();
            if (auto result = s->Start(); !result) {
                LOG(ERROR) << "Could not restart process '" << s->name() << "': " << result.error();
            }
        } else {
            if (!next_process_restart_time || restart_time < *next_process_restart_time) {
                next_process_restart_time = restart_time;
@@ -195,7 +197,9 @@ void handle_control_message(const std::string& msg, const std::string& name) {
    }

    if (msg == "start") {
        svc->Start();
        if (auto result = svc->Start(); !result) {
            LOG(ERROR) << "Could not ctl.start service '" << name << "': " << result.error();
        }
    } else if (msg == "stop") {
        svc->Stop();
    } else if (msg == "restart") {
+5 −2
Original line number Diff line number Diff line
@@ -81,8 +81,11 @@ static void handle_keychord() {
    if (adb_enabled == "running") {
        Service* svc = ServiceList::GetInstance().FindService(id, &Service::keychord_id);
        if (svc) {
            LOG(INFO) << "Starting service " << svc->name() << " from keychord " << id;
            svc->Start();
            LOG(INFO) << "Starting service '" << svc->name() << "' from keychord " << id;
            if (auto result = svc->Start(); !result) {
                LOG(ERROR) << "Could not start service '" << svc->name() << "' from keychord " << id
                           << ": " << result.error();
            }
        } else {
            LOG(ERROR) << "Service for keychord " << id << " not found";
        }
+9 −2
Original line number Diff line number Diff line
@@ -374,10 +374,17 @@ void DoReboot(unsigned int cmd, const std::string& reason, const std::string& re
        if (kill_after_apps.count(s->name())) {
            s->SetShutdownCritical();
        } else if (to_starts.count(s->name())) {
            s->Start();
            if (auto result = s->Start(); !result) {
                LOG(ERROR) << "Could not start shutdown 'to_start' service '" << s->name()
                           << "': " << result.error();
            }
            s->SetShutdownCritical();
        } else if (s->IsShutdownCritical()) {
            s->Start();  // start shutdown critical service if not started
            // Start shutdown critical service if not started.
            if (auto result = s->Start(); !result) {
                LOG(ERROR) << "Could not start shutdown critical service '" << s->name()
                           << "': " << result.error();
            }
        }
    }