init: V devices need to specify user
This also specifies user on an adbd service
declaration which was missing before. It seems
that certain services are declared mulitple
times.
Fixes: 276813155
Test: boot (on CF, the only V device in the tree)
Test: remove 'user' specification and see error
Change-Id: I138f3ace72d46f221551ad61e75ba4c01632da59
diff --git a/init/service_parser.cpp b/init/service_parser.cpp
index d89664c..d46e1f7 100644
--- a/init/service_parser.cpp
+++ b/init/service_parser.cpp
@@ -25,6 +25,7 @@
#include <android-base/logging.h>
#include <android-base/parseint.h>
+#include <android-base/properties.h>
#include <android-base/strings.h>
#include <hidl-util/FQName.h>
#include <processgroup/processgroup.h>
@@ -678,8 +679,13 @@
}
if (service_->proc_attr_.parsed_uid == std::nullopt) {
- LOG(WARNING) << "No user specified for service '" << service_->name()
- << "'. Defaults to root.";
+ if (android::base::GetIntProperty("ro.vendor.api_level", 0) > __ANDROID_API_U__) {
+ return Error() << "No user specified for service '" << service_->name()
+ << "'. Defaults to root.";
+ } else {
+ LOG(WARNING) << "No user specified for service '" << service_->name()
+ << "'. Defaults to root.";
+ }
}
if (interface_inheritance_hierarchy_) {