Merge "Use ro.boot.serialconsole to disable console services" am: 8dab2ef586

Original change: https://android-review.googlesource.com/c/platform/system/core/+/2451765

Change-Id: I7885352f27b5a64cf36151c919996d73d65414e4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-03-02 20:29:11 +00:00 committed by Automerger Merge Worker
commit 55ba50e20f

View file

@ -447,6 +447,15 @@ Result<void> Service::CheckConsole() {
return {};
}
// On newer kernels, /dev/console will always exist because
// "console=ttynull" is hard-coded in CONFIG_CMDLINE. This new boot
// property should be set via "androidboot.serialconsole=0" to explicitly
// disable services requiring the console. For older kernels and boot
// images, not setting this at all will fall back to the old behavior
if (GetProperty("ro.boot.serialconsole", "") == "0") {
return {};
}
if (proc_attr_.console.empty()) {
proc_attr_.console = "/dev/" + GetProperty("ro.boot.console", "console");
}