Merge "ueventd: suggest move location for ueventd config" am: d438ea723b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2070481 Change-Id: I7cf5d29b22bd55c88fd53b93189e70d2fad50283 Ignore-AOSP-First: this is an automerge Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
49ec1df66c
1 changed files with 16 additions and 6 deletions
|
|
@ -298,21 +298,31 @@ void ColdBoot::Run() {
|
|||
|
||||
static UeventdConfiguration GetConfiguration() {
|
||||
auto hardware = android::base::GetProperty("ro.hardware", "");
|
||||
std::vector<std::string> legacy_paths{"/vendor/ueventd.rc", "/odm/ueventd.rc",
|
||||
"/ueventd." + hardware + ".rc"};
|
||||
|
||||
struct LegacyPathInfo {
|
||||
std::string legacy_path;
|
||||
std::string preferred;
|
||||
};
|
||||
std::vector<LegacyPathInfo> legacy_paths{
|
||||
{"/vendor/ueventd.rc", "/vendor/etc/ueventd.rc"},
|
||||
{"/odm/ueventd.rc", "/odm/etc/ueventd.rc"},
|
||||
{"/ueventd." + hardware + ".rc", "another ueventd.rc file"}};
|
||||
|
||||
std::vector<std::string> canonical{"/system/etc/ueventd.rc"};
|
||||
|
||||
if (android::base::GetIntProperty("ro.product.first_api_level", 10000) < __ANDROID_API_T__) {
|
||||
// TODO: Remove these legacy paths once Android S is no longer supported.
|
||||
canonical.insert(canonical.end(), legacy_paths.begin(), legacy_paths.end());
|
||||
for (const auto& info : legacy_paths) {
|
||||
canonical.push_back(info.legacy_path);
|
||||
}
|
||||
} else {
|
||||
// Warn if newer device is using legacy paths.
|
||||
for (const auto& path : legacy_paths) {
|
||||
if (access(path.c_str(), F_OK) == 0) {
|
||||
for (const auto& info : legacy_paths) {
|
||||
if (access(info.legacy_path.c_str(), F_OK) == 0) {
|
||||
LOG(FATAL_WITHOUT_ABORT)
|
||||
<< "Legacy ueventd configuration file detected and will not be parsed: "
|
||||
<< path;
|
||||
<< info.legacy_path << ". Please move your configuration to "
|
||||
<< info.preferred << " instead.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue