Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23dbd6dc authored by Nikita Ioffe's avatar Nikita Ioffe
Browse files

Make userspace_reboot.in_progress sysprop-as-api

sys.init.userspace_reboot.in_progress will be used to notify all
the processes (including vendor ones) that userspace reboot is
happening, hence it should be treated as stable public api.

All other sys.init.userspace_reboot.* props will be internal to /system
partition and don't require any stability guarantees.

Test: builds
Test: adb reboot userspace
Bug: 135984674
Change-Id: Ifb64a6bfae2de76bac67edea68df44e33c9cfe2d
parent dc4bd271
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -152,6 +152,7 @@ cc_library_static {
    whole_static_libs: [
        "libcap",
        "com.android.sysprop.apex",
        "com.android.sysprop.init",
    ],
    header_libs: ["bootimg_headers"],
    proto: {
+4 −1
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@
#include <memory>

#include <ApexProperties.sysprop.h>
#include <InitProperties.sysprop.h>
#include <android-base/chrono_utils.h>
#include <android-base/file.h>
#include <android-base/logging.h>
@@ -1222,7 +1223,9 @@ static Result<void> do_finish_userspace_reboot(const BuiltinArguments&) {
    boot_clock::time_point now = boot_clock::now();
    property_set("sys.init.userspace_reboot.last_finished",
                 std::to_string(now.time_since_epoch().count()));
    property_set(kUserspaceRebootInProgress, "0");
    if (!android::sysprop::InitProperties::userspace_reboot_in_progress(false)) {
        return Error() << "Failed to set sys.init.userspace_reboot.in_progress property";
    }
    return {};
}

+3 −2
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#include <thread>
#include <vector>

#include <InitProperties.sysprop.h>
#include <android-base/chrono_utils.h>
#include <android-base/file.h>
#include <android-base/logging.h>
@@ -743,8 +744,8 @@ static Result<void> DoUserspaceReboot() {
    // actions. We should make sure, that all of them are propagated before
    // proceeding with userspace reboot. Synchronously setting kUserspaceRebootInProgress property
    // is not perfect, but it should do the trick.
    if (property_set(kUserspaceRebootInProgress, "1") != 0) {
        return Error() << "Failed to set property " << kUserspaceRebootInProgress;
    if (!android::sysprop::InitProperties::userspace_reboot_in_progress(true)) {
        return Error() << "Failed to set sys.init.userspace_reboot.in_progress property";
    }
    EnterShutdown();
    std::vector<Service*> stop_first;
+0 −2
Original line number Diff line number Diff line
@@ -22,8 +22,6 @@
namespace android {
namespace init {

static const constexpr char* kUserspaceRebootInProgress = "sys.init.userspace_reboot.in_progress";

// Parses and handles a setprop sys.powerctl message.
void HandlePowerctlMessage(const std::string& command);

+7 −0
Original line number Diff line number Diff line
sysprop_library {
  name: "com.android.sysprop.init",
  srcs: ["InitProperties.sysprop"],
  property_owner: "Platform",
  api_packages: ["android.sysprop"],
  recovery_available: true,
}
Loading