From 728586f5b23d830b1d14c61abcf85cd72dc95412 Mon Sep 17 00:00:00 2001 From: Martijn Coenen Date: Tue, 16 Jul 2019 13:15:48 +0200 Subject: [PATCH] Ignore class_{reset|start}_post_data on non-updatable APEX. For devices that use FDE and don't support updatable APEXes, don't stop and restart all processes - there is no need and it only increases boot time for these devices. Additionally, some daemons have never been restarted in the past, and restarting them exposes certain issues. Bug: 137251597 Bug: 136777273 Bug: 135627804 Test: verified manually w/ ro.updatable.apex=false Change-Id: I9590f2c2cdfab0a49f39846896460305d44221ee --- init/builtins.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/init/builtins.cpp b/init/builtins.cpp index ba2c7ac2e..ceab56877 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -42,6 +42,7 @@ #include #include +#include #include #include #include @@ -130,6 +131,13 @@ static Result do_class_start_post_data(const BuiltinArguments& args) { if (args.context != kInitContext) { return Error() << "command 'class_start_post_data' only available in init context"; } + static bool is_apex_updatable = android::sysprop::ApexProperties::updatable().value_or(false); + + if (!is_apex_updatable) { + // No need to start these on devices that don't support APEX, since they're not + // stopped either. + return {}; + } for (const auto& service : ServiceList::GetInstance()) { if (service->classnames().count(args[1])) { if (auto result = service->StartIfPostData(); !result) { @@ -155,6 +163,11 @@ static Result do_class_reset_post_data(const BuiltinArguments& args) { if (args.context != kInitContext) { return Error() << "command 'class_reset_post_data' only available in init context"; } + static bool is_apex_updatable = android::sysprop::ApexProperties::updatable().value_or(false); + if (!is_apex_updatable) { + // No need to stop these on devices that don't support APEX. + return {}; + } ForEachServiceInClass(args[1], &Service::ResetIfPostData); return {}; }