summaryrefslogtreecommitdiffstats
path: root/init/builtins.cpp
diff options
context:
space:
mode:
authorMartijn Coenen <maco@google.com>2019-07-16 13:15:48 +0200
committerMichael Bestas <mkbestas@lineageos.org>2020-01-13 17:43:31 +0200
commitd8c6c0804ff9fb2a0f83de6c9b96578345e0ff2e (patch)
tree60a299d3eef23826f4db6948f70f1e15f6e678de /init/builtins.cpp
parentaa39415260171b8a5645a5c255330eb98e1de020 (diff)
downloadsystem_core-d8c6c0804ff9fb2a0f83de6c9b96578345e0ff2e.tar.gz
system_core-d8c6c0804ff9fb2a0f83de6c9b96578345e0ff2e.tar.bz2
system_core-d8c6c0804ff9fb2a0f83de6c9b96578345e0ff2e.zip
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 (cherry picked from commit 728586f5b23d830b1d14c61abcf85cd72dc95412)
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r--init/builtins.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 459276ca8..7db851ac6 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -41,6 +41,7 @@
#include <sys/wait.h>
#include <unistd.h>
+#include <ApexProperties.sysprop.h>
#include <android-base/chrono_utils.h>
#include <android-base/file.h>
#include <android-base/logging.h>
@@ -126,6 +127,13 @@ static Result<Success> 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) {
@@ -151,6 +159,11 @@ static Result<Success> 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 Success();
}