summaryrefslogtreecommitdiff
path: root/init/reboot.cpp
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2019-08-19 15:21:25 -0700
committerTom Cherry <tomcherry@google.com>2019-12-04 15:43:21 -0800
commitc88d8f93cfaa8cbf368a0fa94e8bc84bc55c3ece (patch)
tree3caaa75251230d98f2b21dadd9b8892c2442c976 /init/reboot.cpp
parentf7a6c4587f06bc7e79748acd97dc4dd5b741f328 (diff)
init: Replace property_set() with android::base::SetProperty()
Init is no longer a special case and talks to property service just like every other client, therefore move it away from property_set() and to android::base::SetProperty(). In doing so, this change moves the initial property set up from the kernel command line and property files directly into PropertyInit(). This makes the responsibilities between init and property services more clear. Test: boot, unit test cases Change-Id: I36b8c83e845d887f1b203355c2391ec123c3d05f
Diffstat (limited to 'init/reboot.cpp')
-rw-r--r--init/reboot.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/init/reboot.cpp b/init/reboot.cpp
index b04db7f66..e9d918e02 100644
--- a/init/reboot.cpp
+++ b/init/reboot.cpp
@@ -59,7 +59,6 @@
#include "builtin_arguments.h"
#include "init.h"
#include "mount_namespace.h"
-#include "property_service.h"
#include "reboot_utils.h"
#include "service.h"
#include "service_list.h"
@@ -548,7 +547,7 @@ static void DoReboot(unsigned int cmd, const std::string& reason, const std::str
reasons[1] == "hard" || reasons[1] == "warm")) {
skip = strlen("reboot,");
}
- property_set(LAST_REBOOT_REASON_PROPERTY, reason.c_str() + skip);
+ SetProperty(LAST_REBOOT_REASON_PROPERTY, reason.c_str() + skip);
sync();
bool is_thermal_shutdown = cmd == ANDROID_RB_THERMOFF;
@@ -619,7 +618,7 @@ static void DoReboot(unsigned int cmd, const std::string& reason, const std::str
bool do_shutdown_animation = GetBoolProperty("ro.init.shutdown_animation", false);
if (do_shutdown_animation) {
- property_set("service.bootanim.exit", "0");
+ SetProperty("service.bootanim.exit", "0");
// Could be in the middle of animation. Stop and start so that it can pick
// up the right mode.
boot_anim->Stop();
@@ -733,8 +732,8 @@ static Result<void> UnmountAllApexes() {
static Result<void> DoUserspaceReboot() {
LOG(INFO) << "Userspace reboot initiated";
boot_clock::time_point now = boot_clock::now();
- property_set("sys.init.userspace_reboot.last_started",
- std::to_string(now.time_since_epoch().count()));
+ SetProperty("sys.init.userspace_reboot.last_started",
+ std::to_string(now.time_since_epoch().count()));
auto guard = android::base::make_scope_guard([] {
// Leave shutdown so that we can handle a full reboot.
LeaveShutdown();