class_start_post_data also starts disabled services.
This keyword was introduced to support restarting services on devices
using APEX and FDE. The current implementation is not a restart, but
rather a 'reset' followed by a 'start', because the real /data must be
mounted in-between those two actions. But we effectively want this to be
a restart, which means that we also want to start 'disabled' services
that were running at the time we called 'class_reset_post_data'.
To implement this, keep track of whether a service was running when its
class was reset at post-data, and start all those services.
Bug: 132592548
Test: manual testing on FDE Taimen
Change-Id: I1e81e2c8e0ab2782150073d74e50e4cd734af7b9
diff --git a/init/service.h b/init/service.h
index dc2b128..ae29f28 100644
--- a/init/service.h
+++ b/init/service.h
@@ -79,6 +79,7 @@
Result<Success> ExecStart();
Result<Success> Start();
Result<Success> StartIfNotDisabled();
+ Result<Success> StartIfPostData();
Result<Success> Enable();
void Reset();
void ResetIfPostData();
@@ -248,6 +249,8 @@
bool pre_apexd_ = false;
bool post_data_ = false;
+
+ bool running_at_post_data_reset_ = false;
};
class ServiceList {