From 5088e588f7d68716e7641f520b961f28e06f676b Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Wed, 29 May 2024 00:03:19 +0000 Subject: [PATCH] init: 'user root' check use vendor API This changes user root to use the year date format that vendor API uses. Previously this still applied to V devices, which switched to using API level 202404 after 35. They recommend the year/date form, and there is no constant for this. Bug: 340953047 Test: service_test Change-Id: I5ba8d1251c877a785e41f0cfcc35d7cb0776f8c7 --- init/host_init_stubs.h | 1 - init/init_test.cpp | 2 +- init/service_parser.cpp | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/init/host_init_stubs.h b/init/host_init_stubs.h index 2fef9d349..753ed6bb2 100644 --- a/init/host_init_stubs.h +++ b/init/host_init_stubs.h @@ -32,7 +32,6 @@ #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 b2f586b78..50882737c 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_V__) { + if (GetIntProperty("ro.vendor.api_level", 0) > 202404) { 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 6f3e3682e..de902e6a8 100644 --- a/init/service_parser.cpp +++ b/init/service_parser.cpp @@ -680,7 +680,7 @@ Result ServiceParser::EndSection() { } if (service_->proc_attr_.parsed_uid == std::nullopt) { - if (android::base::GetIntProperty("ro.vendor.api_level", 0) > __ANDROID_API_V__) { + if (android::base::GetIntProperty("ro.vendor.api_level", 0) > 202404) { return Error() << "No user specified for service '" << service_->name() << "', so it would have been root."; } else {