From cacf04351fcb6cbb73740ca078dcf93635a7f098 Mon Sep 17 00:00:00 2001 From: Martin Stjernholm Date: Wed, 21 Aug 2019 18:34:31 +0100 Subject: [PATCH] Update logic for detecting pre-apexd services to check that the ART APEX is mounted. Necessary to make e.g. bootanimation work, which depends on (at least) libandroidicu.so in the ART APEX. Test: Build & boot Bug: 135753770 Exempt-From-Owner-Approval: Approved internally Change-Id: Ibab4f5f7a243d0815b9c70a537bae8d77dee2fbb Merged-In: Ibab4f5f7a243d0815b9c70a537bae8d77dee2fbb --- init/service.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/init/service.cpp b/init/service.cpp index 9537843a1..7a209664e 100644 --- a/init/service.cpp +++ b/init/service.cpp @@ -116,9 +116,10 @@ static bool ExpandArgsAndExecv(const std::vector& args, bool sigsto return execv(c_strings[0], c_strings.data()) == 0; } -static bool IsRuntimeApexReady() { +static bool AreRuntimeApexesReady() { struct stat buf; - return stat("/apex/com.android.runtime/", &buf) == 0; + return stat("/apex/com.android.art/", &buf) == 0 && + stat("/apex/com.android.runtime/", &buf) == 0; } unsigned long Service::next_start_order_ = 1; @@ -406,11 +407,11 @@ Result Service::Start() { scon = *result; } - if (!IsRuntimeApexReady() && !pre_apexd_) { - // If this service is started before the runtime APEX gets available, - // mark it as pre-apexd one. Note that this marking is permanent. So - // for example, if the service is re-launched (e.g., due to crash), - // it is still recognized as pre-apexd... for consistency. + if (!AreRuntimeApexesReady() && !pre_apexd_) { + // If this service is started before the Runtime and ART APEXes get + // available, mark it as pre-apexd one. Note that this marking is + // permanent. So for example, if the service is re-launched (e.g., due + // to crash), it is still recognized as pre-apexd... for consistency. pre_apexd_ = true; }