From 372278c86de490b7db331f2fb60c0662bd0404ac Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 14 Feb 2019 12:46:13 -0800 Subject: [PATCH] init: Set a property indicating that we're booting into a GSI. Bug: 123777418 Test: gsid.image_running is set after booting into GSI Change-Id: I8ec79fa58b41b04676de0c8909fcd520c28c05ab --- init/init.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/init/init.cpp b/init/init.cpp index a8924f2d4..bbef1a9a1 100644 --- a/init/init.cpp +++ b/init/init.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -695,6 +696,13 @@ int SecondStageMain(int argc, char** argv) { // Nexus 9 boot time, so it's disabled by default. if (false) DumpState(); + // Make the GSI status available before scripts start running. + if (android::gsi::IsGsiRunning()) { + property_set("ro.gsid.image_running", "1"); + } else { + property_set("ro.gsid.image_running", "0"); + } + am.QueueBuiltinAction(SetupCgroupsAction, "SetupCgroups"); am.QueueEventTrigger("early-init");