Merge "init: do not impose vendor_init restrictions on old vendor images" am: 4396bb85da
am: 1aea110cad
Change-Id: I337819da9e62377a3f47acda0772fa20cb676931
This commit is contained in:
commit
9223bfdabe
|
@ -35,6 +35,11 @@ namespace base {
|
|||
|
||||
std::string GetProperty(const std::string& key, const std::string& default_value);
|
||||
bool GetBoolProperty(const std::string& key, bool default_value);
|
||||
template <typename T>
|
||||
T GetIntProperty(const std::string&, T default_value, T = std::numeric_limits<T>::min(),
|
||||
T = std::numeric_limits<T>::max()) {
|
||||
return default_value;
|
||||
}
|
||||
|
||||
} // namespace base
|
||||
} // namespace android
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
|
||||
using namespace std::literals;
|
||||
|
||||
using android::base::GetIntProperty;
|
||||
using android::base::ReadFileToString;
|
||||
using android::base::Split;
|
||||
using android::base::StartsWith;
|
||||
|
@ -541,9 +542,11 @@ static void LoadProperties(char* data, const char* filter, const char* filename)
|
|||
size_t flen = 0;
|
||||
|
||||
const char* context = kInitContext.c_str();
|
||||
for (const auto& [path_prefix, secontext] : paths_and_secontexts) {
|
||||
if (StartsWith(filename, path_prefix)) {
|
||||
context = secontext;
|
||||
if (GetIntProperty("ro.vndk.version", 28) >= 28) {
|
||||
for (const auto& [path_prefix, secontext] : paths_and_secontexts) {
|
||||
if (StartsWith(filename, path_prefix)) {
|
||||
context = secontext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include "util.h"
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#include <android-base/properties.h>
|
||||
|
||||
#include "property_service.h"
|
||||
#include "selinux.h"
|
||||
#else
|
||||
|
@ -37,6 +39,7 @@
|
|||
#endif
|
||||
|
||||
using android::base::GetExecutablePath;
|
||||
using android::base::GetIntProperty;
|
||||
using android::base::Join;
|
||||
using android::base::Socketpair;
|
||||
using android::base::Split;
|
||||
|
@ -354,8 +357,10 @@ Result<std::vector<std::string>> Subcontext::ExpandArgs(const std::vector<std::s
|
|||
static std::vector<Subcontext> subcontexts;
|
||||
|
||||
std::vector<Subcontext>* InitializeSubcontexts() {
|
||||
for (const auto& [path_prefix, secontext] : paths_and_secontexts) {
|
||||
subcontexts.emplace_back(path_prefix, secontext);
|
||||
if (GetIntProperty("ro.vndk.version", 28) >= 28) {
|
||||
for (const auto& [path_prefix, secontext] : paths_and_secontexts) {
|
||||
subcontexts.emplace_back(path_prefix, secontext);
|
||||
}
|
||||
}
|
||||
return &subcontexts;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue