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

Commit 9f473c05 authored by Nikita Ioffe's avatar Nikita Ioffe
Browse files

Don't proceed with userspace reboot if device doesn't support it

Test: set property to false and adb reboot userspace
Bug: 135984674
Change-Id: I11e55243df002dd54e533a6b9fc529866597d4dd
parent 264a37d1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -834,6 +834,10 @@ static void UserspaceRebootWatchdogThread() {
}

static void HandleUserspaceReboot() {
    if (!android::sysprop::InitProperties::userspace_reboot_in_progress().value_or(false)) {
        LOG(ERROR) << "Attempted a userspace reboot on a device that doesn't support it";
        return;
    }
    // Spinnig up a separate thread will fail the setns call later in the boot sequence.
    // Fork a new process to monitor userspace reboot while we are investigating a better solution.
    pid_t pid = fork();
+9 −0
Original line number Diff line number Diff line
@@ -25,3 +25,12 @@ prop {
    integer_as_bool: true
}

# Shows whenever the device supports userspace reboot or not.
prop {
    api_name: "is_userspace_reboot_supported"
    type: Boolean
    scope: System
    access: Readonly
    prop_name: "ro.init.userspace_reboot.is_supported"
    integer_as_bool: true
}
+5 −0
Original line number Diff line number Diff line
props {
  module: "android.sysprop.InitProperties"
  prop {
    api_name: "is_userspace_reboot_supported"
    prop_name: "ro.init.userspace_reboot.is_supported"
    integer_as_bool: true
  }
  prop {
    api_name: "userspace_reboot_in_progress"
    access: ReadWrite