From a8a2c5a7e19dad4ba79ae0281b8d36a9042877ce Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Mon, 20 May 2024 21:56:19 +0000 Subject: [PATCH] init: delay 'user root' test to W+ We'll make it a build time check in V after this. Due to being a runtime flog, it was hard to spot and debug, so delaying. Bug: 340953047 Test: boot, CtsInitTestCases Change-Id: Ica1a1c780e230c88615dad7937404d2b0fe9c68f --- init/host_init_stubs.h | 1 + init/init_test.cpp | 2 +- init/service_parser.cpp | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/init/host_init_stubs.h b/init/host_init_stubs.h index 753ed6bb2..2fef9d349 100644 --- a/init/host_init_stubs.h +++ b/init/host_init_stubs.h @@ -32,6 +32,7 @@ #define __ANDROID_API_S__ 31 #define __ANDROID_API_T__ 33 #define __ANDROID_API_U__ 34 +#define __ANDROID_API_V__ 35 // sys/system_properties.h #define PROP_VALUE_MAX 92 diff --git a/init/init_test.cpp b/init/init_test.cpp index 7e8513bfc..b2f586b78 100644 --- a/init/init_test.cpp +++ b/init/init_test.cpp @@ -630,7 +630,7 @@ service A something ASSERT_TRUE(parser.ParseConfig(tf.path)); - if (GetIntProperty("ro.vendor.api_level", 0) > __ANDROID_API_U__) { + if (GetIntProperty("ro.vendor.api_level", 0) > __ANDROID_API_V__) { ASSERT_EQ(1u, parser.parse_error_count()); } else { ASSERT_EQ(0u, parser.parse_error_count()); diff --git a/init/service_parser.cpp b/init/service_parser.cpp index 92e350be6..6f3e3682e 100644 --- a/init/service_parser.cpp +++ b/init/service_parser.cpp @@ -680,12 +680,12 @@ Result ServiceParser::EndSection() { } if (service_->proc_attr_.parsed_uid == std::nullopt) { - if (android::base::GetIntProperty("ro.vendor.api_level", 0) > __ANDROID_API_U__) { + if (android::base::GetIntProperty("ro.vendor.api_level", 0) > __ANDROID_API_V__) { return Error() << "No user specified for service '" << service_->name() - << "'. Defaults to root."; + << "', so it would have been root."; } else { LOG(WARNING) << "No user specified for service '" << service_->name() - << "'. Defaults to root."; + << "', so it is root."; } }